/* core.css */
/* default: dark theme */
:root {
    --bg-main: #050509;
    --bg-panel: #10111a;
    --bg-panel-alt: #141624;
    --accent: #3c7df6;
    --accent-soft: rgba(60, 125, 246, 0.18);
    --text-main: #f5f5ff;
    --text-muted: #a0a4c4;
    --border-subtle: rgba(255, 255, 255, 0.04);

    /* SIDEBAR & HEADER DYNAMIC VARIABLES */
    --sidebar-bg: linear-gradient(180deg, #090910 0, #070812 50%, #050509 100%);
    --brand-text-color: #e4e6ff;
    --body-bg-gradient: radial-gradient(circle at top left, #131528 0, var(--bg-main) 40%, #000 100%);

    /* E-SHOP SPECIFIC VARIABLES (Dark mode) */
    --shop-bg: #06070f;
    --shop-card-bg: radial-gradient(circle at top right, rgba(0, 255, 184, 0.18), transparent 60%), #090b16;
    --shop-panel-bg: #050509;
    --shop-accent: #00ffb8;
    --shop-accent-muted: rgba(0, 255, 184, 0.25);
    --shop-text-bright: #9fffe0;
    --shop-price: #7af2b7;
    --shop-input-bg: rgba(8, 10, 20, 0.95);
    --modal-bg: linear-gradient(135deg, #06070f 0%, #0a0c14 100%);
    --input-bg: rgba(15, 18, 28, 0.8);
    --input-border: rgba(255, 255, 255, 0.1);
    --table-row-bg: rgba(12, 14, 26, 0.9);
    --order-head-bg: rgba(0, 255, 184, 0.12);
    --admin-card-bg: #06070f;
    --admin-input-bg: #050509;
    --admin-border: rgba(0, 255, 184, 0.25);
    --admin-row-bg: rgba(12, 14, 26, 0.92);
    --admin-row-hover: rgba(0, 255, 184, 0.08);
    --admin-detail-bg: rgba(6, 7, 15, 0.96);
}

body.theme-light {
    --bg-main: #f0f2f8;
    --bg-panel: #ffffff;
    --bg-panel-alt: #e4e8f3;
    --accent: #1e4ec8;
    --accent-soft: rgba(30, 78, 200, 0.1);
    --text-main: #191c26;
    --text-muted: #5e647e;
    --border-subtle: rgba(0, 0, 0, 0.08);

    /* SIDEBAR & HEADER LIGHT VARIABLES */
    --sidebar-bg: linear-gradient(180deg, #fcfdfe 0%, #f4f6fa 50%, #eaedf5 100%);
    --brand-text-color: #191c26;
    /* Softened radiant ambient glow to keep chart data completely legible */
    --body-bg-gradient: radial-gradient(circle at top left, #e0e5f5 0%, var(--bg-main) 50%, #e2e7f3 100%);

    /* E-SHOP SPECIFIC VARIABLES (Light Mode) */
    --shop-bg: #f0f2f8;
    --shop-card-bg: radial-gradient(circle at top right, rgba(0, 168, 120, 0.08), transparent 60%), #ffffff;
    --shop-panel-bg: #ffffff;
    --shop-accent: #007a55;
    --shop-accent-muted: rgba(0, 122, 85, 0.12);
    --shop-text-bright: #00402c;
    --shop-price: #006647;
    --shop-input-bg: #e4e8f3;
    --modal-bg: linear-gradient(145deg, #ffffff, #e4e8f3);
    --input-bg: #ffffff;
    --input-border: rgba(0, 0, 0, 0.15);
    --table-row-bg: #ffffff;
    --order-head-bg: rgba(0, 122, 85, 0.08);
    --admin-card-bg: #ffffff;
    --admin-input-bg: #f0f2f8;
    --admin-border: rgba(0, 122, 85, 0.2);
    --admin-row-bg: #ffffff;
    --admin-row-hover: rgba(0, 122, 85, 0.05);
    --admin-detail-bg: #e4e8f3;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Main Layout */
html, body {
    min-height: 100%;
    overflow-x: hidden;
}
body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--body-bg-gradient);
    color: var(--text-main);
}
.app {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: radial-gradient(circle at 30% 0, #92a5ff 0, #3c7df6 40%, #15192c 100%);
    box-shadow: 0 0 20px rgba(60, 125, 246, 0.7);
}
.brand-text {
    display: flex;
    flex-direction: column;
}
.brand-title {
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-text-color);
}
.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin: 8px 0;
}
.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-item button {
    width: 100%;
    border-radius: 8px;
    border: none;
    padding: 8px 10px;
    background: transparent;
    color: var(--text-muted);
    text-align: left;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-item button span.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-soft);
}
.nav-item button.active {
    background: rgba(60, 125, 246, 0.16);
    color: var(--text-main);
}
.nav-item button.active span.dot {
    background: var(--accent);
}
.sidebar-footer {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 10px;
}

/* CONTENT AREA */
.content {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 26px;
}
#contentRoot {
    flex: 1;
    width: 100%;
}
.content-views {
    position: relative;
    margin-top: 8px;
    min-height: 220px;
    width: 100%;
}
.content.switching {
    box-shadow: 0 0 0 1px rgba(60, 125, 246, 0.18), 0 0 30px rgba(60, 125, 246, 0.25);
}

/* TOPBAR */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-subtle);
}
.topbar-actions-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    justify-content: flex-end;
}
.topbar-title {
    white-space: nowrap;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
}
.topbar-ambient {
    display: flex;
    align-items: center;
}
button.small-ghost {
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
}
button.primary {
    padding: 0.42rem 0.9rem;
    border-radius: 999px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
}
button.primary:hover {
    background: #346bcd;
}
button.ghost {
    padding: 0.42rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}
button.ghost:hover {
    background: rgba(255, 255, 255, 0.03);
}
body.theme-light button.ghost:hover {
    background: rgba(0, 0, 0, 0.03);
}
.view {
    position: relative;
    display: none;
    width: 100%;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 220ms ease-out, transform 220ms ease-out;
}
.view.view-active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Shared panel style */
.panel {
    background: var(--bg-panel);
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    padding: 14px 16px 12px;
}
.panel-title {
    font-size: 0.95rem;
    margin: 0 0 4px;
}
.panel-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 8px;
}

@media (max-width: 880px) {
    .app {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        overflow-x: auto;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .sidebar {
        mask-image: linear-gradient(to right, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
        padding-bottom: 16px;
    }
    .sidebar::-webkit-scrollbar {
        height: 3px;
    }
    .sidebar::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.02);
        border-radius: 99px;
    }
    body.theme-light .sidebar::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.02);
    }
    .sidebar::-webkit-scrollbar-thumb {
        background: var(--accent-soft);
        border-radius: 99px;
    }
    .brand-text {
        display: none !important;
    }
    .brand {
        padding: 0;
        margin-right: 12px;
        border-bottom: none;
    }
    .brand-logo {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }
    .brand-subtitle,
    .sidebar-section-title,
    .sidebar-footer {
        display: none !important;
    }
    .nav-list {
        flex-direction: row;
        gap: 8px;
    }
    .nav-item button {
        white-space: nowrap;
        padding: 6px 12px;
    }
    .content {
        padding: 16px 14px;
    }
    /* TOPBAR OVERRIDES */
    .topbar {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 16px 10px;
    }
    .topbar-title {
        width: auto;
        flex: 1;
    }
    .topbar-actions-group {
        display: contents;
    }
    .topbar-ambient {
        order: 2;
        display: flex;
        justify-content: flex-end;
    }
    .radio-monitor {
        order: 3;
        width: 100%;
        max-width: 100%;
        height: 40px;
    }
}

/* Live Lifecycle Notice Banner */
.dev-lifecycle-notice {
    background: rgba(255, 193, 7, 0.06);
    border: 1px solid rgba(255, 193, 7, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 12px 0 16px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.dev-lifecycle-notice p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: #e5b83b;
}
.notice-pulse {
    width: 8px;
    height: 8px;
    background-color: #ffc107;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    animation: noticePulseEffect 2s infinite;
}
@keyframes noticePulseEffect {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.5); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(255, 193, 7, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}


/* Radio monitor styles */
.radio-monitor {
    display: flex;
    align-items: center;
    height: 38px;
    gap: 12px;
    background: var(--bg-panel);
    padding: 0 12px;
    border-radius: 99px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    flex: 1;
    min-width: 150px;
    max-width: 1800px;
}
.marquee-container {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}
/* The Rolling Animation */
.now-playing {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 15s linear infinite;
}
#now-playing-text {
    display: inline-block;
    padding-left: 100%;
    animation: marquee-global 15s linear infinite;
    color: var(--accent);
    font-weight: 500;
    white-space: nowrap;
}
@keyframes marquee-global {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
.radio-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}
.tiny {
    padding: 2px 5px;
    font-size: 10px;
}
/* Custom Volume Slider */
#radio-volume {
    -webkit-appearance: none;
    background: var(--accent-soft);
    height: 4px;
    border-radius: 2px;
    outline: none;
}
#radio-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent);
}
#contentRoot::-webkit-scrollbar {
    width: 8px;
}
#contentRoot::-webkit-scrollbar-track {
    background: transparent;
}
#contentRoot::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
#now-playing-text:not(:empty) {
    display: inline-block;
    padding-left: 100%;
    color: var(--accent);
    font-weight: 500;
}
.radio-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

/* modals' isolation fix */
#shopModalRoot, #shopCartModalRoot, #authModalRoot, #settingsModalRoot {
    position: fixed;
    z-index: 99999;
    inset: 0;
    isolation: isolate;
}
body.modal-open {
    overflow: hidden !important;
    height: 100vh;
}
.shop-modal-overlay, .cart-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transform: translateZ(0);
    will-change: backdrop-filter;
}

/* GLOBAL REUSABLE SHOP DROPDOWN COMPONENT */
.shop-dropdown {
    position: relative;
    width: 100%;
    max-width: 200px;
    user-select: none;
    font-family: inherit;
}
.shop-dropdown-selected {
    background: var(--shop-input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    padding: 10px 12px;
    padding-right: 36px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}
.shop-dropdown-selected::after {
    content: '▼';
    position: absolute;
    right: 16px;
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.shop-dropdown.open .shop-dropdown-selected {
    border-color: var(--shop-accent);
    box-shadow: 0 0 0 3px var(--shop-accent-muted);
}
.shop-dropdown.open .shop-dropdown-selected::after {
    transform: rotate(180deg);
    color: var(--shop-accent);
}
.shop-dropdown-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--shop-panel-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1100;
    display: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
body.theme-light .shop-dropdown-list {
    box-shadow: 0 8px 20px rgba(25, 28, 38, 0.06);
}
.shop-dropdown.open .shop-dropdown-list {
    display: block;
}
.shop-dropdown-item {
    padding: 11px 16px;
    font-size: 0.8rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--shop-panel-bg);
}
.shop-dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
}
.shop-dropdown-item:hover {
    background: linear-gradient(var(--shop-accent-muted), var(--shop-accent-muted)), var(--shop-panel-bg);
    color: var(--shop-text-bright);
}
.shop-dropdown-item.active-selection {
    background: linear-gradient(var(--shop-accent-muted), var(--shop-accent-muted)), var(--shop-panel-bg);
    color: var(--shop-accent);
    font-weight: 600;
}
.shop-dropdown-list::-webkit-scrollbar {
    width: 6px;
}
.shop-dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}
.shop-dropdown-list::-webkit-scrollbar-thumb {
    background: var(--shop-accent);
    border-radius: 10px;
}
.hidden {
    display: none !important;
}

/* GLOBAL LOADING */
.dna-container {
    width: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.dna-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.dna-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    flex-grow: 1;
    animation: dnaGlow 1.6s ease-in-out infinite;
}
body.theme-light .dna-bar {
    background: rgba(0, 0, 0, 0.04);
}
.dna-bar:nth-child(1) { animation-delay: 0.1s; flex-grow: 2; }
.dna-bar:nth-child(2) { animation-delay: 0.4s; flex-grow: 5; }
.dna-bar:nth-child(3) { animation-delay: 0.2s; flex-grow: 3; }
.dna-bar:nth-child(4) { animation-delay: 0.6s; flex-grow: 1; }
.dna-bar:nth-child(5) { animation-delay: 0.3s; flex-grow: 4; }
@keyframes dnaGlow {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 1; background: #3498db; transform: scaleY(1.1); }
}