/* ================================================
   ISTAR IoT Platform - Main Stylesheet
   Dark Mode + Glassmorphism Design
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ------------------------------------------------
   CSS Variables
   ------------------------------------------------ */
:root {
    /* Colors */
    --bg-primary:      #060b18;
    --bg-secondary:    #0d1526;
    --bg-card:         rgba(16, 30, 60, 0.7);
    --bg-card-hover:   rgba(20, 40, 80, 0.9);
    --glass-border:    rgba(56, 189, 248, 0.15);
    --glass-border-2:  rgba(99, 102, 241, 0.2);

    /* Brand Colors */
    --accent-blue:     #38bdf8;
    --accent-purple:   #818cf8;
    --accent-green:    #10b981;
    --accent-orange:   #f59e0b;
    --accent-red:      #ef4444;
    --accent-cyan:     #06b6d4;

    /* Text */
    --text-primary:    #f1f5f9;
    --text-secondary:  #94a3b8;
    --text-muted:      #475569;

    /* Gradients */
    --grad-blue:       linear-gradient(135deg, #38bdf8, #818cf8);
    --grad-green:      linear-gradient(135deg, #10b981, #06b6d4);
    --grad-orange:     linear-gradient(135deg, #f59e0b, #ef4444);
    --grad-purple:     linear-gradient(135deg, #818cf8, #c084fc);

    /* Sizes */
    --sidebar-width:   260px;
    --header-height:   64px;
    --radius:          12px;
    --radius-lg:       16px;
    --radius-sm:       8px;

    /* Shadows */
    --shadow-glow:     0 0 30px rgba(56, 189, 248, 0.15);
    --shadow-card:     0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-btn:      0 4px 15px rgba(56, 189, 248, 0.3);
}

/* ------------------------------------------------
   Reset & Base
   ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background animated gradient */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(56, 189, 248, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(129, 140, 248, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ------------------------------------------------
   Layout
   ------------------------------------------------ */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ------------------------------------------------
   Sidebar
   ------------------------------------------------ */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 20, 40, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo .logo-icon {
    width: 40px; height: 40px;
    background: var(--grad-blue);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-btn);
}

.sidebar-logo h1 {
    font-size: 16px;
    font-weight: 700;
    background: var(--grad-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo p {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 8px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 0;
    position: relative;
    margin: 1px 8px;
    border-radius: var(--radius-sm);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(56, 189, 248, 0.1);
}

.nav-item.active {
    color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.15);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--accent-blue);
    border-radius: 0 2px 2px 0;
    margin-left: -8px;
}

.nav-icon { font-size: 18px; flex-shrink: 0; }

.nav-badge {
    margin-left: auto;
    background: var(--accent-blue);
    color: var(--bg-primary);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

.nav-badge.online { background: var(--accent-green); }
.nav-badge.offline { background: var(--text-muted); }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(56, 189, 248, 0.08);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
}

.user-avatar {
    width: 34px; height: 34px;
    background: var(--grad-purple);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

.btn-logout {
    display: block;
    margin-top: 10px;
    padding: 8px;
    text-align: center;
    color: var(--accent-red);
    text-decoration: none;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.3);
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ------------------------------------------------
   Main Content
   ------------------------------------------------ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ------------------------------------------------
   Top Header
   ------------------------------------------------ */
.top-header {
    height: var(--header-height);
    background: rgba(10, 20, 40, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title h2 {
    font-size: 18px;
    font-weight: 700;
}

.header-title p {
    font-size: 12px;
    color: var(--text-muted);
}

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

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
}

.server-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(56, 189, 248, 0.1);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

/* ------------------------------------------------
   Page Content
   ------------------------------------------------ */
.page-content {
    padding: 28px;
    flex: 1;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.blue::before   { background: var(--grad-blue); }
.stat-card.green::before  { background: var(--grad-green); }
.stat-card.orange::before { background: var(--grad-orange); }
.stat-card.purple::before { background: var(--grad-purple); }

.stat-card-icon {
    font-size: 28px;
    margin-bottom: 12px;
    display: block;
}

.stat-card-value {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card.blue .stat-card-value   { color: var(--accent-blue); }
.stat-card.green .stat-card-value  { color: var(--accent-green); }
.stat-card.orange .stat-card-value { color: var(--accent-orange); }
.stat-card.purple .stat-card-value { color: var(--accent-purple); }

.stat-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ------------------------------------------------
   Cards / Panels
   ------------------------------------------------ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px 22px; }

/* ------------------------------------------------
   Device Table
   ------------------------------------------------ */
.device-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.device-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.device-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.05);
    vertical-align: middle;
}

.device-table tr:last-child td { border-bottom: none; }

.device-table tr:hover td {
    background: rgba(56, 189, 248, 0.03);
}

.device-name {
    font-weight: 600;
    color: var(--text-primary);
}

.device-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

/* ------------------------------------------------
   Status Badges
   ------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-offline {
    background: rgba(71, 85, 105, 0.3);
    color: var(--text-muted);
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.badge-banned {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
}

.badge-online .badge-dot {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
    animation: pulse 2s infinite;
}

.badge-offline .badge-dot { background: var(--text-muted); }

/* ------------------------------------------------
   Buttons
   ------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background: var(--grad-blue);
    color: var(--bg-primary);
    box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-secondary {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-blue);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover { background: rgba(56, 189, 248, 0.2); }

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ------------------------------------------------
   Forms
   ------------------------------------------------ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(56, 189, 248, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 80px; }

/* File upload */
.file-drop {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(56, 189, 248, 0.03);
}

.file-drop:hover, .file-drop.dragover {
    border-color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.08);
}

.file-drop-icon { font-size: 48px; margin-bottom: 12px; display: block; }

/* ------------------------------------------------
   Log / Terminal
   ------------------------------------------------ */
.log-terminal {
    background: #020811;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius);
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    height: 350px;
    overflow-y: auto;
    line-height: 1.8;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(56, 189, 248, 0.04);
}

.log-time { color: var(--text-muted); flex-shrink: 0; }
.log-device { color: var(--accent-blue); flex-shrink: 0; min-width: 120px; }
.log-type { flex-shrink: 0; min-width: 70px; }
.log-type.heartbeat { color: var(--accent-green); }
.log-type.sensor    { color: var(--accent-cyan); }
.log-type.event     { color: var(--accent-orange); }
.log-type.alert     { color: var(--accent-red); }
.log-payload { color: var(--text-secondary); word-break: break-all; }

/* ------------------------------------------------
   Charts / Visualization
   ------------------------------------------------ */
.signal-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.signal-strength {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 16px;
}

.signal-bar-segment {
    width: 4px;
    background: var(--text-muted);
    border-radius: 1px;
    transition: background 0.3s;
}

.signal-bar-segment:nth-child(1) { height: 4px; }
.signal-bar-segment:nth-child(2) { height: 7px; }
.signal-bar-segment:nth-child(3) { height: 10px; }
.signal-bar-segment:nth-child(4) { height: 13px; }
.signal-bar-segment:nth-child(5) { height: 16px; }

.signal-bar-segment.active { background: var(--accent-green); }
.signal-bar-segment.medium { background: var(--accent-orange); }
.signal-bar-segment.weak   { background: var(--accent-red); }

/* ------------------------------------------------
   Modal
   ------------------------------------------------ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: #0d1526;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title { font-size: 18px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--text-primary); }

/* ------------------------------------------------
   Alert / Toast
   ------------------------------------------------ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(20px);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    border: 1px solid;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.toast.success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-green);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.toast.info {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.3);
    color: var(--accent-blue);
}

/* ------------------------------------------------
   Version Badge
   ------------------------------------------------ */
.version-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(129, 140, 248, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(129, 140, 248, 0.3);
}

/* ------------------------------------------------
   Progress / OTA
   ------------------------------------------------ */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(56, 189, 248, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--grad-blue);
    border-radius: 3px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ------------------------------------------------
   Firmware upload list
   ------------------------------------------------ */
.firmware-list .firmware-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: all 0.2s;
    background: rgba(56, 189, 248, 0.03);
}

.firmware-item:hover {
    background: rgba(56, 189, 248, 0.07);
    border-color: rgba(56, 189, 248, 0.25);
}

.firmware-item.active-fw {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.05);
}

.firmware-icon { font-size: 28px; flex-shrink: 0; }

.firmware-info { flex: 1; }

.firmware-info h4 { font-size: 14px; font-weight: 600; }

.firmware-info p { font-size: 12px; color: var(--text-muted); }

.firmware-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ------------------------------------------------
   Login Page
   ------------------------------------------------ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.login-card {
    background: rgba(13, 21, 38, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(30px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    animation: fadeUp 0.5s ease;
}

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

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 70px; height: 70px;
    background: var(--grad-blue);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-btn);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 800;
    background: var(--grad-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
}

/* ------------------------------------------------
   Dashboard grid
   ------------------------------------------------ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.col-span-2 { grid-column: 1 / -1; }

/* ------------------------------------------------
   Device detail sidebar
   ------------------------------------------------ */
.detail-panel {
    position: fixed;
    top: 0; right: -440px;
    width: 420px;
    height: 100vh;
    background: #0d1526;
    border-left: 1px solid var(--glass-border);
    z-index: 200;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 24px;
}

.detail-panel.open { right: 0; }

/* ------------------------------------------------
   Scrollbar
   ------------------------------------------------ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ------------------------------------------------
   Utilities
   ------------------------------------------------ */
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--accent-blue); }
.text-green   { color: var(--accent-green); }
.text-red     { color: var(--accent-red); }
.text-orange  { color: var(--accent-orange); }
.text-purple  { color: var(--accent-purple); }

.mono { font-family: 'JetBrains Mono', monospace; }

.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

.section-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 16px 0;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-blue);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--glass-border);
}

/* ------------------------------------------------
   Animations
   ------------------------------------------------ */
.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------
   Real-time indicator
   ------------------------------------------------ */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.live-dot {
    width: 6px; height: 6px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 1s infinite;
}

/* ------------------------------------------------
   Responsive
   ------------------------------------------------ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .page-content { padding: 16px; }
    
    .detail-panel { width: 100%; }
}
