/* ==========================================================================
   Modern Header Theme - 2024 Redesign
   Blue & White Glassmorphism Edition
   ========================================================================== */

/* --- Variables & Reset --- */
:root {
    --header-height: 80px; /* Increased from 72px (~11% taller, visually better than 25% which might be too bulky, but let's try 80px first) */
    --primary-blue: #006eff;
    --primary-hover: #0056cc;
    --secondary-blue: #f0f7ff;
    --text-main: #1d2129;
    --text-sub: #4e5969;
    --text-light: #86909c;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.8);
    /* Keep the global header on a stable compositing path while scrolling. */
    --glass-blur: none;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --radius-md: 8px;
    --radius-lg: 12px;
    --max-width: 1400px;
}

/* Hide Old Header Elements */
.idcos-nav .header,
.idcos-nav .header-wrapper,
.idcos-nav .header-nav {
    display: none !important;
}

/* --- Main Header Container --- */
.idcos-nav {
    width: 100%;
    height: var(--header-height);
    position: relative;
    top: 0;
    left: 0;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: var(--glass-border);
    box-shadow: var(--shadow-sm);
    pointer-events: auto;
}

/* Keep SweetAlert2 Toasts above the navigation surface. */
.swal2-container {
    z-index: 100000 !important;
}

.header-container-modern {
    max-width: var(--max-width);
    height: 100%;
    margin: 0 auto;
    /*padding: 0 24px; !* Added padding back to prevent touching edges *!*/
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    flex-wrap: nowrap; /* Force single line */
}

/* --- Logo --- */
.header-logo .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 12px;
    white-space: nowrap; /* Prevent stacking */
}

.header-logo img {
    max-height: calc(var(--header-height) - 24px);
    width: auto;
    object-fit: contain;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.header-logo .site-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: -0.5px;
}

/* --- Menu --- */
.header-menu {
    flex: 1;
    height: 100%;
    margin: 0 40px;
    display: flex; /* Add flex to control width */
    /* overflow: hidden; Removed to allow dropdowns to show */
}

.menu-list {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 8px;
    flex-wrap: nowrap; /* Ensure items don't wrap */
}

.menu-item {
    height: 100%;
    display: flex;
    align-items: center;
    position: relative; /* Changed from static to relative for simple dropdowns */
}

/* Mega Menu Item - Needs static positioning for full width */
.menu-item.has-dropdown,
.menu-item.has-mega-dropdown {
    position: static;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 40px;
    border-radius: 20px;
    font-size: 15px;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 6px;
    white-space: nowrap; /* Prevent vertical stacking */
    position: relative;
}

.menu-link i {
    font-size: 12px;
    transition: transform 0.3s;
    opacity: 0.6;
}

.menu-link > i:not(.fa-angle-down):not(.nav-flag) {
    margin-right: 2px;
    font-size: 18px;
    opacity: 0.82;
}

.menu-link > i.nav-flag {
    flex-basis: 22px;
    width: 22px;
    height: 16px;
    margin-right: 2px;
    opacity: 1;
}

.menu-item:hover .menu-link {
    color: var(--primary-blue);
    background: var(--secondary-blue);
}

.menu-item.active-nav > .menu-link {
    color: var(--primary-blue);
    background: var(--secondary-blue);
    font-weight: 700;
}

.menu-item:hover .menu-link > .fa-angle-down,
.menu-item:focus-within .menu-link > .fa-angle-down {
    transform: rotate(180deg);
    opacity: 1;
}

/* --- Mega Menu --- */
.mega-menu {
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 1001;
    border: 1px solid #e9edf3;
    border-top: none;
    padding: 0;
    overflow: hidden;
    pointer-events: none;
}

.menu-item:hover .mega-menu,
.menu-item:focus-within .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Server navigation keeps the previous region/category layout, with less empty space. */
.mega-content {
    display: flex;
    height: min(360px, calc(100vh - var(--header-height) - 24px));
    min-height: 320px;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Column 1: Featured (Left) - 20% */
.mega-col-left {
    width: 20%;
    background: #f8f9fa; /* Light gray background */
    padding: 40px 30px; /* Adjusted padding */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #f0f0f0;
    position: relative;
}

.mega-featured-title {
    font-size: 20px; /* Matched image visual weight */
    font-weight: 800;
    color: #000;
    margin-bottom: 12px;
    line-height: 1.2;
}

.mega-featured-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.mega-link-btn {
    display: inline-block;
    color: var(--primary-blue);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-top: auto; /* Push to bottom if needed, but image is there */
    margin-bottom: 10px;
    position: absolute;
    bottom: 30px;
    left: 30px;
    z-index: 2;
}
.mega-link-btn:hover {
    text-decoration: underline;
}

.mega-featured-img {
    width: 80%;
    align-self: center;
    margin-top: auto;
    max-height: 180px;
    object-fit: contain;
    mix-blend-mode: multiply;
    margin-bottom: 20px; /* Space for link */
}

/* Column 2: Area List (Middle) - 25% */
.mega-col-middle {
    flex: 0 0 clamp(390px, 31%, 440px);
    width: clamp(390px, 31%, 440px);
    border-right: 1px solid #e9edf3;
    display: flex;
    flex-direction: column;
    padding: 22px 24px;
    background: #fafbfd;
    box-sizing: border-box;
}

.mega-col-title {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mega-col-title i {
    color: var(--primary-blue);
    font-size: 14px;
}

.area-scroll-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 44px;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}

.area-item {
    display: flex;
    align-items: center;
    min-width: 0;
    width: 100%;
    height: 44px;
    padding: 0 11px;
    font: inherit;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid transparent;
    background: transparent;
    box-sizing: border-box;
}

.area-item:hover, .area-item.active {
    border-color: #dbeafe;
    box-shadow: 0 4px 12px rgba(0, 110, 255, 0.06);
    color: var(--primary-blue);
    background: #fff;
}
/* Active state dot or highlight */
.area-item.active .area-name {
    font-weight: 600;
}

.area-icon {
    width: 22px;
    height: 18px;
    margin-right: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    flex-shrink: 0;
}

.area-icon img,
.area-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.area-icon i.nav-flag {
    width: 22px;
    height: 16px;
}

.area-name {
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.area-arrow {
    margin-left: auto;
    font-size: 12px;
    color: var(--primary-blue);
    opacity: 0;
    transform: translateX(-3px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.area-item:hover .area-arrow,
.area-item.active .area-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Column 3: Category List (Right) - 55% */
.mega-col-right {
    flex: 1;
    min-width: 0;
    padding: 22px 28px;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.category-scroll-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding-right: 4px;
    container-type: inline-size;
}

/* Custom Scrollbar */
.category-scroll-container::-webkit-scrollbar,
.area-scroll-list::-webkit-scrollbar {
    width: 4px;
}
.category-scroll-container::-webkit-scrollbar-thumb,
.area-scroll-list::-webkit-scrollbar-thumb {
    background: #e5e6eb;
    border-radius: 2px;
}

.category-group {
    display: none;
    gap: clamp(10px, 2cqi, 18px);
    align-content: flex-start;
    justify-content: start;
}

.category-group.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.category-group.active:has(> .category-card:nth-child(4)) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    justify-content: stretch;
}

.category-card {
    flex: 0 0 auto;
    width: max-content;
    min-width: 180px;
    max-width: 240px;
    min-height: 58px;
    border: 1px solid #edf0f5;
    border-radius: 7px;
    padding: 10px 6px;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s;
    background: #fff;
    box-sizing: border-box;
}

.category-group.active:has(> .category-card:nth-child(4)) > .category-card {
    width: 100%;
    min-width: 0;
    max-width: 240px;
    justify-self: center;
}

.category-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 6px 16px rgba(0, 110, 255, 0.08);
    background: #f8fbff;
}

.cat-icon-lg {
    width: 34px;
    height: 34px;
    margin-right: 6px;
    flex-shrink: 0;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-blue);
    background: #f1f6ff;
    overflow: hidden;
}

.cat-icon-lg img,
.cat-icon-lg svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cat-icon-lg i.nav-flag {
    width: 24px;
    height: 18px;
}

.cat-icon-lg > i:not(.nav-flag) {
    font-size: 16px;
}

.cat-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.cat-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-card:hover .cat-name {
    color: var(--primary-blue);
}

.category-card.is-current {
    border-color: #bfdbfe;
    background: #f3f8ff;
}

.category-card.is-current .cat-name {
    color: var(--primary-blue);
}

.category-card.is-static {
    cursor: default;
}

.category-arrow {
    display: none;
}

/* --- Simple Dropdown --- */
.simple-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1001;
    border: 1px solid #f0f0f0;
    width: 200px;
    padding: 8px;
    display: flex;
    flex-direction: column;
}

/* Fix: Ensure hover on menu-item triggers simple-dropdown visibility */
.menu-item:hover .simple-dropdown,
.menu-item:focus-within .simple-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.drop-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s;
}

.drop-link i {
    margin-right: 10px;
    font-size: 16px;
    color: var(--text-light);
}

.drop-link:hover {
    background: var(--secondary-blue);
    color: var(--primary-blue);
}
.drop-link:hover i {
    color: var(--primary-blue);
}

/* Database-backed simple navigation. */
.nav-tree-dropdown {
    width: 220px;
    max-height: min(420px, calc(100vh - var(--header-height) - 24px));
    overflow-y: auto;
}

.nav-tree-dropdown::-webkit-scrollbar {
    width: 5px;
}

.nav-tree-dropdown::-webkit-scrollbar-thumb {
    background: #d9dde4;
    border-radius: 3px;
}

/* --- User Actions & Search --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px; /* Added gap between search and buttons */
    flex-shrink: 0; /* Prevent actions from being squished */
}

/* Search Bar Styles */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 10px; /* Add some space before buttons */
}

.search-input {
    width: 150px; /* Base width */
    height: 36px;
    border-radius: 18px; /* Pill shape */
    border: 1px solid #e5e6eb; /* Neutral border */
    background: #f4f5f7; /* Light gray background like idcos */
    padding: 0 36px 0 16px;
    font-size: 14px;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-sizing: border-box;
}

.search-input::placeholder {
    color: #9aa0a6; /* Visible placeholder */
    transition: color 0.3s;
}

/* Expanded/Focus State */
.search-input:focus,
.search-input:not(:placeholder-shown) {
    width: 200px; /* Slightly expand on focus */
    background: #fff;
    border: 1px solid var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 110, 255, 0.15); /* Brand focus ring */
}

.search-input:focus::placeholder {
    color: #9aa0a6; /* Show placeholder when expanded */
}

/* Search suggestions */
.header-search-suggestions {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    display: none;
    width: 360px;
    max-height: min(460px, calc(100vh - 96px));
    max-height: min(460px, calc(100dvh - 96px));
    overflow: hidden;
    background: #fff;
    border: 1px solid #e8edf5;
    border-radius: 8px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
    z-index: 1300;
    box-sizing: border-box;
}

.header-search-suggestions::before {
    position: absolute;
    top: -6px;
    right: 25px;
    width: 10px;
    height: 10px;
    content: '';
    background: #fff;
    border-top: 1px solid #e8edf5;
    border-left: 1px solid #e8edf5;
    transform: rotate(45deg);
}

.header-search-suggestions.is-visible {
    display: flex;
    flex-direction: column;
}

.header-search-suggestions__scroll {
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    flex: 1 1 auto;
    box-sizing: border-box;
}

.header-search-suggestions.is-loading {
    min-height: 76px;
}

.header-search-suggestions.is-loading::after {
    position: absolute;
    top: 30px;
    left: calc(50% - 10px);
    width: 20px;
    height: 20px;
    content: '';
    border: 2px solid #dbeafe;
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: header-search-spin 0.7s linear infinite;
}

.header-search-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 9px 10px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 6px;
    box-sizing: border-box;
}

.header-search-suggestion:hover {
    background: #f5f8fd;
}

.header-search-suggestion__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #3b82f6;
    background: #eff6ff;
    border-radius: 6px;
    flex: 0 0 auto;
}

.header-search-suggestion__icon.product {
    color: #7c3aed;
    background: #f3f0ff;
}

.header-search-suggestion__icon.help {
    color: #059669;
    background: #ecfdf5;
}

.header-search-suggestion__main {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.header-search-suggestion__headline {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
}

.header-search-suggestion__type {
    padding: 1px 5px;
    color: #2563eb;
    background: #eff6ff;
    border-radius: 3px;
    font-size: 11px;
    font-style: normal;
    line-height: 18px;
    white-space: nowrap;
}

.header-search-suggestion__type.product {
    color: #6d28d9;
    background: #f3f0ff;
}

.header-search-suggestion__type.help {
    color: #047857;
    background: #ecfdf5;
}

.header-search-suggestion__title,
.header-search-suggestion__meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-search-suggestion__title {
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
}

.header-search-suggestion__meta {
    color: #94a3b8;
    font-size: 12px;
}

.header-search-suggestion__tags {
    display: flex;
    gap: 5px;
    overflow: hidden;
}

.header-search-suggestion__tags em {
    max-width: 120px;
    overflow: hidden;
    padding: 1px 5px;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 3px;
    font-size: 11px;
    font-style: normal;
    line-height: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-search-suggestion__arrow {
    color: #cbd5e1;
    font-size: 13px;
    flex: 0 0 auto;
}

.header-search-suggestion__empty {
    padding: 20px 12px;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}

.header-search-suggestion__status {
    min-height: 44px;
    overflow-anchor: none;
    box-sizing: border-box;
}

.header-search-suggestion__loading-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    color: #64748b;
    font-size: 12px;
}

.header-search-suggestion__spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #dbeafe;
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: header-search-spin 0.7s linear infinite;
    box-sizing: border-box;
}

.header-search-suggestion__retry {
    width: 100%;
    padding: 10px 12px;
    color: var(--primary-blue);
    background: #f8fafc;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.header-search-suggestion__retry:hover,
.header-search-suggestion__retry:focus-visible {
    background: #eff6ff;
    outline: 2px solid rgba(0, 110, 255, 0.22);
    outline-offset: -2px;
}

.header-search-suggestion__all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 8px;
    padding: 10px;
    color: var(--primary-blue);
    background: #fff;
    border-top: 1px solid #eef2f7;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    overflow-anchor: none;
    flex: 0 0 auto;
}

@keyframes header-search-spin {
    to { transform: rotate(360deg); }
}

.search-icon {
    position: absolute;
    right: 10px;
    color: #9aa0a6;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 2;
    padding: 5px;
}

.search-input:focus + .search-icon,
.search-input:not(:placeholder-shown) + .search-icon {
    color: var(--primary-blue);
}

/* --- Article share toast --- */
.modern-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    padding: 16px 24px 16px 20px;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    min-width: 280px;
}

.modern-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.toast-accent {
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 4px;
    background: #ef4444; /* Red accent */
    border-radius: 0 4px 4px 0;
}

.toast-icon {
    color: #ef4444;
    font-size: 24px;
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.toast-msg {
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
}

@media (max-width: 768px) {
    .modern-toast {
        top: 20px;
        left: 20px;
        right: 20px;
        min-width: auto;
    }
}

.user-guest, .user-logged {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-link {
    color: var(--text-sub);
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    transition: color 0.2s;
    white-space: nowrap; /* Prevent vertical stacking */
}
.login-link:hover {
    color: var(--primary-blue);
}

.register-btn {
    width: auto !important;
    min-width: 100px;
    padding: 0 20px !important;
    white-space: nowrap;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    height: 38px !important;
    border-radius: 19px !important;
    background: linear-gradient(135deg, #006eff 0%, #0056cc 100%);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 110, 255, 0.2);
    transition: all 0.3s;
}

.register-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 110, 255, 0.3);
}

.register-btn i {
    font-size: 16px;
    margin-right: 6px;
    color: #fff;
    animation: gift-bounce 2s infinite;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap; /* Prevent vertical stacking */
}
.user-btn i {
    font-size: 18px;
    color: var(--text-light);
}

.console-btn {
    margin-left: 12px;
    padding: 6px 16px;
    border: 1px solid #e5e6eb;
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s;
}
.console-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

@keyframes gift-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive */
@media (max-width: 1200px) {
    /* --- Global Overrides for Mobile to fix old fixed-width constraints --- */
    body, html {
        min-width: 0 !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    .container, .auto, .header-container, .footer-container, .common-layout {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
    }

    .index-banner, .zonkvm-buy-banner, .middle-tab-content-type1, .header-activity {
        min-width: 0 !important;
        padding-top: 0 !important; /* Remove huge padding from inner banners on mobile */
    }

    /* --- Header logic --- */
    .header-container-modern {
        display: none !important;
    }
    .idcos-nav {
        display: none !important; /* Fully hide PC header on mobile */
    }
    
    /* Force hide any old empty header wrappers that might take up space */
    .header, .header-v2, .top-header, .header-top, .zonkvm-buy-banner .header-info, .header-banner .container, .index-header .top-header {
        display: none !important;
    }
    
    /* Show mobile header */
    .mobile-header-modern {
        display: block;
    }
    
    .mobile-topbar {
        height: 80px;
        padding: 0 20px;
    }
    
    .mobile-logo img {
        height: 42px;
    }
    
    .mobile-drawer {
        top: 80px;
        height: calc(100vh - 80px);
    }
    
    .mobile-drawer-overlay {
        top: 80px;
        height: calc(100vh - 80px);
    }
}

/* Make sure any padding applied to page wrappers in old layout is completely removed */
.page-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.zonkvn-top {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

#app {
    margin-top: 0 !important;
}

body {
    padding-top: 0 !important; /* Force remove any body padding left over */
}

/* Force Hide Old Header Elements in common/header.html */
.header, .header-wrapper, .header-nav {
    display: none !important;
}

/* Ensure new header is visible and positioned correctly */
.idcos-nav {
    display: block !important;
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
}

body {
    /* padding-top: 80px; Removed for relative positioning */
}

/* --- Modern Side Consult Bar --- */
.consult-modern {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.consult-modern.collapsed {
    transform: translate(calc(100% + 20px), -50%);
}

.consult-modern-toggle {
    position: absolute;
    left: -28px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: -4px 0 15px rgba(0,0,0,0.05);
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-right: none;
    color: #666;
    transition: all 0.3s;
    z-index: 1000;
    padding: 0;
    font: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.consult-modern-toggle:focus-visible,
.consult-modern-trigger:focus-visible,
.consult-modern-backtop:focus-visible,
.consult-modern-item:focus-visible {
    outline: 3px solid rgba(0, 110, 255, 0.32);
    outline-offset: 3px;
}

/* Do not let the collapse handle steal the pointer while a contact panel is opening. */
.consult-modern:has(.consult-modern-item:hover) .consult-modern-toggle {
    opacity: 0;
    pointer-events: none;
}

.consult-modern-toggle:hover {
    color: var(--primary-blue, #006eff);
    background: #fff;
}

.consult-modern-toggle i {
    font-size: 14px;
    transition: transform 0.4s ease;
}

.consult-modern.collapsed .consult-modern-toggle i {
    transform: rotate(180deg);
}

.consult-pulse-dot {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 6px;
    height: 6px;
    background: #52c41a;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s;
}

.consult-pulse-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1px solid rgba(82, 196, 26, 0.4);
    animation: pulse-green 2s infinite;
}

.consult-modern.collapsed .consult-pulse-dot {
    opacity: 1;
}

.consult-modern-bar {
    order: 1;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 10px 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.consult-modern-item {
    position: relative;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-sub, #666);
}

button.consult-modern-item {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
}

.consult-modern-item:hover {
    color: var(--primary-blue, #006eff);
}

.consult-modern-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f4f7fc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    transition: all 0.3s ease;
    position: relative;
}

.status-pulse-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: #52c41a;
    border-radius: 50%;
    border: 2px solid #fff;
}

.status-pulse-dot::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 1px solid rgba(82, 196, 26, 0.6);
    animation: pulse-green 2s infinite;
}

.consult-modern-item:hover .consult-modern-icon-wrap {
    background: var(--primary-blue, #006eff);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 110, 255, 0.3);
}

.consult-modern-icon-wrap i {
    font-size: 18px;
}

.consult-modern-name {
    font-size: 12px;
    font-weight: 500;
}

.consult-modern-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
    margin: 4px 16px;
}

/* Hover Bubble */
.consult-modern-bubble {
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%) translateX(20px);
    width: 240px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.consult-modern-item:hover .consult-modern-bubble,
.consult-modern-item:focus-within .consult-modern-bubble,
.consult-modern-item.is-active .consult-modern-bubble,
.consult-modern-bubble:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

/* Little arrow pointing right */
.consult-modern-bubble::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: #fff;
    box-shadow: 4px -4px 4px rgba(0,0,0,0.02);
    border-radius: 2px;
}

/* Invisible bridge to prevent hover loss */
.consult-modern-bubble::before {
    content: '';
    position: absolute;
    right: -28px;
    top: 0;
    width: 28px;
    height: 100%;
    background: transparent;
}

.bubble-modern-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #f8faff 0%, #eef3ff 100%);
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.bubble-modern-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background: #fff;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.bubble-modern-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

.bubble-modern-info p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.bubble-modern-body {
    padding: 8px 16px;
}

.staff-modern-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.05);
}

.staff-modern-row:last-child {
    border-bottom: none;
}

.staff-modern-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.staff-modern-name::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #52c41a; /* Green dot for online status */
    border-radius: 50%;
    display: inline-block;
}

.staff-modern-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(0, 110, 255, 0.08);
    color: var(--primary-blue, #006eff);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.staff-modern-action:hover {
    background: var(--primary-blue, #006eff);
    color: #fff;
}

/* Keep long support rosters compact without widening single-person groups. */
.consult-modern-bubble:has(.staff-modern-row:nth-child(2)) {
    width: min(420px, calc(100vw - 96px));
}

.consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .bubble-modern-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
    max-height: min(440px, calc(100vh - 160px));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 16px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 110, 255, 0.24) transparent;
}

.consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .staff-modern-row {
    min-width: 0;
    padding: 10px 0;
}

.consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .staff-modern-row:nth-last-child(-n + 2) {
    border-bottom: none;
}

.consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .staff-modern-name {
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .staff-modern-name svg {
    flex: 0 0 auto;
}

.consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .staff-modern-action {
    flex: 0 0 auto;
    gap: 3px;
    line-height: 1.2;
    margin-left: 8px;
    padding: 6px 9px;
    white-space: nowrap;
}

.consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .staff-modern-action .iconfont {
    line-height: 1;
}

@media (max-width: 420px) {
    .consult-modern-bubble:has(.staff-modern-row:nth-child(2)) {
        width: min(280px, calc(100vw - 88px));
    }

    .consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .bubble-modern-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .staff-modern-row:nth-last-child(-n + 2) {
        border-bottom: 1px dashed rgba(0,0,0,0.05);
    }

    .consult-modern-bubble:has(.staff-modern-row:nth-child(2)) .staff-modern-row:last-child {
        border-bottom: none;
    }
}

.consult-modern-trigger {
    display: none; /* Mobile only */
}

.consult-modern-backtop {
    order: 2;
    display: flex;
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--primary-blue, #006eff);
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    z-index: 998;
    font: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.consult-modern-backtop:hover {
    background: #f7faff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
    transform: translateY(-2px);
}

.consult-modern-backtop i {
    font-size: 24px;
}

.consult-modern-bar > .consult-modern-divider:last-of-type {
    display: none;
}

@media (max-width: 1024px) {
    .consult-modern {
        top: auto;
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        right: calc(20px + env(safe-area-inset-right, 0px));
        transform: none;
        gap: 8px;
        align-items: flex-end;
    }
    
    .consult-modern.collapsed {
        transform: none; /* Mobile doesn't use the collapse logic this way */
    }

    .consult-modern-toggle {
        display: none !important;
    }
    
    .consult-modern-bar {
        display: block;
        position: absolute;
        bottom: calc(100% + 12px);
        right: 0;
        width: 60px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(8px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    }

    .consult-modern-bar.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .consult-modern-bar > .consult-modern-divider:last-of-type {
        display: none;
    }
    
    .consult-modern-bubble {
        right: 100%;
        transform: translateY(-50%) translateX(0);
        margin-right: 10px;
    }

    .consult-modern .consult-modern-bubble,
    .consult-modern .consult-modern-bubble:has(.staff-modern-row:nth-child(2)) {
        width: min(280px, calc(100vw - 104px));
        max-height: calc(100dvh - 48px);
        overflow-y: auto;
    }

    .consult-modern-item:hover .consult-modern-bubble,
    .consult-modern-item:focus-within .consult-modern-bubble,
    .consult-modern-item.is-active .consult-modern-bubble {
        transform: translateY(-50%) translateX(0);
    }
    
    .consult-modern-trigger,
    .consult-modern-backtop {
        display: flex;
        width: 48px;
        height: 48px;
        flex: 0 0 48px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 998;
        font: inherit;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    }

    .consult-modern-trigger {
        background: var(--primary-blue, #006eff);
        color: #fff;
        box-shadow: 0 4px 15px rgba(0, 110, 255, 0.4);
    }

    .consult-modern-trigger[aria-expanded="true"] {
        background: #0057cc;
        box-shadow: 0 2px 10px rgba(0, 87, 204, 0.35);
    }

    .consult-modern-backtop {
        order: 2;
        background: #fff;
        color: var(--primary-blue, #006eff);
        border: 1px solid rgba(0, 110, 255, 0.18);
        box-shadow: 0 4px 15px rgba(15, 23, 42, 0.16);
    }

    .consult-modern-trigger i,
    .consult-modern-backtop i {
        font-size: 24px;
    }

    .consult-modern-backtop i {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .consult-modern,
    .consult-modern-bar,
    .consult-modern-toggle,
    .consult-modern-trigger,
    .consult-modern-backtop,
    .consult-modern-bubble,
    .consult-modern-icon-wrap {
        transition: none !important;
    }

    .consult-pulse-dot::after,
    .status-pulse-dot::after {
        animation: none !important;
    }
}

/* ==========================================================================
   Modern Mobile Header Styles
   ========================================================================== */
.mobile-header-modern {
    display: none;
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
}

@media (max-width: 1200px) {
    body {
        padding-top: 0 !important;
    }

    /* Force reset any hardcoded padding/margin from older CSS that creates blank gaps */
    .idcos-nav {
        display: none !important; 
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .index-header {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Force fix for server category page spacing */
    .server-hero {
        margin-top: 0 !important;
        padding-top: 80px !important;
        padding-bottom: 60px !important;
    }
    .header-banner {
        display: none !important; /* Hide old empty banner */
        height: 0 !important;
    }
    
    /* Clean up the main layout empty space */
    .zonkvm-buy-banner {
        display: none !important; /* Old empty banner space */
        height: 0 !important;
        padding-top: 0 !important;
    }
    
    .index-header {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        display: none !important; /* Force hide old header wrapper completely */
    }
    
    #header {
        display: none !important;
    }
    
    /* Ensure content connects directly below mobile header */
    .content {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    .zonkvn-top {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    #app {
        margin-top: 0 !important;
    }
    
    /* Make side spacing more comfortable for mobile */
    .container, .auto, .header-container, .footer-container, .common-layout {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }

    .mobile-header-modern {
        display: block;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 16px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
        position: relative;
        z-index: 10001;
    }

    .mobile-logo img {
        height: 32px;
        width: auto;
    }

    .mobile-actions {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    /* Keep the full-site search available in the compact mobile header. */
    .mobile-header-search {
        position: relative;
        display: flex;
        align-items: center;
        flex: 1 1 auto;
        min-width: 0;
        max-width: 180px;
        margin: 0 12px;
    }

    .mobile-search-input {
        width: 100%;
        height: 36px;
        padding: 0 34px 0 12px;
        border: 1px solid #e5e6eb;
        border-radius: 18px;
        outline: none;
        box-sizing: border-box;
        background: #f4f5f7;
        color: var(--text-main, #1d2129);
        font-size: 13px;
        transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    }

    .mobile-search-input::placeholder {
        color: #9aa0a6;
    }

    .mobile-search-input:focus {
        border-color: var(--primary-blue, #006eff);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(0, 110, 255, 0.12);
    }

    .mobile-search-submit {
        position: absolute;
        top: 0;
        right: 4px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 36px;
        padding: 0;
        border: 0;
        background: transparent;
        color: #86909c;
        cursor: pointer;
        font-size: 15px;
    }

    .mobile-search-submit:hover,
    .mobile-search-input:focus + .mobile-search-submit {
        color: var(--primary-blue, #006eff);
    }

    .mobile-search-suggestions {
        top: calc(100% + 10px);
        right: auto;
        left: 50%;
        width: min(360px, calc(100vw - 32px));
        z-index: 10002;
        transform: translateX(-50%);
    }

    .mobile-search-suggestions::before {
        right: calc(50% - 5px);
    }

    .mobile-user-btn {
        color: var(--primary-blue, #006eff);
        font-size: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
    }

    .mobile-login-btn {
        color: #fff;
        background: linear-gradient(135deg, #006eff 0%, #0056cc 100%);
        font-size: 13px;
        font-weight: 500;
        padding: 6px 14px;
        border-radius: 16px;
        text-decoration: none;
        box-shadow: 0 2px 8px rgba(0, 110, 255, 0.2);
    }

    /* Hamburger Menu Toggle */
    .mobile-menu-toggle {
        width: 24px;
        height: 20px;
        position: relative;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .hamburger-line {
        display: block;
        width: 100%;
        height: 2px;
        background-color: var(--text-main, #1d2129);
        border-radius: 2px;
        transition: all 0.3s ease-in-out;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Mobile Drawer */
    .mobile-drawer {
        position: fixed;
        top: 60px; /* Below topbar */
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: calc(100vh - 60px);
        background: #fff;
        z-index: 10000;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }

    .mobile-drawer.active {
        right: 0;
    }

    .mobile-drawer-inner {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .mobile-drawer-user-info {
        display: flex;
        align-items: center;
        padding: 24px;
        background: linear-gradient(135deg, #f8faff 0%, #eef3ff 100%);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .mobile-drawer-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        margin-right: 16px;
        box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    }

    .mobile-drawer-user-text {
        flex: 1;
        overflow: hidden;
    }

    .mobile-drawer-user-text .name {
        font-weight: 600;
        color: #0f172a;
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 4px;
    }

    .mobile-drawer-user-text .balance {
        font-size: 13px;
        color: var(--primary-blue, #006eff);
        font-weight: 500;
    }

    .mobile-menu-list {
        flex: 1;
        overflow-y: auto;
        padding: 20px 0;
    }

    .mobile-menu-list::-webkit-scrollbar {
        width: 4px;
    }
    .mobile-menu-list::-webkit-scrollbar-thumb {
        background: #e5e6eb;
        border-radius: 2px;
    }

    .mobile-menu-item {
        display: block;
        padding: 14px 24px;
        font-size: 16px;
        color: var(--text-main, #1d2129);
        font-weight: 500;
        text-decoration: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    }

    .mobile-menu-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
    }

    .mobile-menu-title-label {
        display: inline-flex;
        gap: 8px;
        align-items: center;
        min-width: 0;
    }

    /* Keep standalone menu icons visually separated from their labels. */
    .mobile-menu-item:not(.has-sub) > i:first-child,
    .mobile-simple-link > i:first-child,
    .mobile-sub-group-title > i:first-child,
    .mobile-sub-links a > i:first-child {
        margin-right: 8px;
    }

    .mobile-menu-title > .fa-angle-down {
        font-size: 14px;
        color: #86909c;
        transition: transform 0.3s;
    }

    .mobile-menu-item.active .mobile-menu-title {
        color: var(--primary-blue, #006eff);
    }

    .mobile-menu-item.active .mobile-menu-title > .fa-angle-down {
        transform: rotate(180deg);
        color: var(--primary-blue, #006eff);
    }

    /* Sub Menu */
    .mobile-sub-menu {
        display: none;
        background: #f8f9fa;
        padding: 10px 0;
        margin: 10px -24px -14px -24px; /* Pull to edges */
    }

    .mobile-sub-group {
        padding: 10px 24px;
    }

    .mobile-sub-group-title {
        font-size: 13px;
        color: #86909c;
        margin-bottom: 12px;
        font-weight: 500;
    }

    .mobile-sub-group-title.link-title {
        color: var(--primary-blue, #006eff);
        text-decoration: none;
        display: inline-block;
    }

    .mobile-sub-links {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .mobile-sub-links a {
        display: block;
        padding: 10px 12px;
        background: #fff;
        border-radius: 8px;
        font-size: 13px;
        color: var(--text-sub, #4e5969);
        text-decoration: none;
        text-align: center;
        box-shadow: 0 1px 3px rgba(0,0,0,0.02);
        border: 1px solid #f0f0f0;
        transition: all 0.2s;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-sub-links a:active {
        background: var(--secondary-blue, #f0f7ff);
        color: var(--primary-blue, #006eff);
        border-color: var(--primary-blue, #006eff);
    }

    .mobile-simple-link {
        display: block;
        padding: 12px 24px;
        font-size: 14px;
        color: var(--text-sub, #4e5969);
        text-decoration: none;
    }

    .mobile-simple-link:active {
        color: var(--primary-blue, #006eff);
        background: rgba(0, 110, 255, 0.05);
    }

    /* Footer */
    .mobile-drawer-footer {
        padding: 20px 24px;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        background: #fff;
    }

    .mobile-register-btn {
        display: block;
        width: 100%;
        padding: 12px 0;
        text-align: center;
        background: var(--primary-blue, #006eff);
        color: #fff;
        font-size: 15px;
        font-weight: 600;
        border-radius: 8px;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(0, 110, 255, 0.2);
    }
    
    .mobile-logout-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 12px 0;
        text-align: center;
        background: #fef2f2;
        color: #ef4444;
        font-size: 15px;
        font-weight: 600;
        border-radius: 8px;
        text-decoration: none;
        border: 1px solid #fca5a5;
    }

    /* Overlay */
    .mobile-drawer-overlay {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-drawer-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 360px) {
    .mobile-topbar {
        padding-right: 12px;
        padding-left: 12px;
    }

    .mobile-actions {
        gap: 10px;
    }

    .mobile-header-search {
        max-width: 132px;
        margin-right: 8px;
        margin-left: 8px;
    }
}
