/* ===== RESPONSIVE MASTER FIX - COMPLETE SOLUTION ===== */
/* This file provides the final fixes for all responsive and navigation issues */

/* ===== GLOBAL RESPONSIVE RESET ===== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    top: 0 !important;
    left: 0 !important;
}

/* ===== CONTAINER SYSTEM FIX ===== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 576px) {
    .container { padding: 0 1.5rem; }
}

@media (min-width: 768px) {
    .container { padding: 0 2rem; }
}

@media (min-width: 1024px) {
    .container { padding: 0 2rem; }
}

@media (min-width: 1200px) {
    .container { padding: 0 2rem; }
}

/* ===== HEADER/NAVIGATION FIXES ===== */
.header, #header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(15px) !important;
    border-bottom: 1px solid rgba(28, 41, 81, 0.1) !important;
    z-index: 1000 !important;
    transition: all 0.3s ease !important;
}

.nav-container {
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 0 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 70px !important;
    position: relative !important;
}

@media (min-width: 768px) {
    .nav-container {
        padding: 0 2rem !important;
        height: 80px !important;
    }
}

@media (min-width: 1024px) {
    .nav-container {
        height: 90px !important;
    }
}

/* ===== HAMBURGER MENU - SINGLE IMPLEMENTATION FIX ===== */
/* Remove duplicate hamburger menus */
.hamburger:not(:first-of-type),
.menu-toggle:not(.hamburger),
.mobile-menu-toggle:not(.hamburger) {
    display: none !important;
}

/* Primary hamburger menu styling */
.hamburger {
    display: none !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 40px !important;
    height: 40px !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    z-index: 1001 !important;
    position: relative !important;
}

.hamburger span {
    width: 24px !important;
    height: 2px !important;
    background: var(--text-dark, #333) !important;
    display: block !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    margin: 3px 0 !important;
}

/* Hamburger animation when active */
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px) !important;
}

.hamburger.active span:nth-child(2) {
    opacity: 0 !important;
    transform: translateX(20px) !important;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px) !important;
}

/* Show hamburger only on mobile/tablet */
@media (max-width: 1023px) {
    .hamburger {
        display: flex !important;
    }
}

/* ===== NAVIGATION MENU FIXES ===== */
.nav-menu {
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
}

/* Mobile navigation fixes */
@media (max-width: 1023px) {
    .nav-menu {
        position: fixed !important;
        top: 70px !important;
        left: -100% !important;
        width: 100% !important;
        height: calc(100vh - 70px) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(15px) !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0 !important;
        padding: 2rem 1rem !important;
        transition: all 0.3s ease !important;
        overflow-y: auto !important;
        z-index: 999 !important;
        -webkit-overflow-scrolling: touch !important;
        border-top: 1px solid rgba(28, 41, 81, 0.1) !important;
    }
    
    .nav-menu.active {
        left: 0 !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    }
    
    .nav-item {
        width: 100% !important;
        border-bottom: 1px solid rgba(28, 41, 81, 0.1) !important;
    }
    
    .nav-link {
        width: 100% !important;
        padding: 1rem 0 !important;
        font-size: 1.1rem !important;
        background: none !important;
        border-radius: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        min-height: 48px !important;
        color: var(--text-dark, #333) !important;
        text-decoration: none !important;
    }
    
    .nav-link:hover {
        background: rgba(28, 41, 81, 0.05) !important;
        color: var(--primary-color, #1c2951) !important;
    }
}

/* Desktop navigation */
@media (min-width: 1024px) {
    .nav-link {
        display: flex !important;
        align-items: center !important;
        padding: 1rem 1.2rem !important;
        color: var(--text-dark, #333) !important;
        text-decoration: none !important;
        font-weight: 500 !important;
        font-size: 0.95rem !important;
        transition: all 0.3s ease !important;
        border-radius: 8px !important;
    }
    
    .nav-link:hover {
        color: var(--primary-color, #1c2951) !important;
        background: rgba(28, 41, 81, 0.05) !important;
    }
}

/* ===== HERO SECTION RESPONSIVE FIXES ===== */
.hero,
.hero-section {
    min-height: 100vh !important;
    padding-top: 70px !important;
    padding-bottom: 2rem !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    overflow: hidden !important;
}

@media (min-width: 768px) {
    .hero,
    .hero-section {
        padding-top: 80px !important;
        padding-bottom: 3rem !important;
    }
}

@media (min-width: 1024px) {
    .hero,
    .hero-section {
        padding-top: 90px !important;
        padding-bottom: 4rem !important;
    }
}

/* Desktop: Ensure hero maintains full height and doesn't get ruined */
@media (min-width: 1024px) {
    .hero,
    .hero-section {
        min-height: 100vh !important;
    }
    
    .hero-container {
        display: grid !important;
        grid-template-columns: 1.2fr 1fr !important;
        gap: 4rem !important;
        align-items: center !important;
        min-height: calc(100vh - 140px) !important;
    }
}

/* Mobile hero adjustments */
@media (max-width: 1023px) {
    .hero,
    .hero-section {
        min-height: 80vh !important;
        padding-top: 70px !important;
    }
    
    .hero-container {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        align-items: center !important;
        text-align: center !important;
    }
}

@media (max-width: 767px) {
    .hero,
    .hero-section {
        min-height: 70vh !important;
        padding-top: 70px !important;
        padding-bottom: 2rem !important;
    }
}

/* ===== RESPONSIVE TYPOGRAPHY FIXES ===== */
/* Hero titles */
.hero-title,
.hero h1 {
    font-size: clamp(2rem, 5vw + 1rem, 4rem) !important;
    line-height: 1.1 !important;
    margin-bottom: clamp(1rem, 2vw, 1.5rem) !important;
    font-weight: 700 !important;
}

.hero-description,
.hero p {
    font-size: clamp(1rem, 2vw + 0.3rem, 1.3rem) !important;
    line-height: 1.6 !important;
    margin-bottom: clamp(1.5rem, 3vw, 2rem) !important;
    opacity: 0.9 !important;
}

/* Section titles */
h1 { font-size: clamp(1.75rem, 4vw + 1rem, 3.5rem) !important; line-height: 1.1 !important; }
h2 { font-size: clamp(1.5rem, 3.5vw + 0.5rem, 2.8rem) !important; line-height: 1.2 !important; }
h3 { font-size: clamp(1.25rem, 2.5vw + 0.5rem, 2.2rem) !important; line-height: 1.3 !important; }
p { font-size: clamp(0.9rem, 1.5vw + 0.2rem, 1.1rem) !important; line-height: 1.6 !important; }

/* ===== BUTTON SYSTEM FIXES ===== */
.btn,
button,
.button,
a.btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(10px, 2vw, 15px) clamp(20px, 4vw, 30px) !important;
    font-size: clamp(14px, 2.5vw, 16px) !important;
    text-decoration: none !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-height: 44px !important;
    min-width: 44px !important;
    font-weight: 500 !important;
    text-align: center !important;
}

/* Touch-friendly buttons on mobile */
@media (max-width: 767px) {
    .btn,
    button,
    .button,
    a.btn {
        padding: 12px 20px !important;
        font-size: 16px !important;
        min-height: 48px !important;
        width: 100% !important;
        justify-content: center !important;
    }
    
    .hero-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
        align-items: center !important;
    }
    
    .hero-buttons .btn {
        width: 100% !important;
        max-width: 300px !important;
    }
}

/* Desktop button groups */
@media (min-width: 768px) {
    .hero-buttons {
        display: flex !important;
        flex-direction: row !important;
        gap: 1.5rem !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .hero-buttons .btn {
        width: auto !important;
        min-width: 150px !important;
    }
}

/* ===== CREDENTIAL FIXES ===== */
.hero-credentials {
    display: grid !important;
    gap: 1rem !important;
    margin-top: 2rem !important;
}

@media (max-width: 575px) {
    .hero-credentials {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 576px) {
    .hero-credentials {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.2rem !important;
    }
}

@media (min-width: 768px) {
    .hero-credentials {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.5rem !important;
    }
}

.credential {
    text-align: center !important;
    background: rgba(255, 255, 255, 0.12) !important;
    padding: 1rem 0.5rem !important;
    border-radius: 10px !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    transition: all 0.3s ease !important;
    min-height: 80px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

@media (min-width: 768px) {
    .credential {
        padding: 1.2rem 0.8rem !important;
        min-height: 100px !important;
    }
}

/* ===== SECTION SPACING FIXES ===== */
.section {
    padding: clamp(40px, 8vw, 80px) 0 !important;
}

/* ===== GRID SYSTEM FIXES ===== */
.services-grid {
    display: grid !important;
    gap: 1rem !important;
    grid-template-columns: 1fr !important;
}

@media (min-width: 576px) {
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
        gap: 1.5rem !important;
    }
}

@media (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
        gap: 2rem !important;
    }
}

@media (min-width: 1200px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2.5rem !important;
    }
}

/* ===== FLOATING ELEMENTS PERFORMANCE FIX ===== */
/* Disable on mobile for better performance */
@media (max-width: 767px) {
    .floating-elements,
    .element {
        display: none !important;
    }
}

/* ===== PRELOADER RESPONSIVE FIXES ===== */
.preloader {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.preloader-content {
    text-align: center !important;
    padding: 2rem !important;
    max-width: 90% !important;
}

@media (max-width: 767px) {
    .preloader-content {
        padding: 1rem !important;
    }
    
    .preloader-content h1 {
        font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
    }
    
    .preloader-content p {
        font-size: clamp(0.9rem, 3vw, 1.1rem) !important;
    }
    
    .preloader-logo img {
        width: clamp(200px, 50vw, 280px) !important;
    }
}

/* ===== DROPDOWN MENU FIXES ===== */
.dropdown-menu {
    position: absolute !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
}

@media (min-width: 1024px) {
    .dropdown:hover .dropdown-menu {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

@media (max-width: 1023px) {
    .dropdown-menu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: none !important;
        width: 100% !important;
        background: rgba(248, 250, 252, 0.9) !important;
        margin-top: 1rem !important;
        border-radius: 8px !important;
        padding: 1rem !important;
    }
    
    .dropdown-menu.mobile-open {
        display: block !important;
    }
}

/* ===== ACCESSIBILITY FIXES ===== */
/* Focus indicators */
*:focus {
    outline: 2px solid #4299e1 !important;
    outline-offset: 2px !important;
}

/* Touch targets */
@media (max-width: 767px) {
    a, button, input, select, textarea, .clickable {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    .nav-link {
        min-height: 48px !important;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .header,
    .hamburger,
    .nav-menu,
    .floating-elements,
    .preloader {
        display: none !important;
    }
    
    .hero,
    .hero-section {
        min-height: auto !important;
        padding: 2rem 0 !important;
    }
    
    body {
        font-size: 12pt !important;
        color: #000 !important;
        background: #fff !important;
    }
}

/* ===== FINAL OVERRIDES ===== */
/* Ensure no conflicts with other CSS */
@media (min-width: 1024px) {
    /* Desktop layout preservation */
    .hero-container {
        display: grid !important;
        grid-template-columns: 1.2fr 1fr !important;
        gap: 4rem !important;
        text-align: left !important;
    }
    
    .hero-content {
        max-width: none !important;
    }
    
    .hero-buttons {
        justify-content: flex-start !important;
    }
}

/* Ensure mobile menu doesn't conflict */
@media (max-width: 1023px) {
    .nav-menu:not(.active) {
        left: -100% !important;
    }
    
    .nav-menu.active {
        left: 0 !important;
    }
    
    /* Ensure hamburger is always visible on mobile */
    .hamburger {
        display: flex !important;
        z-index: 1001 !important;
    }
}

/* Remove any JavaScript conflicts */
.no-js .hamburger {
    display: none !important;
}

/* Ensure only one hamburger menu exists */
.hamburger + .hamburger,
.menu-toggle + .hamburger,
.mobile-menu-toggle + .hamburger {
    display: none !important;
}
