/* ============================================
   HEADER MOBILE FIXES - PERFECT DESIGN
   Optimized mobile header with perfect navigation
   ============================================ */

@media (max-width: 768px) {
    /* Top Bar - Compact and visible */
    .top-bar {
        display: block !important;
        padding: 0.5rem 0;
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        border-bottom: 1px solid rgba(242, 140, 40, 0.2);
    }
    
    .top-bar-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .top-bar-left {
        display: flex;
        gap: 0.75rem;
        align-items: center;
        flex: 1;
        min-width: 0;
    }
    
    .top-bar-link {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        font-size: 0.75rem;
        transition: all 0.3s ease;
        white-space: nowrap;
        padding: 0.375rem 0.5rem;
        border-radius: 6px;
        background: rgba(242, 140, 40, 0.1);
        min-height: 32px;
    }
    
    .top-bar-link i {
        font-size: 0.875rem;
        color: #F28C28;
        flex-shrink: 0;
    }
    
    .top-bar-link span {
        display: inline;
        font-size: 0.6875rem;
        font-weight: 500;
    }
    
    .top-bar-link:hover,
    .top-bar-link:active {
        color: #F28C28;
        background: rgba(242, 140, 40, 0.2);
        transform: translateY(-1px);
    }
    
    .top-bar-right {
        display: none; /* Hide on mobile */
    }
    
    /* Main Header - PERFECT MOBILE DESIGN */
    .main-header {
        padding: 0.75rem 0;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: #ffffff;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-bottom: 1px solid rgba(242, 140, 40, 0.1);
    }
    
    .main-header.scrolled {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
        padding: 0.625rem 0;
    }
    
    .main-header[data-scroll-direction="down"] {
        transform: translateY(-100%);
    }
    
    .main-header[data-scroll-direction="up"] {
        transform: translateY(0);
    }
    
    /* Header Content - Perfect Layout */
    .header-content {
        padding: 0;
        gap: 0.75rem;
        align-items: center;
        justify-content: space-between;
        display: flex;
        width: 100%;
    }
    
    /* Logo - Perfect Size and Visibility */
    .header-logo {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        text-decoration: none;
        transition: transform 0.2s ease;
        min-width: 0;
        flex: 0 0 auto;
    }
    
    .header-logo:active {
        transform: scale(0.98);
    }
    
    .logo-box {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #F28C28, #FF7A00);
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(242, 140, 40, 0.3);
        color: white;
        position: relative;
        overflow: visible;
    }
    
    .logo-box::before {
        display: none; /* Disable animation on mobile for performance */
    }
    
    .logo-box::after {
        display: none; /* Disable animation on mobile for performance */
    }
    
    .main-header.scrolled .logo-box {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }
    
    .logo-text-box {
        display: flex;
        flex-direction: column;
        line-height: 1.2;
        min-width: 0;
    }
    
    .logo-main {
        font-size: 1.375rem;
        font-weight: 700;
        color: #1F2937;
        line-height: 1.1;
        font-family: 'Playfair Display', serif;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .main-header.scrolled .logo-main {
        font-size: 1.25rem;
    }
    
    .logo-sub {
        font-size: 0.75rem;
        color: #F28C28;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-top: 2px;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .main-header.scrolled .logo-sub {
        font-size: 0.6875rem;
    }
    
    /* Hide Desktop Navigation */
    .header-nav {
        display: none;
    }
    
    /* Header Right Section - Perfect Button Layout */
    .header-right {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        flex-shrink: 0;
        margin-left: auto;
    }
    
    /* Hide search box completely */
    .search-container,
    .search-toggle,
    .search-box {
        display: none !important;
    }
    
    /* Show theme toggle on mobile */
    .theme-toggle {
        display: flex !important; /* Show dark mode button */
        width: 44px;
        height: 44px;
        padding: 0;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        border: 2px solid #E5E7EB;
        background: transparent;
        color: #4B5563;
        transition: all 0.3s ease;
        cursor: pointer;
        font-size: 1rem;
    }
    
    .theme-toggle:hover,
    .theme-toggle:active {
        border-color: #F28C28;
        background: rgba(242, 140, 40, 0.1);
        color: #F28C28;
        transform: scale(0.95);
    }
    
    .main-header.scrolled .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 0.9375rem;
    }
    
    /* Hide other desktop buttons */
    .quick-actions-toggle,
    .notification-toggle,
    .language-toggle {
        display: none !important;
    }
    
    /* Contact Button - Visible before hamburger on mobile */
    .contact-button {
        display: flex !important; /* Show contact button on mobile */
        width: 44px;
        height: 44px;
        padding: 0;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        border: none;
        background: linear-gradient(135deg, #F28C28, #FF7A00);
        color: white;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(242, 140, 40, 0.3);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
        position: relative;
        overflow: hidden;
    }
    
    .contact-button::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.4s ease, height 0.4s ease;
    }
    
    .contact-button:active::before {
        width: 200%;
        height: 200%;
    }
    
    .contact-button:hover,
    .contact-button:focus {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(242, 140, 40, 0.4);
    }
    
    .contact-button:active {
        transform: scale(0.95);
    }
    
    .contact-button span {
        display: none; /* Hide text, show icon only */
    }
    
    .contact-button i {
        font-size: 1rem;
        margin: 0;
        position: relative;
        z-index: 1;
    }
    
    .main-header.scrolled .contact-button {
        width: 40px;
        height: 40px;
    }
    
    .main-header.scrolled .contact-button i {
        font-size: 0.9375rem;
    }
    
    /* Mobile Toggle Button - Perfect Hamburger */
    .mobile-toggle {
        width: 48px;
        height: 48px;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        background: transparent;
        border: 2px solid #F28C28;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
        position: relative;
    }
    
    .mobile-toggle:hover,
    .mobile-toggle:focus {
        background: rgba(242, 140, 40, 0.1);
        border-color: #F28C28;
    }
    
    .mobile-toggle.active {
        background: #F28C28;
        border-color: #F28C28;
    }
    
    .mobile-toggle .hamburger {
        width: 22px;
        height: 2.5px;
        background: #F28C28;
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: block;
        position: relative;
    }
    
    .mobile-toggle:hover .hamburger,
    .mobile-toggle.active .hamburger {
        background: white;
    }
    
    .mobile-toggle.active .hamburger:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }
    
    .mobile-toggle.active .hamburger:nth-child(2) {
        opacity: 0;
        transform: translateX(-10px);
    }
    
    .mobile-toggle.active .hamburger:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    .main-header.scrolled .mobile-toggle {
        width: 44px;
        height: 44px;
    }
    
    .main-header.scrolled .mobile-toggle .hamburger {
        width: 20px;
        height: 2px;
    }
    
    /* Mobile Sidebar - Perfect Navigation */
    .mobile-sidebar {
        width: 100%;
        max-width: 320px;
        right: -100%;
        background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .mobile-sidebar.active {
        right: 0;
    }
    
    .sidebar-header {
        padding: 1.5rem 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .sidebar-logo {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    
    .sidebar-logo-box {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        background: linear-gradient(135deg, #F28C28, #FF7A00);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        box-shadow: 0 4px 12px rgba(242, 140, 40, 0.3);
    }
    
    .sidebar-logo-main {
        font-size: 1.5rem;
        font-weight: 700;
        color: white;
        font-family: 'Playfair Display', serif;
    }
    
    .sidebar-logo-sub {
        font-size: 0.75rem;
        color: #F28C28;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .sidebar-close {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.1);
        border: 2px solid rgba(255, 255, 255, 0.2);
        color: white;
        transition: all 0.3s ease;
    }
    
    .sidebar-close:hover,
    .sidebar-close:active {
        background: rgba(255, 255, 255, 0.2);
        border-color: #F28C28;
        color: #F28C28;
        transform: rotate(90deg);
    }
    
    .sidebar-search {
        padding: 1rem 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .sidebar-search-form {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
    
    .sidebar-search-input {
        flex: 1;
        padding: 0.875rem 1rem;
        border-radius: 10px;
        border: 2px solid rgba(255, 255, 255, 0.1);
        background: rgba(255, 255, 255, 0.1);
        color: white;
        font-size: 0.9375rem;
        transition: all 0.3s ease;
    }
    
    .sidebar-search-input::placeholder {
        color: rgba(255, 255, 255, 0.5);
    }
    
    .sidebar-search-input:focus {
        outline: none;
        border-color: #F28C28;
        background: rgba(255, 255, 255, 0.15);
    }
    
    .sidebar-search-submit {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        background: linear-gradient(135deg, #F28C28, #FF7A00);
        border: none;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .sidebar-search-submit:hover,
    .sidebar-search-submit:active {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(242, 140, 40, 0.4);
    }
    
    .sidebar-nav {
        padding: 0.75rem 0;
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar-link {
        padding: 1.125rem 1.5rem;
        font-size: 0.9375rem;
        font-weight: 500;
        min-height: 56px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-left: 3px solid transparent;
        transition: all 0.3s ease;
        color: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        position: relative;
    }
    
    .sidebar-link::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 0;
        background: rgba(242, 140, 40, 0.1);
        transition: width 0.3s ease;
    }
    
    .sidebar-link:hover,
    .sidebar-link.active {
        background: rgba(242, 140, 40, 0.1);
        border-left-color: #F28C28;
        color: #F28C28;
        padding-left: 1.75rem;
    }
    
    .sidebar-link:hover::before,
    .sidebar-link.active::before {
        width: 100%;
    }
    
    .sidebar-link i {
        font-size: 0.875rem;
        opacity: 0.6;
        transition: all 0.3s ease;
    }
    
    .sidebar-link:hover i,
    .sidebar-link.active i {
        opacity: 1;
        transform: translateX(5px);
    }
    
    .sidebar-link span {
        position: relative;
        z-index: 1;
    }
    
    .sidebar-footer {
        padding: 1.25rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(0, 0, 0, 0.3);
    }
    
    .sidebar-cta {
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 12px;
        background: linear-gradient(135deg, #F28C28, #FF7A00);
        color: white;
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(242, 140, 40, 0.3);
    }
    
    .sidebar-cta:hover,
    .sidebar-cta:active {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(242, 140, 40, 0.4);
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .top-bar {
        padding: 0.375rem 0;
    }
    
    .top-bar-link {
        font-size: 0.6875rem;
        padding: 0.25rem 0.375rem;
    }
    
    .top-bar-link span {
        font-size: 0.625rem;
    }
    
    .main-header {
        padding: 0.625rem 0;
    }
    
    .header-content {
        gap: 0.5rem;
    }
    
    .logo-box {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }
    
    .logo-main {
        font-size: 1.25rem;
    }
    
    .logo-sub {
        font-size: 0.6875rem;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 0.9375rem;
    }
    
    .contact-button {
        width: 40px;
        height: 40px;
    }
    
    .contact-button i {
        font-size: 0.9375rem;
    }
    
    .mobile-toggle {
        width: 44px;
        height: 44px;
    }
    
    .mobile-toggle .hamburger {
        font-size: 1rem;
    }
    
    .mobile-toggle .hamburger {
        width: 20px;
    }
    
    .mobile-sidebar {
        max-width: 100%;
    }
    
    .sidebar-header {
        padding: 1.25rem 1rem;
    }
    
    .sidebar-link {
        padding: 1rem 1.25rem;
        font-size: 0.875rem;
        min-height: 52px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .top-bar-link span {
        display: none;
    }
    
    .top-bar-link {
        padding: 0.375rem;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        justify-content: center;
    }
    
    .logo-text-box {
        display: none; /* Hide text on very small screens, show icon only */
    }
    
    .header-logo {
        gap: 0;
    }
}

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

/* Smooth transitions */
.mobile-overlay {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Accessibility - Focus states */
@media (max-width: 768px) {
    .mobile-toggle:focus,
    .contact-button:focus,
    .sidebar-close:focus,
    .sidebar-link:focus,
    .sidebar-cta:focus {
        outline: 3px solid #F28C28;
        outline-offset: 2px;
    }
    
    /* Larger tap targets */
    .mobile-toggle,
    .contact-button,
    .sidebar-link,
    .sidebar-cta,
    .sidebar-close,
    .header-logo {
        min-height: 44px;
        min-width: 44px;
    }
}
