/* ==========================================================================
   DESIGN SYSTEM & THEME VARIABLES
   ========================================================================== */
:root {
    --bg-dark: #090a0f;
    --bg-card: rgba(17, 19, 30, 0.75);
    --bg-sidebar: #0d0e14;
    --border-color: rgba(255, 255, 255, 0.05);
    --border-glow: rgba(168, 85, 247, 0.25);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    /* Neon Accents */
    --neon-purple: #a855f7;
    --neon-purple-glow: rgba(168, 85, 247, 0.35);
    --neon-green: #22c55e;
    --neon-green-glow: rgba(34, 197, 94, 0.35);
    --neon-cyan: #06b6d4;
    --neon-cyan-glow: rgba(6, 182, 212, 0.35);
    --neon-red: #ef4444;
    --neon-red-glow: rgba(239, 68, 68, 0.35);
    
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --sidebar-width: 260px;
    --transition-speed: 0.2s;
    --glass-blur: blur(12px);
}

/* Reset & Basics */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 5% 5%, rgba(168, 85, 247, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 95% 95%, rgba(6, 182, 212, 0.04) 0%, transparent 40%);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--neon-purple);
}

/* App Layout */
#app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    color: var(--neon-purple);
    filter: drop-shadow(0 0 4px var(--neon-purple-glow));
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-speed) ease;
}

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
}

.nav-btn.active {
    color: var(--text-main);
    background: rgba(168, 85, 247, 0.08);
    border-color: var(--border-glow);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.03);
}

.nav-btn.active i {
    color: var(--neon-purple);
    filter: drop-shadow(0 0 3px var(--neon-purple-glow));
}

.server-status {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--neon-green);
    box-shadow: 0 0 8px var(--neon-green-glow);
}

.status-indicator.offline {
    background-color: var(--neon-red);
    box-shadow: 0 0 8px var(--neon-red-glow);
}

.status-info {
    display: flex;
    flex-direction: column;
}

.status-title {
    font-size: 0.8rem;
    font-weight: 600;
}

.status-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Main Content Panel */
#main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 30px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-speed) ease;
}

.btn-primary {
    background-color: var(--neon-purple);
    color: #fff;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
}

.btn-primary:hover {
    background-color: #b86bfb;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Tabs */
.tab-pane {
    display: none;
    flex-direction: column;
    gap: 24px;
}

.tab-pane.active {
    display: flex;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-icon {
    width: 20px;
    height: 20px;
}

.stat-icon.purple { color: var(--neon-purple); filter: drop-shadow(0 0 2px var(--neon-purple-glow)); }
.stat-icon.green { color: var(--neon-green); filter: drop-shadow(0 0 2px var(--neon-green-glow)); }
.stat-icon.cyan { color: var(--neon-cyan); filter: drop-shadow(0 0 2px var(--neon-cyan-glow)); }
.stat-icon.red { color: var(--neon-red); filter: drop-shadow(0 0 2px var(--neon-red-glow)); }

.stat-value {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
}

.stat-footer {
    font-size: 0.8rem;
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Rows & Columns */
.dashboard-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-col {
    display: flex;
    flex-direction: column;
}

.col-100 { width: 100%; }
.col-65 { width: 65%; }
.col-35 { width: 35%; }

/* Card Element */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
}

.card-body {
    padding: 20px;
    flex-grow: 1;
}

.badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid var(--border-glow);
    font-weight: 600;
}

/* Table Design */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

.text-center {
    text-align: center;
}

/* Quick Config Item list */
.quick-config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.quick-config-item:last-child {
    border-bottom: none;
}

.cfg-name {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cfg-status, .cfg-val {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.cfg-status.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--neon-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.cfg-status.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--neon-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.cfg-val {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Webhook log line items */
.webhook-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.webhook-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.webhook-time {
    color: var(--text-muted);
}

.webhook-payload {
    font-family: monospace;
    color: var(--neon-cyan);
}

/* Settings Forms */
.max-w-700 { max-width: 700px; }

.neon-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.form-section h4 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--neon-purple);
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.col-50 { width: 50%; }

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.form-control {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-speed) ease;
}

.form-control:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 5px rgba(168, 85, 247, 0.2);
}

.form-tip {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.flex-row {
    flex-direction: row !important;
    align-items: center;
    gap: 16px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--neon-purple);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.toggle-label-group {
    display: flex;
    flex-direction: column;
}

.toggle-main-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.toggle-sub-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 10px;
}

/* TV setup guide specific styling */
.markdown-style h4 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--neon-purple);
    margin: 20px 0 10px 0;
}

.markdown-style p {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 12px;
}

.markdown-style pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.markdown-style code {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--neon-cyan);
}

.alert-box {
    border-left: 4px solid;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
    font-size: 0.85rem;
}

.alert-box.note {
    background: rgba(6, 182, 212, 0.08);
    border-color: var(--neon-cyan);
}

/* Colors for Trade operations */
.text-green { color: var(--neon-green) !important; }
.text-red { color: var(--neon-red) !important; }

/* Responsive adjustments */
@media(max-width: 900px) {
    .dashboard-row {
        flex-direction: column;
    }
    .col-65, .col-35 {
        width: 100%;
    }
}

/* ==========================================================================
   LOGIN LAYER STYLING
   ========================================================================== */
#login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.08) 0%, transparent 60%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.15);
    border-radius: 16px;
    padding: 40px 30px;
    width: 100%;
    max-width: 380px;
    backdrop-filter: var(--glass-blur);
    animation: fadeIn 0.4s ease-out;
}

.login-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 0.08em;
    margin-bottom: 24px;
    color: var(--text-main);
}

#login-error {
    color: var(--neon-red);
    font-size: 0.8rem;
    text-align: center;
    margin-top: 10px;
    display: none;
    font-weight: 600;
    text-shadow: 0 0 8px var(--neon-red-glow);
}

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

