/* ============================================================
   Admin Panel - Sidebar Layout
   ============================================================ */

.admin-body {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    background: #0c1222;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
    overflow: hidden;
}

/* Sidebar Header / Brand */
.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
}
.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #facc15, #f59e0b);
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}
.sidebar-brand-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.sidebar-brand-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}
.sidebar-section {
    padding: 16px 22px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 22px;
    color: var(--text-secondary);
    text-decoration: none !important;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    position: relative;
    white-space: nowrap;
}
.sidebar-link:hover {
    background: rgba(56, 189, 248, 0.06);
    color: var(--text-primary);
    border-left-color: var(--border);
}
.sidebar-link.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
}
.sidebar-icon {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}
.sidebar-badge {
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
}
.sidebar-badge.warn {
    background: rgba(250, 204, 21, 0.15);
    color: var(--warning);
}
.sidebar-status {
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sidebar-status.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.sidebar-status.offline { background: var(--danger); }

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 0 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-server-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================================
   Main Content Area
   ============================================================ */
.admin-main {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.admin-main.expanded {
    margin-left: 0;
}

/* Top Bar */
.admin-topbar {
    height: 56px;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar-title {
    font-size: 18px;
    font-weight: 600;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
}
.topbar-health { font-size: 13px; }
.topbar-time { color: var(--text-muted); }

.sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Page Content */
.admin-content {
    padding: 24px;
    flex: 1;
}

/* ============================================================
   Dashboard Specific
   ============================================================ */

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.welcome-banner h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}
.welcome-banner p {
    color: var(--text-secondary);
    font-size: 14px;
}
.welcome-banner .banner-stats {
    display: flex;
    gap: 30px;
}
.welcome-banner .banner-stat {
    text-align: center;
}
.welcome-banner .banner-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}
.welcome-banner .banner-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none !important;
}
.quick-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(56, 189, 248, 0.05);
}
.quick-action-btn .qa-icon { font-size: 16px; }

/* Stat Cards - Enhanced */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card-v2 {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}
.stat-card-v2:hover { border-color: var(--accent); }
.stat-card-v2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}
.stat-card-v2.blue::before { background: var(--accent); }
.stat-card-v2.green::before { background: var(--success); }
.stat-card-v2.yellow::before { background: var(--warning); }
.stat-card-v2.purple::before { background: var(--info); }
.stat-card-v2.red::before { background: var(--danger); }

.stat-card-v2 .sc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.stat-card-v2 .sc-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.stat-card-v2.blue .sc-icon { background: rgba(56, 189, 248, 0.1); color: var(--accent); }
.stat-card-v2.green .sc-icon { background: rgba(74, 222, 128, 0.1); color: var(--success); }
.stat-card-v2.yellow .sc-icon { background: rgba(250, 204, 21, 0.1); color: var(--warning); }
.stat-card-v2.purple .sc-icon { background: rgba(129, 140, 248, 0.1); color: var(--info); }
.stat-card-v2.red .sc-icon { background: rgba(248, 113, 113, 0.1); color: var(--danger); }

.stat-card-v2 .sc-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card-v2 .sc-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}
.stat-card-v2.blue .sc-value { color: var(--accent); }
.stat-card-v2.green .sc-value { color: var(--success); }
.stat-card-v2.yellow .sc-value { color: var(--warning); }
.stat-card-v2.purple .sc-value { color: var(--info); }
.stat-card-v2.red .sc-value { color: var(--danger); }

.stat-card-v2 .sc-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* Panel / Section */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.panel-title {
    font-size: 15px;
    font-weight: 600;
}
.panel-body { padding: 0; }
.panel-body.padded { padding: 20px; }
.panel-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* Panel Table */
.panel table { margin: 0; }
.panel th { background: transparent; }

/* Activity / Timeline */
.activity-list { list-style: none; }
.activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: rgba(56, 189, 248, 0.03); }
.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}
.activity-dot.blue { background: var(--accent); }
.activity-dot.green { background: var(--success); }
.activity-dot.yellow { background: var(--warning); }
.activity-dot.purple { background: var(--info); }
.activity-body { flex: 1; }
.activity-title {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.activity-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Architecture Diagram */
.arch-diagram {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-muted);
    padding: 20px;
    overflow-x: auto;
}
.arch-diagram .hl { color: var(--accent); font-weight: 600; }
.arch-diagram .gr { color: var(--success); }
.arch-diagram .yl { color: var(--warning); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    .welcome-banner {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 640px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
    .admin-content {
        padding: 16px;
    }
    .quick-actions {
        flex-direction: column;
    }
}
