:root {
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-blur: blur(40px) saturate(180%);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] {
    --glass-bg: rgba(10, 10, 15, 0.75);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-blur: blur(50px) saturate(220%);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
}

.main-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 10000 !important;
    display: flex;
    justify-content: center;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), background 0.5s ease, backdrop-filter 0.5s ease;
    padding: 0;
    height: var(--nav-height, 80px);
    /* Fallback to 80px if variable missing */
    pointer-events: auto !important;
    will-change: transform;
}

.main-header.hidden {
    transform: translateY(0);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 0 var(--container-padding);
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.main-header.transparent .header-container {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
}

.main-header.transparent .logo-text,
.main-header.transparent .nav-menu a,
.main-header.transparent .lang-btn,
.main-header.transparent .mobile-toggle {
    color: white !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.main-header.scrolled .header-container {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--glass-shadow);
    border-bottom: 1px solid var(--glass-border);
}

.main-header.scrolled .logo-text,
.main-header.scrolled .nav-menu a,
.main-header.scrolled .mobile-toggle,
.main-header.scrolled .lang-btn {
    color: inherit;
}

.header-container:hover {
    background: rgba(255, 255, 255, 0.05);
}

.main-header.scrolled .header-container:hover {
    background: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .main-header.scrolled .header-container:hover {
    background: rgba(15, 15, 20, 0.9);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    padding-left: 8px;
    margin-right: 24px;
}

.logo img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.logo h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

/* Navigation */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    /* Tight spacing for capsule feel */
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    display: block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 999px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-menu a:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}

.nav-menu a.active {
    background: var(--text-primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2),
        inset 0 0 10px rgba(212, 175, 55, 0.1);
    position: relative;
    overflow: hidden;
}

/* Premium active indicator (Lens Flare) */
.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--color-gold);
    border-radius: 50%;
    box-shadow: 0 0 12px 2px var(--color-gold);
    animation: auraPulse 3s infinite ease-in-out;
}

@keyframes auraPulse {

    0%,
    100% {
        box-shadow: 0 0 12px 2px var(--color-gold);
        opacity: 0.8;
    }

    50% {
        box-shadow: 0 0 20px 4px var(--color-gold);
        opacity: 1;
    }
}

/* Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
    padding-right: 4px;
}

/* Profile Ribbon */
.profile-ribbon {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 12px 4px 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-ribbon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-gold);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--color-gold);
    object-fit: cover;
}

.profile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 200px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1002;
}

.profile-ribbon:hover .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.profile-dropdown a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.profile-dropdown a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-gold);
    padding-left: 20px;
}

.profile-dropdown .divider {
    height: 1px;
    background: var(--glass-border);
    margin: 8px;
}

.profile-dropdown .logout-btn {
    color: #ff453a;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    height: 36px;
    border-radius: 999px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--gray-200);
    transform: rotate(15deg);
}

.theme-toggle i {
    font-size: 16px;
}

[data-theme="dark"] .theme-toggle i.fa-moon {
    display: none;
}

[data-theme="light"] .theme-toggle i.fa-sun {
    display: none;
}

/* Mobile Responsive */
.mobile-toggle,
.mobile-bottom-nav,
.mobile-action-panel {
    display: none !important;
}

/* Premium Expandable Search Bar */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
}

.search-trigger {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.search-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
    color: var(--color-gold);
}

.search-input-wrapper {
    position: absolute;
    right: 0;
    width: 0;
    height: 36px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    display: flex;
    align-items: center;
    padding-right: 40px;
}

.header-search.active .search-input-wrapper {
    width: 280px;
    padding-left: 16px;
    opacity: 1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: var(--color-gold);
}

.search-input-wrapper input {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    padding: 0;
}

.search-input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

[data-theme="light"] .search-input-wrapper input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

/* Language Selector */
.language-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 10px;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1001;
}

.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.lang-dropdown a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s;
}

.lang-dropdown a:hover {
    background: var(--gray-100);
    transform: translateX(4px);
}

[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .lang-dropdown a:hover {
    transform: translateX(-4px);
}

/* ============================================
   DESKTOP RESPONSIVE - Medium Screens (993px - 1200px)
   ============================================ */
@media (max-width: 1200px) and (min-width: 993px) {
    .header-container {
        padding: 0 20px;
    }

    .logo {
        margin-right: 15px;
    }

    .logo-text {
        font-size: 14px;
    }

    .nav-menu {
        gap: 0px;
    }

    .nav-menu a {
        padding: 6px 10px;
        font-size: 13px;
    }

    .nav-actions {
        gap: 8px;
        margin-left: 8px;
    }

    .auth-btn-lux {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
}

/* ============================================
   MOBILE RESPONSIVE - PREMIUM DYNAMIC ISLAND
   ============================================ */

@media (max-width: 1024px) {
    .header-container {
        padding: 0 16px;
    }

    .main-header {
        height: 64px;
        background: rgba(10, 10, 15, 0.85) !important;
        backdrop-filter: blur(40px) saturate(210%) !important;
        -webkit-backdrop-filter: blur(40px) saturate(210%) !important;
        padding: 0 15px;
    }

    body {
        padding-top: 64px;
        padding-bottom: 110px;
    }

    .nav-menu {
        display: none !important;
    }

    .logo img {
        height: 34px !important;
        width: 34px !important;
    }

    .logo-text {
        font-size: 15px !important;
        font-weight: 700 !important;
    }

    .nav-actions .btn-primary,
    .nav-actions .header-search,
    .nav-actions .theme-toggle,
    .nav-actions .language-selector {
        display: none !important;
    }

    .mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 42px !important;
        height: 42px !important;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #fff !important;
        font-size: 18px !important;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 1001;
    }

    .mobile-toggle:active {
        transform: scale(0.9);
        background: rgba(255, 255, 255, 0.15);
    }

    /* Mobile Menu Style (when active) */
    .header-container.mobile-active {
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 24px;
        border-radius: 0 !important;
        background: rgba(15, 15, 20, 0.98) !important;
        backdrop-filter: blur(40px) saturate(200%) !important;
        box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
        z-index: 20000;
        animation: premiumSlideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes premiumSlideDown {
        from { opacity: 0; transform: translateY(-20px) scale(0.98); }
        to { opacity: 1; transform: translateY(0) scale(1); }
    }

    .header-container.mobile-active .mobile-toggle {
        position: absolute;
        top: 20px;
        right: 20px;
        z-index: 20001;
        display: flex !important;
    }

    .header-container.mobile-active .nav-menu,
    .header-container.mobile-active .language-selector,
    .header-container.mobile-active #headerSearch {
        display: none !important;
    }

    .nav-actions {
        display: none !important;
    }

    /* Bottom Nav & Panel Styles */
    .currency-selector {
        display: flex !important;
        background: rgba(255, 255, 255, 0.05);
        padding: 6px 12px;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .currency-current {
        font-size: 13px !important;
        font-weight: 600 !important;
    }

    /* Apple-Style Ground Glass Bottom Navigation */
    .mobile-bottom-nav {
        display: flex !important;
        flex-direction: row !important;
        position: fixed !important;
        bottom: 25px !important;
        left: 20px !important;
        right: 20px !important;
        height: 76px !important;
        background: rgba(15, 15, 20, 0.45) !important;
        backdrop-filter: blur(45px) saturate(210%) !important;
        -webkit-backdrop-filter: blur(45px) saturate(210%) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 30px !important;
        justify-content: space-around !important;
        align-items: center !important;
        z-index: 10001 !important;
        padding: 0 8px !important;
        box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
        transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: rgba(255, 255, 255, 0.45);
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        flex: 1;
        height: 100%;
        position: relative;
        z-index: 2;
    }

    .bottom-nav-item.active {
        color: var(--color-gold);
        transform: translateY(-2px);
    }

    .bottom-nav-item i {
        font-size: 22px;
        margin-bottom: 2px;
    }

    /* Independent Mobile Action Panel */
    .mobile-action-panel {
        position: fixed;
        inset: 0;
        z-index: 25000; /* Above everything */
        visibility: hidden;
        pointer-events: none;
        display: flex !important;
        align-items: flex-end;
        justify-content: center;
        transition: visibility 0.4s;
    }

    .mobile-action-panel.active {
        visibility: visible;
        pointer-events: auto;
    }

    .panel-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        opacity: 0;
        transition: opacity 0.5s ease;
    }

    .mobile-action-panel.active .panel-overlay {
        opacity: 1;
    }

    .panel-sheet {
        position: relative;
        width: 100%;
        max-width: 500px;
        background: rgba(20, 20, 25, 0.7);
        backdrop-filter: blur(40px) saturate(200%);
        -webkit-backdrop-filter: blur(40px) saturate(200%);
        border-radius: 40px 40px 0 0;
        border: 1px solid rgba(255, 255, 255, 0.15);
        padding: 20px 25px 50px;
        transform: translateY(100%);
        transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
    }

    .mobile-action-panel.active .panel-sheet {
        transform: translateY(0);
    }

    .panel-section {
        display: none;
    }

    .panel-section.active {
        display: block;
    }

    .panel-title {
        font-size: 1.5rem;
        font-weight: 800;
        color: white;
        margin-bottom: 25px;
    }

    .panel-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .panel-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        background: rgba(255, 255, 255, 0.05);
        padding: 20px 10px;
        border-radius: 20px;
        text-decoration: none;
        color: rgba(255, 255, 255, 0.7);
        font-weight: 600;
        transition: all 0.3s;
    }

    .panel-item:active {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(0.95);
    }

    .lang-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .lang-option {
        width: 100%;
        padding: 18px 25px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 18px;
        color: white;
        font-weight: 600;
        text-align: left;
        cursor: pointer;
    }

    .float-wa, .kinani-contact-bar, .chatbot-launcher {
        display: none !important;
    }
}