/* Universal Header - Adaptive Mobile Menu */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 24px;
    line-height: 1;
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, #0EA5E9, #06B6D4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-link {
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.3s;
    white-space: nowrap;
}

.nav-link:hover {
    color: #0EA5E9;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #0EA5E9;
    font-size: 14px;
    text-decoration: none;
    background: rgba(14,165,233,0.1);
    padding: 8px 12px;
    border-radius: 20px;
    transition: background 0.3s;
    white-space: nowrap;
}

.header-phone:hover {
    background: rgba(14,165,233,0.2);
}

/* Back button - hidden on homepage */
.header-back-btn {
    display: none;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #0EA5E9, #06B6D4);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: transform 0.3s, box-shadow 0.3s;
    white-space: nowrap;
}

.header-back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14,165,233,0.3);
}

/* Show back button only on non-home pages */
body:not(.home-page) .header-back-btn,
body:not([data-page="home"]) .header-back-btn {
    display: flex;
}

/* VISIBLE Mobile Menu Toggle Button */
.mobile-menu-toggle,
.mobile-menu-btn,
#mobileMenuBtn {
    display: none;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 10px !important;
    background: linear-gradient(135deg, #0EA5E9, #06B6D4) !important;
    border: none !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    box-shadow: 0 3px 10px rgba(14,165,233,0.4) !important;
    position: relative !important;
    z-index: 1002 !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
}

.mobile-menu-toggle span,
.mobile-menu-btn span,
#mobileMenuBtn span {
    display: block !important;
    width: 22px !important;
    height: 2.5px !important;
    background: white !important;
    border-radius: 2px !important;
    transition: 0.3s !important;
}

/* Mobile Overlay */
.mobile-overlay,
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    -webkit-tap-highlight-color: transparent;
}

.mobile-overlay.active,
.mobile-menu-overlay.active {
    display: block;
}

/* WHITE Mobile Menu - Adaptive */
.mobile-menu,
#mobileMenu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    height: -webkit-fill-available;
    height: fill-available;
    background: #ffffff !important;
    z-index: 1001;
    padding: 0;
    transition: right 0.3s ease;
    -webkit-transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: -5px 0 30px rgba(0,0,0,0.2);
}

.mobile-menu.active,
.mobile-menu.open,
#mobileMenu.active,
#mobileMenu.open {
    right: 0 !important;
}

/* Adaptive Menu Header */
.mobile-menu-header,
.mobile-menu .menu-header {
    padding: env(safe-area-inset-top, 20px) 20px 16px;
    padding-top: max(20px, env(safe-area-inset-top));
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    flex-shrink: 0;
}

.mobile-logo {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Close Button */
.mobile-menu-close,
.mobile-menu .close-btn {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 12px));
    right: 12px;
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    color: #1e293b;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-close:hover,
.mobile-menu .close-btn:hover {
    background: #e2e8f0;
}

/* Navigation Links */
.mobile-nav-links,
.mobile-nav,
.mobile-menu nav {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.mobile-nav-link,
.mobile-nav a,
.mobile-menu nav a,
.mobile-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: #1e293b !important;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-link:hover,
.mobile-nav a:hover,
.mobile-menu nav a:hover,
.mobile-menu a:hover {
    background: #f1f5f9;
    color: #0EA5E9 !important;
}

.mobile-nav-link:active,
.mobile-nav a:active,
.mobile-menu nav a:active {
    background: #e2e8f0;
}

.nav-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0EA5E9, #06B6D4);
    border-radius: 10px;
    flex-shrink: 0;
}

/* Footer with Contacts */
.mobile-menu-footer {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.mobile-contact-info {
    padding: 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.mobile-contact-info h4 {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.mobile-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: #1e293b;
    text-decoration: none;
    font-size: 15px;
    border-bottom: 1px solid #f1f5f9;
    word-break: break-word;
}

.mobile-contact-item:last-child {
    border-bottom: none;
}

.mobile-contact-item:hover {
    color: #0EA5E9;
}

/* Action Buttons */
.mobile-phone-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: linear-gradient(135deg, #0EA5E9, #06B6D4);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-phone-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14,165,233,0.3);
}

.mobile-phone-btn:active {
    transform: translateY(0);
}

.mobile-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: white;
    color: #475569;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 15px;
    border: 2px solid #e2e8f0;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-back-btn:hover {
    background: #f1f5f9;
    border-color: #0EA5E9;
    color: #0EA5E9;
}

/* Responsive */
@media (max-width: 1024px) {
    .header-nav {
        display: none;
    }
    
    .mobile-menu-toggle,
    .mobile-menu-btn,
    #mobileMenuBtn {
        display: flex !important;
    }
    
    .header-back-btn {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 8px 12px;
    }
    
    .logo-text {
        font-size: 16px;
    }
    
    .logo-icon {
        font-size: 22px;
    }
    
    .header-phone {
        padding: 8px;
    }
    
    .header-phone span {
        display: none;
    }
    
    .mobile-menu,
    #mobileMenu {
        width: 90%;
        max-width: none;
    }
}

@media (max-width: 380px) {
    .header-container {
        padding: 6px 10px;
    }
    
    .logo-text {
        font-size: 14px;
    }
    
    .mobile-menu-toggle,
    .mobile-menu-btn,
    #mobileMenuBtn {
        width: 40px !important;
        height: 40px !important;
    }
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    .mobile-menu-header {
        padding-top: max(20px, env(safe-area-inset-top));
    }
    
    .mobile-menu-close {
        top: max(12px, env(safe-area-inset-top));
    }
    
    .mobile-menu-footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* Page content margin for fixed header */
body {
    padding-top: 70px;
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }
}

/* Ensure menu button is always on top */
.mobile-menu-toggle,
.mobile-menu-btn {
    position: relative;
    z-index: 1002;
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}
