/* ==========================================
   BOOFABI PARSEH - RESPONSIVE STYLESHEET
   Professional Mobile-First Rewrite
   ========================================== */

/* ==========================================
   GLOBAL MOBILE FIXES
   ========================================== */
html {
    overflow-y: auto !important;
    overscroll-behavior-y: auto !important;
}

body {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    touch-action: manipulation;
}

/* Allow vertical scroll on globe canvas */
.globe-canvas {
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
}

/* ==========================================
   LARGE DESKTOP (1440px and up)
   ========================================== */
@media (min-width: 1440px) {
    .container {
        max-width: 1440px;
        padding: 0 var(--spacing-xl);
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
    
    .hero-buttons .btn {
        padding: 1.125rem 2.75rem;
        font-size: 1.25rem;
        min-height: 56px;
    }
    
    .services-grid,
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }
}

/* ==========================================
   DESKTOP (1024px to 1439px)
   ========================================== */
@media (max-width: 1439px) {
    .container {
        max-width: 1280px;
        padding: 0 var(--spacing-lg);
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .hero-subtitle {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
}

/* ==========================================
   TABLET LANDSCAPE (768px to 1023px)
   ========================================== */
@media (max-width: 1023px) {
    /* Container */
    .container {
        padding: 0 var(--spacing-md);
    }
    
    /* Typography */
    h1 { font-size: 3rem; line-height: 1.1; }
    h2 { font-size: 2.25rem; line-height: 1.2; }
    h3 { font-size: 1.875rem; line-height: 1.3; }
    h4 { font-size: 1.5rem; line-height: 1.4; }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .section-subtitle {
        font-size: 1.25rem;
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 100vh;
        padding-top: 70px;
    }
    
    .hero-title {
        font-size: 3.25rem;
        line-height: 1.15;
    }
    
    .hero-subtitle {
        font-size: 1.5rem;
        line-height: 1.4;
    }
    
    .hero-tagline {
        font-size: 1.25rem;
        line-height: 1.5;
    }
    
    .hero-description {
        font-size: 1.125rem;
        line-height: 1.7;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .hero-buttons .btn {
        width: 100%;
        min-height: 52px;
    }
    
    .hero-highlights {
        gap: var(--spacing-xl);
        flex-wrap: wrap;
    }
    
    .highlight-item {
        font-size: 1rem;
    }
    
    /* Services Grid */
    .services-grid,
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: var(--spacing-xl);
    }
    
    /* Contact Section */
    .contact-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-2xl);
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xl);
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-lg);
    }
}

/* ==========================================
   TABLET PORTRAIT (600px to 767px)
   ========================================== */
@media (max-width: 767px) {
    /* Navigation - Mobile Menu with Brave Animation */
    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 88%;
        height: 100vh;
        background: white;
        flex-direction: column;
        padding: var(--spacing-2xl) var(--spacing-xl);
        gap: var(--spacing-lg);
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
        transform: translateX(100%);
        transition: transform var(--transition-slow) cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-top: 80px;
    }
    
    [dir="rtl"] .nav-menu {
        right: auto;
        left: 0;
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.15);
        transform: translateX(-100%);
    }
    
    .nav-menu.active {
        transform: translateX(0);
    }
    
    [dir="rtl"] .nav-menu.active {
        transform: translateX(0);
    }
    
    /* Mobile menu overlay */
    .nav-menu::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
        z-index: -1;
        pointer-events: none;
    }
    
    .nav-menu.active::before {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
    }
    
    .nav-menu a {
        font-size: 1.5rem;
        padding: var(--spacing-md) 0;
        min-height: 56px;
        font-weight: 700;
        color: var(--text-dark) !important;
    }
    
    .nav-menu a:hover {
        color: var(--primary-color) !important;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .language-selector {
        order: -1;
        position: relative;
        z-index: 1000;
    }
    
    /* Transparent header adjustments on mobile */
    .hero-section .navbar {
        background: rgba(10, 14, 39, 0.85) !important;
        padding: 0.75rem 0 !important;
    }
    
    .hero-section .nav-menu a {
        color: rgba(255, 255, 255, 0.95) !important;
    }
    
    .hero-section .lang-btn {
        background: rgba(255, 255, 255, 0.2) !important;
        color: white !important;
        border-color: rgba(255, 255, 255, 0.35) !important;
    }
    
    .hero-section .mobile-menu-toggle span {
        background: white !important;
    }
    
    /* Language dropdown on mobile */
    .lang-dropdown {
        min-width: 200px;
        max-height: 300px;
        font-size: 1rem;
        right: 0;
        top: calc(100% + 0.5rem);
    }
    
    [dir="rtl"] .lang-dropdown {
        left: 0;
        right: auto;
    }
    
    .lang-option {
        padding: 0.875rem 1.25rem;
        font-size: 1.05rem;
        min-height: 52px;
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 100dvh;
        padding-top: 70px;
    }
    
    .hero-title {
        font-size: 2.75rem;
        line-height: 1.15;
    }
    
    .hero-subtitle {
        font-size: 1.375rem;
        line-height: 1.4;
    }
    
    .hero-tagline {
        font-size: 1.125rem;
        line-height: 1.5;
    }
    
    .hero-description {
        font-size: 1.125rem;
        line-height: 1.7;
    }
    
    .hero-highlights {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-md);
        padding-top: var(--spacing-lg);
    }
    
    .highlight-item {
        justify-content: center;
        font-size: 1.05rem;
    }
    
    /* Section Spacing */
    .services-section,
    .projects-section,
    .about-section,
    .contact-section {
        padding: var(--spacing-2xl) 0;
    }
    
    .section-header {
        margin-bottom: var(--spacing-2xl);
    }
    
    .section-title {
        font-size: 2.25rem;
        line-height: 1.2;
    }
    
    .section-subtitle {
        font-size: 1.125rem;
        line-height: 1.6;
    }
    
    /* Service Cards */
    .service-card {
        padding: var(--spacing-xl);
    }
    
    .service-icon {
        font-size: 3.5rem;
    }
    
    .service-title {
        font-size: 1.75rem;
    }
    
    .service-subtitle {
        font-size: 1.125rem;
    }
    
    /* Project Results */
    .project-results {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .result-number {
        font-size: 2.25rem;
    }
    
    /* Teams Grid */
    .teams-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
    
    .stat-number {
        font-size: 2.75rem;
    }
    
    /* Contact Form */
    .contact-form-wrapper {
        padding: var(--spacing-xl);
    }
    
    .contact-method {
        flex-direction: column;
        text-align: center;
        padding: var(--spacing-lg);
    }
    
    .method-icon {
        font-size: 2.75rem;
        margin-bottom: var(--spacing-md);
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-2xl);
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-badges {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
    }
}

/* ==========================================
   MOBILE (0px to 599px) - OPTIMIZED
   ========================================== */
@media (max-width: 599px) {
    /* Root Font Size */
    :root {
        --font-size-base: 16px;
    }
    
    /* Container */
    .container {
        padding: 0 var(--spacing-md);
    }
    
    /* Typography */
    h1 { font-size: 2.25rem; line-height: 1.2; }
    h2 { font-size: 1.875rem; line-height: 1.3; }
    h3 { font-size: 1.5rem; line-height: 1.4; }
    h4 { font-size: 1.25rem; line-height: 1.5; }
    h5 { font-size: 1.125rem; line-height: 1.5; }
    p { font-size: 1.05rem; line-height: 1.7; }
    
    .section-title {
        font-size: 2rem;
        line-height: 1.25;
    }
    
    .section-subtitle {
        font-size: 1.125rem;
        line-height: 1.6;
    }
    
    /* Navigation */
    .nav-container {
        padding: 0.75rem var(--spacing-md);
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    /* Mobile menu */
    .nav-menu {
        width: 92%;
        padding: var(--spacing-xl) var(--spacing-lg);
        padding-top: 70px;
    }
    
    [dir="rtl"] .nav-menu {
        width: 92%;
    }
    
    .nav-menu a {
        font-size: 1.375rem;
        padding: 0.75rem 0;
        min-height: 52px;
    }
    
    /* Language selector */
    .lang-btn {
        padding: 0.75rem 1.25rem;
        font-size: 1.05rem;
        min-height: 50px;
    }
    
    .lang-dropdown {
        min-width: 180px;
        font-size: 1rem;
    }
    
    .lang-option {
        padding: 0.875rem 1.125rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    /* Transparent header adjustments */
    .navbar {
        padding: 0.5rem 0;
    }
    
    .nav-container {
        padding: 0.5rem var(--spacing-md);
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 100dvh !important;
        height: auto !important;
        padding-top: 60px;
    }
    
    .globe-canvas {
        height: 75dvh !important;
        top: 12.5dvh !important;
    }
    
    .hero-content {
        padding: var(--spacing-xl) var(--spacing-md);
    }
    
    .hero-title {
        font-size: 2.25rem;
        margin-bottom: var(--spacing-md);
        line-height: 1.2;
        text-shadow: 
            0 3px 20px rgba(0, 0, 0, 0.6),
            0 6px 30px rgba(37, 99, 235, 0.35);
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
        margin-bottom: var(--spacing-sm);
        text-shadow: 
            0 2px 12px rgba(0, 0, 0, 0.5),
            0 4px 16px rgba(0, 0, 0, 0.35);
    }
    
    .hero-tagline {
        font-size: 1.125rem;
        margin-bottom: var(--spacing-md);
        text-shadow: 
            0 2px 10px rgba(0, 0, 0, 0.45),
            0 3px 12px rgba(0, 0, 0, 0.3);
    }
    
    .hero-description {
        font-size: 1.125rem;
        line-height: 1.75;
        margin-bottom: var(--spacing-xl);
        text-shadow: 
            0 1px 8px rgba(0, 0, 0, 0.4),
            0 2px 10px rgba(0, 0, 0, 0.25);
    }
    
    .hero-buttons {
        gap: var(--spacing-md);
        flex-direction: column;
    }
    
    .hero-buttons .btn {
        padding: 1.125rem 1.75rem;
        font-size: 1.125rem;
        min-height: 56px;
        width: 100%;
    }
    
    .hero-highlights {
        gap: var(--spacing-md);
    }
    
    .highlight-item {
        font-size: 1rem;
        gap: 0.625rem;
    }
    
    .highlight-icon {
        font-size: 1.5rem;
    }
    
    /* Scroll Indicator */
    .scroll-indicator {
        bottom: 2rem;
    }
    
    .mouse {
        width: 32px;
        height: 50px;
    }
    
    /* Section Spacing */
    .services-section,
    .projects-section,
    .about-section,
    .contact-section {
        padding: var(--spacing-2xl) 0;
    }
    
    .section-header {
        margin-bottom: var(--spacing-2xl);
    }
    
    /* Services */
    .services-grid,
    .projects-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .service-card,
    .project-card {
        padding: var(--spacing-xl);
    }
    
    .service-icon {
        font-size: 3rem;
        margin-bottom: var(--spacing-md);
    }
    
    .service-title {
        font-size: 1.625rem;
    }
    
    .service-subtitle {
        font-size: 1.125rem;
    }
    
    .service-features li {
        font-size: 1.05rem;
        padding: 0.625rem 0;
    }
    
    .service-pricing {
        padding: var(--spacing-md);
    }
    
    .price {
        font-size: 2rem;
    }
    
    .price-note {
        font-size: 1rem;
    }
    
    .featured-badge {
        top: -12px;
        right: var(--spacing-md);
        padding: 0.625rem 1.25rem;
        font-size: 1rem;
    }
    
    [dir="rtl"] .featured-badge {
        right: auto;
        left: var(--spacing-md);
    }
    
    /* Projects */
    .project-title {
        font-size: 1.75rem;
    }
    
    .project-category {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    
    .project-description {
        font-size: 1.05rem;
    }
    
    .project-tags {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .tag {
        font-size: 0.95rem;
        padding: 0.5rem 1rem;
        min-height: 36px;
    }
    
    /* About Section */
    .about-story h3 {
        font-size: 1.875rem;
    }
    
    .about-story p {
        font-size: 1.125rem;
    }
    
    .teams-grid {
        gap: var(--spacing-xl);
    }
    
    .team-card {
        padding: var(--spacing-xl);
    }
    
    .team-icon {
        font-size: 3.5rem;
    }
    
    .team-card h4 {
        font-size: 1.5rem;
    }
    
    .team-card p,
    .team-card blockquote {
        font-size: 1.05rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    .stat-label {
        font-size: 1.125rem;
    }
    
    /* Contact Section */
    .contact-info h3 {
        font-size: 1.875rem;
    }
    
    .contact-methods {
        margin: var(--spacing-xl) 0;
    }
    
    .contact-method {
        margin-bottom: var(--spacing-lg);
        padding: var(--spacing-md);
    }
    
    .method-icon {
        font-size: 2.25rem;
        min-width: 48px;
    }
    
    .method-details h4 {
        font-size: 1.25rem;
    }
    
    .method-details a,
    .method-details p {
        font-size: 1.05rem;
    }
    
    .payment-methods {
        padding: var(--spacing-md);
    }
    
    .payment-methods h4 {
        font-size: 1.25rem;
    }
    
    .payment-icons {
        font-size: 2.25rem;
        gap: var(--spacing-md);
    }
    
    .payment-note {
        font-size: 1.05rem;
    }
    
    /* Contact Form */
    .contact-form-wrapper {
        padding: var(--spacing-xl);
    }
    
    .contact-form h3 {
        font-size: 1.75rem;
        margin-bottom: var(--spacing-lg);
    }
    
    .form-group {
        margin-bottom: var(--spacing-lg);
    }
    
    .form-group label {
        font-size: 1.125rem;
        margin-bottom: 0.625rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 1.125rem;
        font-size: 1.05rem;
        min-height: 52px;
    }
    
    .promo-banner {
        flex-direction: column;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
        text-align: center;
    }
    
    .promo-icon {
        font-size: 2.5rem;
        min-width: auto;
    }
    
    .promo-content h4 {
        font-size: 1.25rem;
    }
    
    .promo-content p {
        font-size: 1.05rem;
    }
    
    /* Footer */
    .footer {
        padding: var(--spacing-2xl) 0 var(--spacing-md);
    }
    
    .footer-grid {
        gap: var(--spacing-xl);
    }
    
    .footer-col h4 {
        font-size: 1.375rem;
        margin-bottom: var(--spacing-md);
    }
    
    .footer-col p {
        font-size: 1.05rem;
    }
    
    .footer-links li {
        margin-bottom: 0.75rem;
    }
    
    .footer-links a {
        font-size: 1.05rem;
        min-height: 48px;
        padding: 0.5rem 0;
    }
    
    .social-links {
        gap: var(--spacing-md);
        font-size: 1.75rem;
    }
    
    .social-links a {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .crypto-accepted {
        font-size: 1.05rem;
    }
    
    .footer-bottom {
        padding-top: var(--spacing-md);
        gap: var(--spacing-md);
        flex-direction: column;
        text-align: center;
    }
    
    .footer-bottom p {
        font-size: 1.05rem;
    }
    
    .footer-badges {
        gap: var(--spacing-md);
        flex-direction: column;
        align-items: center;
    }
    
    .footer-badges span {
        font-size: 1.05rem;
        justify-content: center;
    }
    
    /* Back to Top Button */
    .back-to-top {
        bottom: 2rem;
        right: 2rem;
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    
    [dir="rtl"] .back-to-top {
        right: auto;
        left: 2rem;
    }
    
    /* Buttons */
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1.05rem;
        min-height: 52px;
    }
}

/* ==========================================
   EXTRA SMALL MOBILE (0px to 374px)
   ========================================== */
@media (max-width: 374px) {
    :root {
        --font-size-base: 16px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .service-card,
    .project-card,
    .team-card,
    .contact-form-wrapper {
        padding: var(--spacing-md);
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .hero-buttons .btn {
        padding: 1rem 1.5rem;
        font-size: 1.125rem;
    }
    
    .nav-menu {
        width: 95%;
        padding: var(--spacing-lg) var(--spacing-md);
        padding-top: 65px;
    }
    
    .nav-menu a {
        font-size: 1.25rem;
        padding: 0.625rem 0;
    }
    
    .lang-btn {
        padding: 0.625rem 1rem;
        font-size: 1rem;
    }
    
    .lang-dropdown {
        min-width: 160px;
        font-size: 0.95rem;
    }
    
    .lang-option {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        min-height: 44px;
    }
}

/* ==========================================
   LANDSCAPE ORIENTATION (Mobile)
   ========================================== */
@media (max-height: 600px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: var(--spacing-2xl) 0;
    }
    
    .globe-canvas {
        height: 60dvh !important;
        top: 5dvh !important;
    }
    
    .scroll-indicator {
        display: none;
    }
    
    .hero-content {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .nav-menu {
        height: auto;
        max-height: calc(100dvh - 60px);
        overflow-y: auto;
        padding-top: 65px;
    }
}

/* ==========================================
   PERFORMANCE OPTIMIZATIONS FOR MOBILE
   ========================================== */
@media (max-width: 767px) {
    /* Reduce animation complexity */
    * {
        transition-duration: 150ms !important;
    }
    
    /* Optimize rendering */
    .hero-section,
    .globe-canvas,
    canvas,
    .navbar {
        will-change: transform, opacity;
        backface-visibility: hidden;
    }
    
    /* Reduce box-shadow complexity */
    .service-card,
    .project-card,
    .team-card,
    .contact-form-wrapper {
        box-shadow: var(--shadow-md) !important;
    }
}

/* ==========================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================== */
/* Minimum touch target size (WCAG 2.1 AA) */
@media (max-width: 767px) {
    a,
    button,
    .btn,
    input,
    select,
    textarea {
        min-height: 48px !important;
        min-width: 48px !important;
    }
    
    /* Increase tap target spacing */
    .nav-menu a,
    .footer-links a,
    .lang-option {
        padding: 0.875rem 0 !important;
    }
    
    /* Larger form elements */
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 52px !important;
        padding: 1rem !important;
        font-size: 1.125rem !important;
    }
}

/* ==========================================
   SAFARI iOS SPECIFIC FIXES
   ========================================== */
@supports (-webkit-touch-callout: none) {
    .hero-section {
        min-height: -webkit-fill-available !important;
    }
    
    html {
        height: -webkit-fill-available !important;
    }
    
    body {
        height: -webkit-fill-available !important;
    }
    
    .nav-menu {
        -webkit-overflow-scrolling: touch;
    }
}