/* ==========================================================================
   CloudCore Systems — Control Panel Design System (dashboard.css)
   Aesthetic: High-precision technical dark UI (Linear / Hetzner / Vercel style)
   Palette: #05070d, #080c15, #0b101c, Cyan #06b6d4, Violet #8b5cf6, Emerald #10b981
   ========================================================================== */

:root {
    --panel-bg: #05070d;
    --panel-sidebar: #070a12;
    --panel-surface: #0a0f1a;
    --panel-surface-elevated: #0e1525;
    --panel-border: rgba(255, 255, 255, 0.065);
    --panel-border-strong: rgba(255, 255, 255, 0.11);
    --accent-cyan: #06b6d4;
    --accent-violet: #8b5cf6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
}

html {
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--panel-bg);
    color: #e2e8f0;
    overflow-x: hidden;
    font-variant-numeric: tabular-nums;
    background-image:
        radial-gradient(ellipse 70% 35% at 50% 0%, rgba(6, 182, 212, 0.05), transparent 70%),
        radial-gradient(ellipse 50% 30% at 85% 15%, rgba(139, 92, 246, 0.04), transparent 65%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: #05070d;
}

::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Engineered Surface Panel (replaces heavy AI glass/glow cards) */
.glass-panel {
    background: linear-gradient(180deg, #0b101d 0%, #080c16 100%);
    border: 1px solid var(--panel-border);
    border-radius: 10px !important;
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.04),
        0 4px 16px -2px rgba(0, 0, 0, 0.45);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Sidebar Surface */
.sidebar-glass {
    background: var(--panel-sidebar);
    border-right: 1px solid var(--panel-border);
    box-shadow: none;
}

/* Top Header Bar */
main > header {
    background: rgba(7, 10, 18, 0.88) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border) !important;
}

/* Master Control Top Bar */
#masterControlBar {
    background: #070b14 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: none !important;
}

/* =======================================================
   CLEAN SIDEBAR NAVIGATION (ZERO UNWANTED SCROLLBARS)
   ======================================================= */
aside nav {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE & Edge */
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

aside nav::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Edge, Opera */
    width: 0 !important;
    height: 0 !important;
}

aside nav > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.2rem !important; /* Sleek, balanced item gap preventing vertical overflow */
}

/* Compact Sidebar Meta Boxes to preserve viewport space */
#sidebarMetaBoxFivem,
#sidebarMetaBoxStudio,
#sidebarMetaBoxBot {
    margin-top: 0.5rem !important;
    margin-bottom: 0.25rem !important;
    padding: 0.5rem 0.75rem !important;
}

.no-scrollbar {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.no-scrollbar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Clean, Non-Bouncing Sidebar Navigation */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.38rem 0.65rem;
    border-radius: 7px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #94a3b8;
    border: 1px solid transparent;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    position: relative;
}

.nav-item svg {
    width: 15px;
    height: 15px;
    stroke-width: 1.85;
    color: #64748b;
    transition: color 0.12s ease;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.035);
    color: #f1f5f9;
    transform: none;
}

.nav-item:hover svg {
    color: #cbd5e1;
}

.nav-item.active,
.nav-item-fivem.active {
    background: rgba(6, 182, 212, 0.12) !important;
    color: #f0fdfa !important;
    border: 1px solid rgba(6, 182, 212, 0.28) !important;
    box-shadow: inset 3px 0 0 0 #06b6d4 !important;
    font-weight: 600 !important;
}

.nav-item.active svg,
.nav-item.active i,
.nav-item-fivem.active svg,
.nav-item-fivem.active i {
    color: #22d3ee !important;
}

/* Status Indicator Pip */
.pip-online {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Terminal & Log Scroll Area */
.terminal-scroll {
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.65;
    font-size: 0.78rem;
}

/* Crisp Headline Accent (replaces 3-stop AI rainbow gradient text) */
.gradient-text {
    color: #f8fafc;
}

/* Form Controls Refinement */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="date"],
select,
textarea {
    border-radius: 7px !important;
    border-color: rgba(255, 255, 255, 0.08);
    background-color: #060911;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(6, 182, 212, 0.5) !important;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.12) !important;
}

/* Table Refinements */
table th {
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #64748b;
}

table td {
    font-variant-numeric: tabular-nums;
}

/* Scope Studio vs FiveM visibility rules */
html:not(.scope-studio-active) aside nav a[href="/licenses"],
html:not(.scope-studio-active) aside nav a[href="/news"],
html:not(.scope-studio-active) aside nav a[href="/products"],
html:not(.scope-studio-active) aside nav a[href="/invoices"],
html:not(.scope-studio-active) aside nav a[href="/studio-settings"],
html:not(.scope-studio-active) aside nav a[href="/studio-status"] {
    display: none !important;
}

html.scope-studio-active aside nav a[href="/artifacts"],
html.scope-studio-active aside nav a[href="/players"],
html.scope-studio-active aside nav a[href="/console"],
html.scope-studio-active aside nav a[href="/resources"],
html.scope-studio-active aside nav a[href="/allowlist"],
html.scope-studio-active aside nav a[href="/whitelist"],
html.scope-studio-active aside nav a[href="/backups"],
html.scope-studio-active aside nav a[href="/restarts"],
html.scope-studio-active aside nav a[href="/diagnostics"],
html.scope-studio-active aside nav a[href="/settings"],
html.scope-studio-active aside nav a[href="/status"],
html.scope-studio-active aside nav a[href="/my-invoices"] {
    display: none !important;
}



/* =======================================================
   SCOPE-BASIERTE SIDEBAR STEUERUNG (STRIKTE TRENNUNG)
   ======================================================= */

/* 1. STANDARDFALL: FIVEM TAB AKTIV (Weder Studio noch Bot) */
html:not(.scope-studio-active):not(.scope-bot-active) aside nav .nav-item-studio,
html:not(.scope-studio-active):not(.scope-bot-active) aside nav .nav-item-bot,
html:not(.scope-studio-active):not(.scope-bot-active) aside nav #sidebarBotNavGroup,
html:not(.scope-studio-active):not(.scope-bot-active) #scopeStudioSection,
html:not(.scope-studio-active):not(.scope-bot-active) #scopeBotSection,
html:not(.scope-studio-active):not(.scope-bot-active) #adminActiveManagedBanner,
html:not(.scope-studio-active):not(.scope-bot-active) #settingsScopeBot {
    display: none !important;
}
html:not(.scope-studio-active):not(.scope-bot-active) aside nav .nav-item-fivem,
html:not(.scope-studio-active):not(.scope-bot-active) #scopeFivemSection,
html:not(.scope-studio-active):not(.scope-bot-active) #settingsScopeFivem {
    display: flex !important;
}
html:not(.scope-studio-active):not(.scope-bot-active) #scopeFivemSection,
html:not(.scope-studio-active):not(.scope-bot-active) #settingsScopeFivem {
    display: block !important;
}

/* 2. STUDIO TAB AKTIV */
html.scope-studio-active aside nav .nav-item-fivem,
html.scope-studio-active aside nav .nav-item-bot,
html.scope-studio-active aside nav #sidebarBotNavGroup,
html.scope-studio-active #scopeFivemSection,
html.scope-studio-active #scopeBotSection,
html.scope-studio-active #adminActiveManagedBanner,
html.scope-studio-active #headerServerControls,
html.scope-studio-active #settingsScopeBot {
    display: none !important;
}
html.scope-studio-active aside nav .nav-item-studio {
    display: flex !important;
}
html.scope-studio-active #scopeStudioSection {
    display: block !important;
}

/* 3. DISCORD BOT TAB AKTIV */
html.scope-bot-active aside nav .nav-item-fivem,
html.scope-bot-active aside nav .nav-item-studio,
html.scope-bot-active aside nav #sidebarBotNavGroup,
html.scope-bot-active #scopeFivemSection,
html.scope-bot-active #scopeStudioSection,
html.scope-bot-active #headerServerControls,
html.scope-bot-active #settingsScopeFivem {
    display: none !important;
}
html.scope-bot-active aside nav .nav-item-bot {
    display: flex !important;
}
html.scope-bot-active #scopeBotSection {
    display: block !important;
}
html.scope-bot-active #settingsScopeBot {
    display: block !important;
}

/* =======================================================
   SETTINGS SEITEN SCOPE-TRENNUNG (FIVEM vs BOT)
   ======================================================= */

/* Standard (FiveM aktiv): Bot-Einstellungen komplett ausblenden, FiveM einblenden */
html:not(.scope-bot-active) #settingsScopeBot {
    display: none !important;
}
html:not(.scope-bot-active) #settingsScopeFivem {
    display: block !important;
}

/* Discord Bot aktiv: FiveM Einstellungen komplett ausblenden, NUR Bot Einstellungen einblenden */
html.scope-bot-active #settingsScopeFivem {
    display: none !important;
}
html.scope-bot-active #settingsScopeBot {
    display: block !important;
}

#allModulesCatalogWrapper.hidden,
#allModulesCatalogWrapper.hidden * {
    display: none !important;
}


/* Im Discord Bot Scope: Master-Tenants-Karte ausblenden */
html.scope-bot-active #masterTenantsDashboardCard {
    display: none !important;
}

/* Master-Only Schutz: Niemals für Nicht-Master sichtbar machen */
html:not(.is-master-user) .nav-item-admin-only,
html:not(.is-master-user) #sideBotNav_admin,
html:not(.is-master-user) #botView_admin,
html:not(.is-master-user) #adminBotMasterSection,
html:not(.is-master-user) #masterAdminBannerCard,
html:not(.is-master-user) .admin-only-badge,
html:not(.is-master-user) a[href='/overview#mod_admin'] {
    display: none !important;
}

/* Discord Bot Scope Bar Switch */
html.scope-bot-active #masterControlBar {
    display: none !important;
}
html.scope-bot-active #botControlBar {
    display: flex !important;
}


/* =======================================================
   STRIKTE ISOLATION DER 3 SCOPES (FIVEM / STUDIO / BOT)
   ======================================================= */

/* Meta Badges unter dem Logo */
#sidebarMetaBoxStudio,
#sidebarMetaBoxBot {
    display: none !important;
}

/* 1. FIVEM SCOPE (Standard) */
html:not(.scope-studio-active):not(.scope-bot-active) .nav-item-studio,
html:not(.scope-studio-active):not(.scope-bot-active) .nav-item-bot,
html:not(.scope-studio-active):not(.scope-bot-active) #sidebarMetaBoxStudio,
html:not(.scope-studio-active):not(.scope-bot-active) #sidebarMetaBoxBot,
html:not(.scope-studio-active):not(.scope-bot-active) #botControlBar,
html:not(.scope-studio-active):not(.scope-bot-active) #scopeStudioSection,
html:not(.scope-studio-active):not(.scope-bot-active) #scopeBotSection,
html:not(.scope-studio-active):not(.scope-bot-active) #settingsScopeBot {
    display: none !important;
}
html:not(.scope-studio-active):not(.scope-bot-active) .nav-item-fivem,
html:not(.scope-studio-active):not(.scope-bot-active) #sidebarMetaBoxFivem {
    display: flex !important;
}

/* 2. STUDIO SCOPE */
html.scope-studio-active .nav-item-fivem,
html.scope-studio-active .nav-item-bot,
html.scope-studio-active #sidebarMetaBoxFivem,
html.scope-studio-active #sidebarMetaBoxBot,
html.scope-studio-active #botControlBar,
html.scope-studio-active #scopeFivemSection,
html.scope-studio-active #scopeBotSection,
html.scope-studio-active #headerServerControls,
html.scope-studio-active #settingsScopeBot {
    display: none !important;
}
html.scope-studio-active .nav-item-studio,
html.scope-studio-active #sidebarMetaBoxStudio {
    display: flex !important;
}

/* 3. DISCORD BOT SCOPE */
html.scope-bot-active .nav-item-fivem,
html.scope-bot-active .nav-item-studio,
html.scope-bot-active #sidebarMetaBoxFivem,
html.scope-bot-active #sidebarMetaBoxStudio,
html.scope-bot-active #masterControlBar,
html.scope-bot-active #scopeFivemSection,
html.scope-bot-active #scopeStudioSection,
html.scope-bot-active #headerServerControls,
html.scope-bot-active #settingsScopeFivem {
    display: none !important;
}
html.scope-bot-active .nav-item-bot,
html.scope-bot-active #sidebarMetaBoxBot {
    display: flex !important;
}
html.scope-bot-active #botControlBar {
    display: flex !important;
}
