/* ============================================
   StreamPanel - Theme System
   10 Themes (6 dark, 4 light)
   ============================================ */

/* === Theme Variables === */
:root, [data-theme="dark-midnight"] {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #242836;
    --bg-card: #1e2230;
    --bg-hover: #2a2f40;
    --bg-input: #161924;
    --border-color: #2e3347;
    --border-light: #363b50;
    --text-primary: #e4e6ef;
    --text-secondary: #9498ae;
    --text-muted: #6b6f84;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-subtle: rgba(99,102,241,0.12);
    --success: #22c55e;
    --success-subtle: rgba(34,197,94,0.12);
    --danger: #ef4444;
    --danger-subtle: rgba(239,68,68,0.12);
    --warning: #f59e0b;
    --warning-subtle: rgba(245,158,11,0.12);
    --info: #3b82f6;
    --info-subtle: rgba(59,130,246,0.12);
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --sidebar-width: 260px;
    --radius: 10px;
    --radius-sm: 6px;
    --transition: all 0.2s ease;
    --scrollbar-bg: var(--bg-secondary);
    --scrollbar-thumb: var(--border-light);
    color-scheme: dark;
}

[data-theme="dark-ocean"] {
    --bg-primary: #0a1628;
    --bg-secondary: #0f2038;
    --bg-tertiary: #162a48;
    --bg-card: #132440;
    --bg-hover: #1a3358;
    --bg-input: #0c1a30;
    --border-color: #1e3a5f;
    --border-light: #264a70;
    --text-primary: #d8e8f8;
    --text-secondary: #8babc8;
    --text-muted: #5a7a98;
    --accent: #0ea5e9;
    --accent-hover: #38bdf8;
    --accent-subtle: rgba(14,165,233,0.12);
    color-scheme: dark;
}

[data-theme="dark-forest"] {
    --bg-primary: #0c1410;
    --bg-secondary: #121e18;
    --bg-tertiary: #1a2c22;
    --bg-card: #162820;
    --bg-hover: #203828;
    --bg-input: #0e1812;
    --border-color: #243828;
    --border-light: #2e4a34;
    --text-primary: #d4e8da;
    --text-secondary: #88b098;
    --text-muted: #5a8068;
    --accent: #22c55e;
    --accent-hover: #4ade80;
    --accent-subtle: rgba(34,197,94,0.12);
    color-scheme: dark;
}

[data-theme="dark-ember"] {
    --bg-primary: #14100c;
    --bg-secondary: #1e1612;
    --bg-tertiary: #2c201a;
    --bg-card: #261c16;
    --bg-hover: #382820;
    --bg-input: #181210;
    --border-color: #3a2a20;
    --border-light: #4a3828;
    --text-primary: #f0dcd0;
    --text-secondary: #c0a090;
    --text-muted: #8a6a58;
    --accent: #f97316;
    --accent-hover: #fb923c;
    --accent-subtle: rgba(249,115,22,0.12);
    color-scheme: dark;
}

[data-theme="dark-violet"] {
    --bg-primary: #120e1c;
    --bg-secondary: #1a1428;
    --bg-tertiary: #241c38;
    --bg-card: #201830;
    --bg-hover: #2e2248;
    --bg-input: #161020;
    --border-color: #2e2248;
    --border-light: #3a2e58;
    --text-primary: #e0d8f0;
    --text-secondary: #a898c8;
    --text-muted: #7868a0;
    --accent: #a855f7;
    --accent-hover: #c084fc;
    --accent-subtle: rgba(168,85,247,0.12);
    color-scheme: dark;
}

[data-theme="dark-slate"] {
    --bg-primary: #111214;
    --bg-secondary: #1a1b1e;
    --bg-tertiary: #232528;
    --bg-card: #1e2023;
    --bg-hover: #2a2c30;
    --bg-input: #151618;
    --border-color: #2e3034;
    --border-light: #38393e;
    --text-primary: #e0e1e4;
    --text-secondary: #94959a;
    --text-muted: #68696e;
    --accent: #64748b;
    --accent-hover: #94a3b8;
    --accent-subtle: rgba(100,116,139,0.12);
    color-scheme: dark;
}

[data-theme="light-clean"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef0f5;
    --bg-card: #ffffff;
    --bg-hover: #f0f2f7;
    --bg-input: #f4f5f9;
    --border-color: #e2e5ee;
    --border-light: #d0d4e0;
    --text-primary: #1a1d2e;
    --text-secondary: #5a5e74;
    --text-muted: #8a8ea4;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-subtle: rgba(99,102,241,0.08);
    --success-subtle: rgba(34,197,94,0.08);
    --danger-subtle: rgba(239,68,68,0.08);
    --warning-subtle: rgba(245,158,11,0.08);
    --info-subtle: rgba(59,130,246,0.08);
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    color-scheme: light;
}

[data-theme="light-warm"] {
    --bg-primary: #faf8f5;
    --bg-secondary: #fffefa;
    --bg-tertiary: #f0ece4;
    --bg-card: #fffefa;
    --bg-hover: #f5f0e8;
    --bg-input: #f8f5f0;
    --border-color: #e5ddd0;
    --border-light: #d8cfc0;
    --text-primary: #2a2418;
    --text-secondary: #6a5e48;
    --text-muted: #9a8e78;
    --accent: #d97706;
    --accent-hover: #b45309;
    --accent-subtle: rgba(217,119,6,0.08);
    --shadow: 0 4px 24px rgba(0,0,0,0.06);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    color-scheme: light;
}

[data-theme="light-blue"] {
    --bg-primary: #f0f6ff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e0ecfa;
    --bg-card: #ffffff;
    --bg-hover: #e8f0ff;
    --bg-input: #f0f4fa;
    --border-color: #c8d8ee;
    --border-light: #b0c8e8;
    --text-primary: #142038;
    --text-secondary: #446088;
    --text-muted: #7490b0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-subtle: rgba(37,99,235,0.08);
    --shadow: 0 4px 24px rgba(0,0,0,0.06);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    color-scheme: light;
}

[data-theme="light-mint"] {
    --bg-primary: #f0faf5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e0f2ea;
    --bg-card: #ffffff;
    --bg-hover: #e4f8ee;
    --bg-input: #f0f6f2;
    --border-color: #c0dace;
    --border-light: #a8d0b8;
    --text-primary: #122820;
    --text-secondary: #3a6850;
    --text-muted: #6a9880;
    --accent: #059669;
    --accent-hover: #047857;
    --accent-subtle: rgba(5,150,105,0.08);
    --shadow: 0 4px 24px rgba(0,0,0,0.06);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    color-scheme: light;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

/* === Layout === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-brand small {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 450;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 550;
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

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

.topbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-breadcrumb {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.menu-toggle:hover { background: var(--bg-hover); }

.content-area {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
}

/* === Components === */

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color); }

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon.accent { background: var(--accent-subtle); color: var(--accent); }
.stat-icon.success { background: var(--success-subtle); color: var(--success); }
.stat-icon.warning { background: var(--warning-subtle); color: var(--warning); }
.stat-icon.info { background: var(--info-subtle); color: var(--info); }

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 550;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-accent {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); }

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; }

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 0.95rem; }
.btn-icon { padding: 0.5rem; }
.btn-icon.btn-sm { padding: 0.35rem; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Forms */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 550;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control,
.form-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-control:focus,
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

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

select.form-control,
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b6f84' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

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

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--text-primary);
    vertical-align: middle;
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--bg-hover); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-subtle); color: var(--success); }
.badge-danger { background: var(--danger-subtle); color: var(--danger); }
.badge-warning { background: var(--warning-subtle); color: var(--warning); }
.badge-info { background: var(--info-subtle); color: var(--info); }
.badge-accent { background: var(--accent-subtle); color: var(--accent); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

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

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

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

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title { font-size: 1.05rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    line-height: 1;
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.modal-lg { max-width: 720px; }
.sort-ghost { opacity: 0.3; background: var(--accent-subtle) !important; border-color: var(--accent) !important; }

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    animation: toastIn 0.3s ease;
    font-size: 0.88rem;
}

.toast.toast-out { animation: toastOut 0.3s ease forwards; }

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

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

/* Toggle Switch */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-color);
    border-radius: 11px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Channel logo */
.channel-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    background: var(--bg-tertiary);
    padding: 2px;
}

/* Health indicator */
.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.health-dot.ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.health-dot.error { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.health-dot.unknown { background: var(--text-muted); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: center;
    padding: 1rem 0;
}

.pagination a, .pagination span {
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.pagination a:hover { background: var(--bg-hover); color: var(--text-primary); }
.pagination .active { background: var(--accent); color: white; }

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.88rem; }

/* Drag handle */
.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 0.25rem;
}

.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.4; }
.sortable-chosen { background: var(--accent-subtle) !important; }

/* === Login Page === */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 2rem;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: white;
    margin-bottom: 0.75rem;
}

.login-logo h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-logo p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.login-form .form-group { margin-bottom: 1.25rem; }
.login-form .btn { width: 100%; justify-content: center; padding: 0.7rem; }

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

    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }

    .sidebar-overlay.active { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
    .content-area { padding: 1rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .modal { margin: 1rem; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .btn-group { flex-direction: column; }
}

/* === Utilities === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.border-top { border-top: 1px solid var(--border-color); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* === Additional Layout Components === */

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .card-grid, .settings-grid { grid-template-columns: 1fr; }
}

/* Stat Grid Mini */
.stat-grid-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.stat-grid-mini > div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Card Danger */
.card-danger { border: 1px solid var(--danger-subtle); }
.card-danger .card-header { border-bottom-color: var(--danger-subtle); }

/* Flex helpers */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-row { display: flex; align-items: center; }
.gap-3 { gap: 1.25rem; }

/* Avatar */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
}

/* Text utilities */
.text-strong { font-weight: 600; color: var(--text-primary); }
.text-lg { font-size: 1.05rem; }
.mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.py-4 { padding: 2rem 0; }

/* Badge extras */
.badge-ghost { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-muted { background: var(--bg-tertiary); color: var(--text-muted); }

/* Status dot */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.status-ok { background: var(--success); box-shadow: 0 0 4px var(--success); }
.status-error { background: var(--danger); box-shadow: 0 0 4px var(--danger); }
.status-timeout { background: var(--warning); box-shadow: 0 0 4px var(--warning); }
.status-unknown { background: var(--text-muted); }

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

/* Filter Row */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.filter-row .form-group.compact {
    margin-bottom: 0;
}

.form-select-sm, .form-input-sm {
    padding: 0.4rem 0.65rem;
    font-size: 0.82rem;
    height: auto;
}

/* Table date separator */
.table-date-separator td {
    background: var(--bg-tertiary) !important;
    padding: 0.4rem 0.75rem !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* Form checkbox */
.form-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Pagination info */
.pagination-info {
    padding: 0.25rem 0.75rem;
}

/* Theme Picker */
.theme-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius);
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.theme-swatch:hover { border-color: var(--border-light); background: var(--bg-hover); }
.theme-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

.theme-swatch-color {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.theme-swatch-label {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.theme-swatch-mode {
    font-size: 0.72rem;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Input with suffix */
.input-with-suffix {
    display: flex;
    align-items: center;
}

.input-with-suffix .form-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-suffix {
    padding: 0.55rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.input-group { display: flex; align-items: center; gap: 0.5rem; }

/* Form select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6f84' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 2rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.88rem;
    padding: 0.55rem 2rem 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
