/* ============================================
   GAME LAYOUT - Farm Simulator Menu System
   ============================================ */

:root {
    --gl-sidebar-w: 260px;
    --gl-sidebar-collapsed-w: 0px;
    --gl-topbar-h: 52px;
    --gl-sidebar-bg: #0c1222;
    --gl-sidebar-border: rgba(255,255,255,0.06);
    --gl-topbar-bg: #111827;
    --gl-topbar-border: rgba(34,197,94,0.15);
    --gl-accent: #22c55e;
    --gl-accent-dim: rgba(34,197,94,0.12);
    --gl-text: #e2e8f0;
    --gl-text-dim: #64748b;
    --gl-text-bright: #f8fafc;
    --gl-hover-bg: rgba(255,255,255,0.04);
    --gl-active-bg: rgba(34,197,94,0.08);
    --gl-section-border: rgba(255,255,255,0.06);
    --gl-content-bg: #0f172a;
    --gl-badge-bg: rgba(34,197,94,0.15);
    --gl-badge-color: #86efac;
    --gl-danger: #ef4444;
    --gl-warning: #f59e0b;
    --gl-info: #3b82f6;
}

/* ===== BODY & WRAPPER ===== */
body {
    overflow-x: hidden;
}

#layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.gl-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--gl-sidebar-w);
    height: 100vh;
    background: var(--gl-sidebar-bg);
    border-right: 1px solid var(--gl-sidebar-border);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Compact sidebar topbar (replaces old header) */
.gl-sidebar-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem 0.4rem 0.75rem;
    border-bottom: 1px solid var(--gl-section-border);
    flex-shrink: 0;
    min-height: 40px;
    gap: 0.5rem;
}

.gl-sidebar-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.gl-topbar-weather {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #7dd3fc;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    transition: background 0.15s;
    white-space: nowrap;
}

.gl-topbar-weather:hover {
    background: rgba(56,189,248,0.1);
}

.gl-weather-label {
    opacity: 0.8;
    font-weight: 400;
    font-size: 0.8rem;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gl-topbar-online {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #a5b4fc;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    white-space: nowrap;
    border-left: 1px solid var(--gl-section-border);
    padding-left: 0.5rem;
}

.gl-topbar-online i {
    font-size: 1rem;
}

.gl-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--gl-text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.gl-sidebar-close:hover {
    color: var(--gl-text);
    background: var(--gl-hover-bg);
}

/* Balance bar */
.gl-balance-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gl-section-border);
    flex-shrink: 0;
    background: rgba(16,185,129,0.07);
    cursor: pointer;
    transition: background 0.15s;
    min-height: 40px;
}

.gl-balance-bar:hover {
    background: rgba(16,185,129,0.13);
}

.gl-balance-bar > i {
    font-size: 1rem;
    color: #34d399;
    flex-shrink: 0;
}

.gl-balance-bar > span {
    font-size: 0.85rem;
    font-weight: 700;
    color: #6ee7b7;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gl-balance-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.gl-balance-btn {
    background: none;
    border: none;
    color: #6ee7b7;
    font-size: 0.8rem;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.gl-balance-btn:hover {
    opacity: 1;
}

/* Sidebar scroll area */
.gl-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.gl-sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.gl-sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.gl-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}

.gl-sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.15);
}

/* Section title */
.gl-section-title {
    padding: 0.875rem 1rem 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gl-text-dim);
    user-select: none;
}

/* Favorites section */
.gl-favorites-section {
    padding: 0 0.5rem 0.25rem;
}

.gl-favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.5rem 0.25rem;
}

.gl-fav-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.gl-fav-edit-btn {
    font-size: 0.6rem;
    color: var(--gl-accent);
    background: var(--gl-accent-dim);
    border: 1px solid rgba(34,197,94,0.2);
    cursor: pointer;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
}

.gl-fav-edit-btn:hover {
    background: rgba(34,197,94,0.2);
}

.gl-fav-edit-btn.active {
    background: var(--gl-accent);
    color: #fff;
    border-color: var(--gl-accent);
}

/* Edit mode: show all star buttons regardless of hover */
.gl-edit-mode .gl-fav-star,
.gl-edit-mode .gl-submenu-fav {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Edit mode: pulse animation to indicate interactive state */
.gl-edit-mode .gl-fav-star:not(.active),
.gl-edit-mode .gl-submenu-fav:not(.active) {
    animation: glStarPulse 2s ease-in-out infinite;
}

@keyframes glStarPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Edit mode: highlight menu items to show they're editable */
.gl-edit-mode .gl-menu-item,
.gl-edit-mode .gl-submenu-row {
    background: rgba(34,197,94,0.03);
    border-radius: 6px;
}

.gl-favorites-header span {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #facc15;
}

.gl-favorites-header span i {
    font-size: 0.7rem;
}

.gl-favorites-clear {
    font-size: 0.6rem;
    color: var(--gl-text-dim);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.gl-favorites-clear:hover {
    color: var(--gl-danger);
    background: rgba(239,68,68,0.1);
}

#gl-favorites-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#gl-favorites-list .gl-menu-link {
    padding-left: 0.75rem;
}

.gl-favorites-empty {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    color: var(--gl-text-dim);
    font-style: italic;
}

/* Desktop: show hover hint, hide mobile hint, hide edit button */
@media (hover: hover) and (pointer: fine) {
    .gl-fav-hint-mobile { display: none; }
    .gl-fav-hint-desktop { display: inline; }
    .gl-fav-edit-btn { display: none; }
}

/* Touch devices: show mobile hint, hide desktop hint */
@media (hover: none), (pointer: coarse) {
    .gl-fav-hint-mobile { display: inline; }
    .gl-fav-hint-desktop { display: none; }
    .gl-fav-edit-btn { display: flex; }
}

/* Menu items */
.gl-menu-item {
    position: relative;
    padding: 0 0.5rem;
}

.gl-menu-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    color: var(--gl-text);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s ease;
    position: relative;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.gl-menu-link:hover {
    background: var(--gl-hover-bg);
    color: var(--gl-text-bright);
}

.gl-menu-link.active,
.gl-menu-link[aria-expanded="true"] {
    background: var(--gl-active-bg);
    color: var(--gl-accent);
}

.gl-menu-link.active::before {
    content: '';
    position: absolute;
    left: -0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--gl-accent);
    border-radius: 0 3px 3px 0;
}

.gl-menu-link i:first-child {
    font-size: 1.1rem;
    width: 1.3rem;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.8;
}

.gl-menu-link:hover i:first-child,
.gl-menu-link.active i:first-child {
    opacity: 1;
}

.gl-menu-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gl-menu-chevron {
    font-size: 0.75rem;
    color: var(--gl-text-dim);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.gl-menu-link[aria-expanded="true"] .gl-menu-chevron {
    transform: rotate(90deg);
}

.gl-menu-badge {
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--gl-badge-bg);
    color: var(--gl-badge-color);
}

.gl-menu-badge.danger {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

.gl-menu-badge.info {
    background: rgba(59,130,246,0.15);
    color: #93c5fd;
}

/* Favorite star button (parent menu items) */
.gl-fav-star {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gl-text-dim);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.35rem;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
    z-index: 2;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gl-menu-item:hover .gl-fav-star,
.gl-fav-star:hover,
.gl-fav-star.active {
    opacity: 1;
}

.gl-fav-star.active {
    color: #facc15;
}

.gl-fav-star:hover {
    color: #facc15;
    background: rgba(250,204,21,0.1);
}

/* Favorite star button (submenu children) */
.gl-submenu-fav {
    background: none;
    border: none;
    color: var(--gl-text-dim);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
    margin-left: auto;
    flex-shrink: 0;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gl-submenu-link:hover + .gl-submenu-fav,
.gl-submenu-fav:hover,
.gl-submenu-fav.active {
    opacity: 1;
}

.gl-submenu-fav.active {
    color: #facc15;
}

.gl-submenu-fav:hover {
    color: #facc15;
    background: rgba(250,204,21,0.1);
}

.gl-submenu-row {
    display: flex;
    align-items: center;
}

.gl-submenu-row:hover .gl-submenu-fav {
    opacity: 1;
}

.gl-submenu-link {
    display: flex;
    align-items: center;
    flex: 1;
}

/* Submenu */
.gl-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    padding-left: 0.5rem;
}

.gl-submenu.show {
    max-height: 2000px;
}

.gl-submenu-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem 0.35rem 2.2rem;
    color: var(--gl-text-dim);
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 400;
    border-radius: 6px;
    transition: all 0.15s;
    position: relative;
}

.gl-submenu-link::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gl-text-dim);
    opacity: 0.4;
    transition: all 0.15s;
}

.gl-submenu-link:hover {
    color: var(--gl-text-bright);
    background: var(--gl-hover-bg);
}

.gl-submenu-link:hover::before {
    background: var(--gl-accent);
    opacity: 1;
}

.gl-submenu-link .gl-menu-badge {
    margin-left: auto;
}

/* Sidebar footer */
.gl-sidebar-footer {
    padding: 0.4rem 0.75rem;
    border-top: 1px solid var(--gl-section-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--gl-text-dim);
    justify-content: center;
}

.gl-footer-online {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--gl-accent);
    font-weight: 600;
    padding-left: 0.75rem;
    border-left: 1px solid var(--gl-section-border);
}

/* ===== TOPBAR ===== */
.gl-topbar {
    position: fixed;
    top: 0;
    left: var(--gl-sidebar-w);
    right: 0;
    height: var(--gl-topbar-h);
    background: var(--gl-topbar-bg);
    border-bottom: 1px solid var(--gl-topbar-border);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gl-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gl-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--gl-text);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.gl-hamburger:hover {
    background: var(--gl-hover-bg);
}

.gl-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--gl-text-dim);
}

.gl-breadcrumb a {
    color: var(--gl-text-dim);
    text-decoration: none;
    transition: color 0.2s;
}

.gl-breadcrumb a:hover {
    color: var(--gl-accent);
}

.gl-breadcrumb .active {
    color: var(--gl-text);
    font-weight: 600;
}

.gl-breadcrumb .separator {
    font-size: 0.65rem;
    opacity: 0.4;
}

.gl-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.gl-topbar-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: none;
    border: none;
    color: var(--gl-text-dim);
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.gl-topbar-btn:hover {
    background: var(--gl-hover-bg);
    color: var(--gl-text);
}

.gl-topbar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.gl-topbar-badge.green { background: var(--gl-accent); color: #fff; }
.gl-topbar-badge.red { background: var(--gl-danger); color: #fff; }
.gl-topbar-badge.blue { background: var(--gl-info); color: #fff; }

.gl-clock {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gl-accent);
    font-variant-numeric: tabular-nums;
    padding: 0 0.5rem;
    white-space: nowrap;
}

/* User profile button */
.gl-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    background: var(--gl-hover-bg);
    border: 1px solid var(--gl-section-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--gl-text);
    margin-left: 0.25rem;
}

.gl-user-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.1);
    color: var(--gl-text);
}

.gl-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid rgba(34,197,94,0.3);
}

.gl-user-name {
    font-size: 0.75rem;
    font-weight: 600;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* User dropdown */
.gl-user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 240px;
    background: var(--gl-sidebar-bg);
    border: 1px solid var(--gl-section-border);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.3);
    z-index: 1050;
    display: none;
    overflow-y: auto;
    max-height: calc(100vh - 70px);
}

.gl-user-dropdown.show {
    display: block;
    animation: glDropdownIn 0.2s ease;
}

@keyframes glDropdownIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.gl-dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gl-section-border);
    background: rgba(255,255,255,0.02);
}

.gl-dropdown-header small {
    color: var(--gl-text-dim);
    font-size: 0.78rem;
}

.gl-dropdown-header strong {
    color: var(--gl-text-bright);
    font-size: 0.85rem;
    display: block;
}

.gl-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    color: var(--gl-text);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.15s;
}

.gl-dropdown-item:hover {
    background: var(--gl-hover-bg);
    color: var(--gl-text-bright);
}

.gl-dropdown-item i {
    font-size: 1rem;
    color: var(--gl-text-dim);
    width: 1.2rem;
    text-align: center;
}

.gl-dropdown-divider {
    height: 1px;
    background: var(--gl-section-border);
    margin: 0.25rem 0;
}

.gl-dropdown-item.danger {
    color: #f87171;
}

.gl-dropdown-item.danger i {
    color: #f87171;
}

/* Notification dropdown */
.gl-notification-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 320px;
    background: var(--gl-sidebar-bg);
    border: 1px solid var(--gl-section-border);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.3);
    z-index: 1050;
    display: none;
    overflow: hidden;
    max-height: 400px;
}

.gl-notification-dropdown.show {
    display: block;
    animation: glDropdownIn 0.2s ease;
}

.gl-notification-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gl-section-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gl-notification-header h6 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--gl-text-bright);
}

.gl-notification-body {
    max-height: 280px;
    overflow-y: auto;
    padding: 0.5rem;
}

.gl-notification-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--gl-section-border);
    text-align: center;
}

.gl-notification-footer a {
    color: var(--gl-accent);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ===== CONTENT AREA ===== */
.gl-content {
    margin-left: var(--gl-sidebar-w);
    margin-top: var(--gl-topbar-h);
    min-height: calc(100vh - var(--gl-topbar-h));
    width: calc(100% - var(--gl-sidebar-w));
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1.25rem;
}

/* ===== OVERLAY ===== */
.gl-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.gl-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ===== MOBILE ===== */
@media (max-width: 991px) {
    .gl-sidebar {
        transform: translateX(-100%);
    }

    .gl-sidebar.open {
        transform: translateX(0);
    }

    .gl-sidebar-close {
        display: flex;
    }

    .gl-topbar {
        left: 0;
    }

    .gl-hamburger {
        display: flex;
    }

    .gl-content {
        margin-left: 0;
        width: 100%;
    }

    .gl-user-name {
        display: none;
    }

    .gl-breadcrumb {
        display: none;
    }
}

@media (max-width: 576px) {
    .gl-sidebar {
        width: 280px;
    }

    .gl-content {
        padding: 0.75rem;
    }

    .gl-topbar {
        padding: 0 0.6rem;
    }

    .gl-topbar-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .gl-clock {
        font-size: 0.85rem;
        padding: 0 0.3rem;
    }

    .gl-notification-dropdown {
        width: 280px;
        right: -1rem;
    }

    .gl-user-dropdown {
        width: 240px;
        right: -0.5rem;
    }

    /* Larger menu text on phone */
    .gl-menu-link {
        font-size: 1rem;
        padding: 0.6rem 0.75rem;
    }

    .gl-submenu-link {
        font-size: 0.95rem;
        padding: 0.5rem 0.65rem 0.5rem 2.4rem;
    }

    .gl-section-title {
        font-size: 0.75rem;
    }

    .gl-menu-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.45rem;
    }

    .gl-dropdown-item {
        font-size: 1rem;
        padding: 0.65rem 1rem;
    }

    .gl-dropdown-item i {
        font-size: 1.1rem;
    }

    .gl-balance-bar > span {
        font-size: 1rem;
    }
}

/* ===== PAGE TITLE ===== */
.gl-page-title {
    margin-bottom: 1rem;
}

.gl-page-title h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gl-text-bright);
    margin: 0;
}

/* ===== LIGHT MODE ===== */
[data-bs-theme="light"] {
    --gl-sidebar-bg: #f0f4f0;
    --gl-sidebar-border: #d1d9d1;
    --gl-topbar-bg: #ffffff;
    --gl-topbar-border: #e2e8e2;
    --gl-accent: #16a34a;
    --gl-accent-dim: rgba(22,163,74,0.08);
    --gl-text: #2d3a2d;
    --gl-text-dim: #7a8f7a;
    --gl-text-bright: #111827;
    --gl-hover-bg: rgba(0,0,0,0.05);
    --gl-active-bg: rgba(22,163,74,0.08);
    --gl-section-border: #d8e4d8;
    --gl-content-bg: #f9fafb;
    --gl-badge-bg: rgba(22,163,74,0.12);
    --gl-badge-color: #15803d;
}

[data-bs-theme="light"] .gl-balance-bar {
    background: rgba(16,185,129,0.07);
    border-bottom-color: #d8e4d8;
}

[data-bs-theme="light"] .gl-balance-bar:hover {
    background: rgba(16,185,129,0.12);
}

[data-bs-theme="light"] .gl-balance-bar > i {
    color: #059669;
}

[data-bs-theme="light"] .gl-balance-bar > span {
    color: #065f46;
}

[data-bs-theme="light"] .gl-balance-btn {
    color: #059669;
}

[data-bs-theme="light"] .gl-topbar-weather {
    color: #0284c7;
}

[data-bs-theme="light"] .gl-topbar-online {
    color: #4f46e5;
    border-left-color: #d8e4d8;
}

[data-bs-theme="light"] .gl-section-title {
    color: #6b7f6b;
}

[data-bs-theme="light"] .gl-menu-link {
    color: #2d3a2d;
}

[data-bs-theme="light"] .gl-submenu-link {
    color: #4a5e4a;
}

[data-bs-theme="light"] .gl-favorites-header span {
    color: #b45309;
}

[data-bs-theme="light"] .gl-user-btn {
    background: rgba(0,0,0,0.03);
    border-color: #e5e7eb;
}

[data-bs-theme="light"] .gl-user-dropdown,
[data-bs-theme="light"] .gl-notification-dropdown {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 16px 48px rgba(0,0,0,0.1);
}

/* ===== ANIMATIONS ===== */
@keyframes glFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== BACK TO TOP ===== */
.gl-back-to-top {
    position: fixed !important;
    bottom: 1.5rem !important;
    right: 1.5rem !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 10px !important;
    background: var(--gl-accent) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 1.2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1040 !important;
    box-shadow: 0 4px 12px rgba(34,197,94,0.3) !important;
    transition: all 0.3s !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) !important;
    pointer-events: none !important;
}

.gl-back-to-top.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

.gl-back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(34,197,94,0.4);
}

/* ===== PRELOADER ===== */
.gl-preloader {
    position: fixed;
    inset: 0;
    background: var(--gl-sidebar-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.gl-preloader.hide {
    opacity: 0;
    pointer-events: none;
}

.gl-preloader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(34,197,94,0.2);
    border-top-color: var(--gl-accent);
    border-radius: 50%;
    animation: glSpin 0.8s linear infinite;
}

@keyframes glSpin {
    to { transform: rotate(360deg); }
}

/* ===== NOTIFICATION DROPDOWN ===== */
.gl-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--gl-section-border);
    transition: background 0.15s;
}

.gl-notif-item:last-child {
    border-bottom: none;
}

.gl-notif-item:hover {
    background: var(--gl-hover-bg);
}

.gl-notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.gl-notif-body {
    flex: 1;
    min-width: 0;
}

.gl-notif-desc {
    font-size: 0.88rem;
    color: var(--gl-text);
    line-height: 1.35;
    margin-bottom: 0.2rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.gl-notif-time {
    font-size: 0.75rem;
    color: var(--gl-text-dim);
}

.gl-notif-time i {
    font-size: 0.75rem;
}

.gl-notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: var(--gl-text-dim);
    font-size: 0.8rem;
}

.gl-notif-empty i {
    font-size: 2rem;
    color: var(--gl-accent);
    opacity: 0.5;
}

.gl-notif-more {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.7rem;
    color: var(--gl-text-dim);
    border-top: 1px solid var(--gl-section-border);
}

.gl-notif-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.4rem;
    font-size: 0.75rem;
    color: var(--gl-accent);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s;
    font-weight: 500;
}

.gl-notif-view-all:hover {
    background: var(--gl-accent-dim);
    color: var(--gl-accent);
}

.gl-notif-clear-btn {
    background: none;
    border: none;
    color: var(--gl-text-dim);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    transition: all 0.15s;
}

.gl-notif-clear-btn:hover {
    color: var(--gl-danger);
    background: rgba(239,68,68,0.1);
}

/* Fix: favorites rendered items - no badge dot overlap */
#gl-favorites-list .gl-fav-rendered {
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
}

#gl-favorites-list .gl-fav-rendered i {
    flex-shrink: 0;
}

/* ===== DARK MODAL ===== */
.gl-modal-content {
    background: var(--gl-sidebar-bg) !important;
    border: 1px solid var(--gl-section-border) !important;
    border-radius: 14px !important;
    color: var(--gl-text);
    overflow: hidden;
}

.gl-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gl-section-border);
    background: rgba(255,255,255,0.02);
}

.gl-modal-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.gl-modal-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gl-text-bright);
}

.gl-modal-subtitle {
    font-size: 0.7rem;
    color: var(--gl-text-dim);
}

.gl-modal-close {
    background: none;
    border: none;
    color: var(--gl-text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.15s;
}

.gl-modal-close:hover {
    color: var(--gl-text-bright);
    background: var(--gl-hover-bg);
}

.gl-modal-footer {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--gl-section-border);
    background: rgba(255,255,255,0.02);
}

.gl-modal-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--gl-accent);
    text-decoration: none;
    justify-content: center;
    padding: 0.3rem;
    border-radius: 6px;
    transition: background 0.15s;
    font-weight: 500;
}

.gl-modal-link:hover {
    background: var(--gl-accent-dim);
    color: var(--gl-accent);
}

.gl-modal-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    color: #ef4444;
    font-size: 0.85rem;
    justify-content: center;
}

.gl-modal-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(34,197,94,0.15);
    border-top-color: var(--gl-accent);
    border-radius: 50%;
    animation: glSpin 0.8s linear infinite;
    margin: 0 auto;
}

/* Transactions table */
.gl-transactions-table-wrap {
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.gl-transactions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.gl-transactions-table thead th {
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gl-text-dim);
    border-bottom: 1px solid var(--gl-section-border);
    background: rgba(255,255,255,0.02);
    position: sticky;
    top: 0;
}

.gl-transactions-table tbody tr {
    border-bottom: 1px solid var(--gl-section-border);
    transition: background 0.15s;
}

.gl-transactions-table tbody tr:last-child {
    border-bottom: none;
}

.gl-transactions-table tbody tr:hover {
    background: var(--gl-hover-bg);
}

.gl-transactions-table tbody td {
    padding: 0.6rem 1rem;
    vertical-align: middle;
}

.gl-tx-date {
    font-size: 0.82rem;
    color: var(--gl-text-dim);
    white-space: nowrap;
}

.gl-tx-desc {
    color: var(--gl-text);
    font-size: 0.8rem;
}

.gl-tx-amount {
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* ===== WEATHER MODAL (theme-aware) ===== */
.gl-weather-modal {
    background: var(--gl-sidebar-bg, #fff);
    border-radius: 12px;
    overflow: hidden;
}

.gl-weather-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gl-section-border, rgba(0,0,0,0.08));
}

.gl-weather-modal-icon {
    font-size: 1.3rem;
    color: var(--gl-accent, #22c55e);
}

.gl-weather-modal-title {
    color: var(--gl-text-bright, #111);
    font-weight: 600;
    font-size: 0.95rem;
}

.gl-weather-modal-sub {
    color: var(--gl-text-dim, #64748b);
    font-size: 0.85rem;
}

.gl-weather-modal-list {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gl-weather-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--gl-section-border, rgba(0,0,0,0.08));
    background: var(--gl-hover-bg, rgba(0,0,0,0.03));
    transition: transform 0.15s;
}

.gl-weather-card:hover { transform: scale(1.01); }

.gl-weather-card.weather-sunny  { background: rgba(251,146,60,0.1);  border-color: rgba(251,146,60,0.25); }
.gl-weather-card.weather-rainy  { background: rgba(59,130,246,0.1);  border-color: rgba(59,130,246,0.25); }
.gl-weather-card.weather-snowy  { background: rgba(125,211,252,0.1); border-color: rgba(125,211,252,0.25); }
.gl-weather-card.weather-neutral { background: var(--gl-hover-bg, rgba(0,0,0,0.03)); }

.gl-weather-card.first { border-color: var(--gl-accent, #22c55e) !important; }

.gl-weather-card-time {
    min-width: 52px;
    text-align: center;
    flex-shrink: 0;
}

.gl-weather-card-hour {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--gl-accent, #22c55e);
}

.gl-weather-card-date {
    display: block;
    font-size: 0.78rem;
    color: var(--gl-text-dim, #64748b);
}

.gl-weather-card-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.gl-weather-card-info { flex: 1; }

.gl-weather-card-temp {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gl-text-bright, #111);
}

.gl-weather-card-type {
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--gl-text-dim, #64748b);
}

.gl-weather-card-details {
    display: flex;
    gap: 1rem;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--gl-text-dim, #64748b);
}

.gl-weather-modal-footer {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--gl-section-border, rgba(0,0,0,0.08));
    text-align: center;
}

.gl-weather-modal-link {
    color: var(--gl-accent, #22c55e);
    font-size: 0.75rem;
    text-decoration: none;
    font-weight: 500;
}

.gl-weather-modal-link:hover { text-decoration: underline; }

/* ===== SWEETALERT2 DARK OVERRIDES ===== */
.gl-swal-dark {
    background: transparent !important;
    border: none !important;
    border-radius: 14px !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6) !important;
}

.gl-swal-html {
    padding: 0 !important;
    margin: 0 !important;
}

.gl-swal-close {
    color: #94a3b8 !important;
    top: 0.6rem !important;
    right: 0.6rem !important;
    z-index: 10 !important;
    background: rgba(0,0,0,0.3) !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 1rem !important;
}

.gl-swal-close:hover {
    color: #f8fafc !important;
    background: rgba(255,255,255,0.1) !important;
}


/* ===== QUICK ACTIONS BAR (mobile) ===== */
.gl-quick-actions-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: none;
    align-items: center;
    justify-content: space-around;
    z-index: 1050;
    background: var(--gl-sidebar-bg);
    border-top: 1px solid var(--gl-topbar-border);
    padding: 0.35rem 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
}

.gl-quick-actions-bar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0.15rem;
    padding: 0.3rem 0.25rem;
    color: var(--gl-text-dim);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    transition: color 0.15s;
    min-width: 0;
}

.gl-quick-actions-bar a i {
    font-size: 1.25rem;
}

.gl-quick-actions-bar a span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.gl-quick-actions-bar a.active {
    color: var(--gl-accent);
}

.gl-quick-actions-bar a.active i {
    filter: drop-shadow(0 0 4px rgba(34,197,94,0.4));
}

@media (max-width: 768px) {
@media (max-width: 768px) {
    .gl-quick-actions-bar {
        display: flex;
    }

    .page-content {
        padding-bottom: 60px !important;
    }

    .gl-back-to-top {
        bottom: 4.5rem !important;
    }

    /* Sidebar: height adjusted dynamically by game-layout.js */
    .gl-sidebar-scroll {
        min-height: 0;
    }

    /* Fix: profile dropdown hidden behind quick actions bar */
    #profileButton .dropdown-menu {
        max-height: calc(100vh - 140px) !important;
        overflow-y: auto !important;
        padding-bottom: 0.5rem !important;
    }
}
