/* 
* Enhanced Responsive Behavior for Nursil Website
* Optimized for all device sizes with improved interactions
*/

/* ===== RESPONSIVE VARIABLES ===== */
:root {
    /* Breakpoints */
    --breakpoint-xs: 480px;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1440px;
    
    /* Container widths */
    --container-xs: 100%;
    --container-sm: 540px;
    --container-md: 720px;
    --container-lg: 960px;
    --container-xl: 1140px;
    --container-xxl: 1320px;
}

/* ===== CONTAINER OPTIMIZATION ===== */
.container {
    width: 100%;
    max-width: var(--container-xxl);
    margin: 0 auto;
    padding-left: max(var(--spacing-md), 4vw);
    padding-right: max(var(--spacing-md), 4vw);
}

@media (max-width: 1440px) {
    .container {
        max-width: var(--container-xl);
    }
}

@media (max-width: 1200px) {
    .container {
        max-width: var(--container-lg);
    }
}

@media (max-width: 992px) {
    .container {
        max-width: var(--container-md);
    }
}

@media (max-width: 768px) {
    .container {
        max-width: var(--container-sm);
        padding-left: max(var(--spacing-sm), 3vw);
        padding-right: max(var(--spacing-sm), 3vw);
    }
}

@media (max-width: 576px) {
    .container {
        max-width: var(--container-xs);
        padding-left: var(--spacing-sm);
        padding-right: var(--spacing-sm);
    }
}

/* ===== FLUID TYPOGRAPHY ===== */
html {
    font-size: 62.5%; /* 10px base at desktop sizes */
}

@media (max-width: 1440px) {
    html {
        font-size: 60%; /* 9.6px base */
    }
}

@media (max-width: 1200px) {
    html {
        font-size: 56.25%; /* 9px base */
    }
}

@media (max-width: 992px) {
    html {
        font-size: 52.5%; /* 8.4px base */
    }
}

@media (max-width: 768px) {
    html {
        font-size: 50%; /* 8px base */
    }
}

@media (max-width: 480px) {
    html {
        font-size: 47%; /* 7.5px base - increased from 45% for better readability */
    }
}

/* ===== RESPONSIVE NAVIGATION ===== */
@media (max-width: 992px) {
    .navbar {
        padding: var(--spacing-sm) 0;
        justify-content: space-between;
    }
    
    .nav-menu {
        position: fixed;
        top: -100%;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(48, 53, 60, 0.95);
        backdrop-filter: blur(15px);
        display: flex;
        justify-content: center;
        align-items: center;
        transition: var(--transition-normal);
        z-index: 999;
        opacity: 0;
    }
    
    .nav-menu.active {
        top: 0;
        opacity: 1;
    }
    
    .nav-list {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-xl);
    }
    
    .nav-item {
        transform: translateY(20px);
        opacity: 0;
        transition: transform 0.4s ease, opacity 0.4s ease;
        transition-delay: 0.1s;
        margin: 0;
    }
    
    .nav-menu.active .nav-item {
        transform: translateY(0);
        opacity: 1;
    }
    
    .nav-menu.active .nav-item:nth-child(1) { transition-delay: 0.1s; }
    .nav-menu.active .nav-item:nth-child(2) { transition-delay: 0.2s; }
    .nav-menu.active .nav-item:nth-child(3) { transition-delay: 0.3s; }
    .nav-menu.active .nav-item:nth-child(4) { transition-delay: 0.4s; }
    .nav-menu.active .nav-item:nth-child(5) { transition-delay: 0.5s; }
    
    .nav-link {
        font-size: 2.4rem;
        padding: var(--spacing-xs) var(--spacing-md);
    }
    
    .nav-link::after {
        bottom: 0;
    }
    
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        cursor: pointer;
        z-index: 1000;
    }
    
    .bar {
        display: block;
        width: 100%;
        height: 2px;
        background-color: var(--color-text);
        transition: var(--transition-fast);
        border-radius: 1px;
    }
    
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
        background-color: var(--color-accent);
    }
    
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
        background-color: var(--color-accent);
    }
    
    .btn-primary {
        padding: 1.2rem 2.4rem;
    }
    
    .language-toggle {
        margin-top: var(--spacing-md);
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .navbar {
        padding: var(--spacing-xs) 0;
    }
    
    .logo-text {
        font-size: 2.2rem;
    }
    
    .btn-primary {
        display: none;
    }
}

/* ===== RESPONSIVE HERO SECTION ===== */
@media (max-width: 992px) {
    .hero {
        min-height: calc(100vh - 80px);
        padding: var(--spacing-xxl) 0;
        justify-content: center;
    }
    
    .hero-content {
        max-width: 100%;
        text-align: center;
    }
    
    .hero-title {
        font-size: clamp(3.6rem, 7vw, 7.2rem);
    }
    
    .hero-subtitle {
        font-size: clamp(1.8rem, 3vw, 2.4rem);
    }
}

@media (max-width: 768px) {
    .hero-buttons {
        flex-direction: column;
        gap: var(--spacing-md);
        max-width: 300px;
        margin: 0 auto;
        margin-top: var(--spacing-lg);
        align-items: center;
    }
    
    .hero-buttons .btn {
        width: 100%;
        text-align: center;
    }
}

/* ===== RESPONSIVE STATS SECTION ===== */
@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .stat-item {
        padding: var(--spacing-md);
    }
}

/* ===== RESPONSIVE ABOUT SECTION ===== */
@media (max-width: 992px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .about-contact {
        margin-top: var(--spacing-lg);
        padding: var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    .about-contact {
        max-width: 100%;
    }
    
    .client-logos {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ===== RESPONSIVE SERVICES SECTION ===== */
@media (max-width: 1200px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .service-card {
        max-width: 100%;
        padding: var(--spacing-md);
    }
}

/* ===== RESPONSIVE TAHADI ZONE SECTION ===== */
@media (max-width: 992px) {
    .tahadi-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .tahadi-image {
        order: 1;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .tahadi-info {
        order: 2;
        padding: var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    .tahadi-features {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .app-buttons {
        flex-direction: column;
        gap: var(--spacing-md);
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 576px) {
    .tahadi-features {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .feature-item {
        padding: var(--spacing-md);
    }
}

/* ===== RESPONSIVE CONTACT SECTION ===== */
@media (max-width: 992px) {
    .contact-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .map-placeholder {
        min-height: 250px;
        margin-bottom: var(--spacing-lg);
    }
    
    .contact-form {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .info-items {
        flex-direction: column;
        gap: var(--spacing-md);
    }
}

/* ===== RESPONSIVE FOOTER ===== */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .footer-bottom {
        text-align: center;
        margin-top: var(--spacing-lg);
    }
}

/* ===== TOUCH OPTIMIZATIONS ===== */
@media (hover: none) {
    /* Optimize for touch devices */
    .btn, 
    .nav-link, 
    .service-card, 
    .feature-item, 
    .app-button, 
    .social-icon,
    .contact-item {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Increase touch targets */
    .nav-link,
    .btn,
    .social-icon,
    .app-button {
        padding: max(var(--spacing-sm), 12px) max(var(--spacing-md), 20px);
    }
    
    .form-group input,
    .form-group textarea {
        padding: max(1.8rem, 16px) max(2rem, 16px);
    }
    
    /* Disable hover effects that don't work well on touch */
    .nav-link:hover::after {
        width: 0;
    }
    
    .nav-link:active::after {
        width: 100%;
    }
    
    /* Use active states instead of hover */
    .btn:active,
    .service-card:active,
    .feature-item:active,
    .app-button:active,
    .social-icon:active {
        transform: scale(0.98);
    }
    
    /* Hide cursor effects on touch devices */
    .cursor-dot,
    .cursor-outline {
        display: none;
    }
}

/* ===== SMALL MOBILE DEVICES ===== */
@media screen and (max-width: 375px) {
    .hero-title {
        font-size: 3.6rem;
    }
    
    .section-title {
        font-size: 3.2rem;
    }
    
    .service-card,
    .stat-item,
    .feature-item {
        padding: var(--spacing-sm);
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
        font-size: 3rem;
        margin-bottom: var(--spacing-md);
    }
    
    .process-step {
        flex-direction: column;
    }
    
    .step-number {
        width: 60px;
        height: 60px;
        font-size: 2.8rem;
        margin: 0 auto var(--spacing-sm) auto;
    }
    
    .step-content {
        text-align: center;
    }
}

/* ===== TABLETS AND IPADS ===== */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .hero-content {
        max-width: 700px;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tahadi-content {
        grid-template-columns: 1fr;
    }
    
    .tahadi-image {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .process-steps {
        max-width: 700px;
    }
}

/* ===== LARGE DESKTOP SCREENS ===== */
@media screen and (min-width: 1440px) {
    html {
        font-size: 65%; /* 10.4px base for larger screens */
    }
    
    .container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 8rem;
    }
    
    .hero-subtitle {
        font-size: 2.4rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-xl);
    }
    
    .process-steps {
        max-width: 1100px;
    }
}

/* ===== ULTRA-WIDE SCREENS ===== */
@media screen and (min-width: 1920px) {
    html {
        font-size: 70%; /* 11.2px base for ultra-wide screens */
    }
    
    .container {
        max-width: 1800px;
    }
    
    .hero-title {
        font-size: 9rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: calc(var(--spacing-xl) * 1.5);
    }
    
    .process-steps {
        max-width: 1400px;
    }
}

/* ===== MOBILE BOTTOM NAVIGATION ===== */
/* Hide mobile navigation by default */
.mobile-nav {
    display: none;
}

/* Force mobile navigation to show on mobile devices */
@media (max-width: 768px) {
    .mobile-nav {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background-color: rgba(48, 53, 60, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        z-index: 999 !important;
        height: 65px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3) !important;
    }
    
    .mobile-nav-list {
        display: flex;
        width: 100%;
        justify-content: space-around;
        padding: 0;
        margin: 0;
        list-style: none;
        align-items: center;
        height: 100%;
    }
    
    .mobile-nav-item {
        list-style: none;
        flex: 1;
        text-align: center;
    }
    
    .mobile-nav-link {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        padding: 8px 0;
        color: rgba(255, 255, 255, 0.6);
        text-decoration: none;
        font-size: 1.2rem;
        transition: all 0.2s ease;
    }
    
    .mobile-nav-link img {
        width: 24px !important;
        height: 24px !important;
        margin-bottom: 4px;
        transition: all 0.2s ease;
    }
    
    .mobile-nav-link span {
        font-size: 1rem;
        font-weight: 500;
    }
    
    .mobile-nav-link.active {
        color: var(--color-accent);
    }
    
    .mobile-nav-link.active img {
        transform: translateY(-2px);
    }
    
    .mobile-nav-link:active {
        transform: scale(0.95);
    }
    
    /* Fix X logo images in social icons for mobile */
    .social-icon img {
        width: 20px !important;
        height: 20px !important;
        border-radius: 3px;
        object-fit: cover;
        display: block;
    }
    
    /* Add padding to the bottom of the page for the fixed navigation */
    body {
        padding-bottom: 80px !important;
    }
    
    /* Fix visibility of mobile menu */
    .nav-menu {
        display: flex;
        position: fixed;
        top: -100vh;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(48, 53, 60, 0.95);
        backdrop-filter: blur(15px);
        justify-content: center;
        align-items: center;
        transition: all 0.3s ease-in-out;
        z-index: 999;
        opacity: 0;
        visibility: hidden;
    }
    
    .nav-menu.active {
        top: 0;
        opacity: 1;
        visibility: visible;
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
    }
    
    /* Extra space for larger mobiles */
    .footer {
        margin-bottom: 80px !important;
    }
    
    /* Mobile language toggle improvements */
    .mobile-language-toggle {
        display: flex !important;
        align-items: center;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 20px;
        padding: 4px 8px;
        margin-right: 10px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        order: 2;
    }
    
    .mobile-language-toggle i {
        color: var(--color-accent);
        font-size: 1.2rem;
        margin-right: 6px;
    }
    
    .mobile-language-toggle a {
        color: var(--color-text-muted);
        font-size: 1.2rem;
        padding: 2px 6px;
        transition: var(--transition-normal);
        position: relative;
        text-decoration: none;
    }
    
    .mobile-language-toggle a.active {
        color: var(--color-accent);
        font-weight: 500;
    }
}
