/* ============================================================
   24/7 Channel Manager - Modern SaaS Dashboard
   Design: Linear/Vercel/Railway inspired dark theme
   ============================================================ */

/* ===== CSS Custom Properties ===== */
:root {
    --bg-base: #0a0a0f;
    --bg-surface: #12121a;
    --bg-surface-hover: #16162a;
    --bg-elevated: #1a1a28;
    --bg-inset: #08080d;
    --border-default: #1e1e2e;
    --border-hover: #2a2a3e;
    --border-active: #3b82f6;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-faint: #475569;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-muted: rgba(59, 130, 246, 0.15);
    --accent-subtle: rgba(59, 130, 246, 0.08);
    --success: #22c55e;
    --success-muted: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --warning-muted: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.15);
    --info: #06b6d4;
    --info-muted: rgba(6, 182, 212, 0.15);
    --purple: #a78bfa;
    --purple-muted: rgba(167, 139, 250, 0.15);
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --header-height: 0px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--accent-hover);
}

::selection {
    background: var(--accent-muted);
    color: var(--text-primary);
}

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

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

code {
    background: var(--accent-subtle);
    color: var(--accent-hover);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

/* ===== Layout: Sidebar + Content ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

@media (max-width: 991px) {
    .app-content {
        margin-left: 0;
        padding: 1.25rem 1rem;
    }
}

@media (max-width: 576px) {
    .app-content {
        padding: 1rem 0.75rem;
    }
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-brand:hover {
    color: var(--text-primary);
}

.sidebar-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-icon svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
}

.sidebar-brand-badge {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-muted);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-left: auto;
}

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

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    padding: 0.75rem 0.75rem 0.35rem;
    margin-top: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
}

.sidebar-link:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-default);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.sidebar-user:hover {
    background: rgba(255,255,255,0.03);
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

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

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

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

.sidebar-logout-btn {
    background: none;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
}

.sidebar-logout-btn:hover {
    background: var(--danger-muted);
    border-color: var(--danger);
    color: var(--danger);
}

.sidebar-logout-btn svg {
    width: 16px;
    height: 16px;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1050;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: flex;
    }
    .sidebar-overlay.active {
        display: block;
    }
}

/* ===== Cards ===== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-default);
    padding: 1rem 1.25rem;
}

.card-header h5,
.card-header h6 {
    color: var(--text-primary);
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: rgba(255,255,255,0.01);
    border-top: 1px solid var(--border-default);
    padding: 0.85rem 1.25rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

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

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

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.stat-blue::before { background: var(--accent); }
.stat-card.stat-green::before { background: var(--success); }
.stat-card.stat-yellow::before { background: var(--warning); }
.stat-card.stat-purple::before { background: var(--purple); }
.stat-card.stat-cyan::before { background: var(--info); }

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
}

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

.stat-card-icon.icon-blue { background: var(--accent-muted); color: var(--accent); }
.stat-card-icon.icon-green { background: var(--success-muted); color: var(--success); }
.stat-card-icon.icon-yellow { background: var(--warning-muted); color: var(--warning); }
.stat-card-icon.icon-purple { background: var(--purple-muted); color: var(--purple); }
.stat-card-icon.icon-cyan { background: var(--info-muted); color: var(--info); }

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.35rem;
}

/* ===== Tables ===== */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-default);
    --bs-table-striped-bg: rgba(255,255,255,0.015);
    --bs-table-hover-bg: rgba(59, 130, 246, 0.04);
    margin: 0;
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--border-default);
}

.table th {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-default) !important;
    padding: 0.75rem 1rem;
    white-space: nowrap;
    background: transparent;
}

.table td {
    vertical-align: middle;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(59, 130, 246, 0.04) !important;
}

.table-responsive {
    border-radius: inherit;
}

/* ===== Forms ===== */
.form-control, .form-select {
    background-color: var(--bg-inset);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    padding: 0.55rem 0.85rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-inset);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

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

.form-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

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

.form-check-input {
    background-color: var(--bg-inset);
    border: 1.5px solid var(--border-hover);
    width: 1.1em;
    height: 1.1em;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

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

textarea.form-control {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
}

.input-group .form-control {
    border-right: none;
}

.input-group .btn {
    border-left: none;
    border-color: var(--border-default);
}

.font-monospace {
    font-family: var(--font-mono) !important;
}

/* ===== Buttons ===== */
.btn {
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 0 12px rgba(59,130,246,0.3);
}
.btn-primary:focus {
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    font-weight: 600;
}
.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
    box-shadow: 0 0 12px rgba(34,197,94,0.3);
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #1a1a28;
    font-weight: 600;
}
.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: #1a1a28;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    font-weight: 600;
}
.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 0 12px rgba(239,68,68,0.3);
}

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--border-default);
    background: transparent;
}
.btn-outline-primary:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-default);
    background: transparent;
}
.btn-outline-secondary:hover {
    background: rgba(255,255,255,0.04);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-outline-success {
    color: var(--success);
    border-color: var(--border-default);
}
.btn-outline-success:hover {
    background: var(--success-muted);
    border-color: var(--success);
    color: var(--success);
}

.btn-outline-warning {
    color: var(--warning);
    border-color: var(--border-default);
}
.btn-outline-warning:hover {
    background: var(--warning-muted);
    border-color: var(--warning);
    color: var(--warning);
}

.btn-outline-danger {
    color: var(--danger);
    border-color: var(--border-default);
}
.btn-outline-danger:hover {
    background: var(--danger-muted);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-outline-info {
    color: var(--info);
    border-color: var(--border-default);
}
.btn-outline-info:hover {
    background: var(--info-muted);
    border-color: var(--info);
    color: var(--info);
}

.btn-outline-light {
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.btn-outline-light:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-secondary {
    background: var(--bg-elevated);
    border-color: var(--border-default);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-sm {
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    font-size: 0.95rem;
    padding: 0.65rem 1.5rem;
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}
.btn-loading::after {
    content: '';
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
}

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

/* ===== Badges ===== */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    padding: 0.3em 0.6em;
    border-radius: 5px;
}

.bg-success {
    background-color: var(--success-muted) !important;
    color: var(--success) !important;
}
.bg-danger {
    background-color: var(--danger-muted) !important;
    color: var(--danger) !important;
}
.bg-warning {
    background-color: var(--warning-muted) !important;
    color: var(--warning) !important;
}
.bg-info {
    background-color: var(--info-muted) !important;
    color: var(--info) !important;
}
.bg-primary {
    background-color: var(--accent-muted) !important;
    color: var(--accent) !important;
}
.bg-secondary {
    background-color: rgba(148, 163, 184, 0.12) !important;
    color: var(--text-muted) !important;
}
.bg-dark {
    background-color: rgba(255,255,255,0.06) !important;
    color: var(--text-secondary) !important;
}

.badge-pulse {
    animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* ===== Alerts ===== */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
}

.alert-success {
    background: var(--success-muted);
    border-color: rgba(34, 197, 94, 0.25);
    color: var(--success);
}
.alert-danger {
    background: var(--danger-muted);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--danger);
}
.alert-warning {
    background: var(--warning-muted);
    border-color: rgba(245, 158, 11, 0.25);
    color: var(--warning);
}
.alert-info {
    background: var(--accent-subtle);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--accent);
}
.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    pointer-events: none;
    max-width: 420px;
}

.toast-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 320px;
}

.toast-item.toast-out {
    opacity: 0;
    transform: translateX(100%);
}

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-item.toast-success { border-left: 3px solid var(--success); }
.toast-item.toast-success .toast-icon { color: var(--success); }
.toast-item.toast-danger { border-left: 3px solid var(--danger); }
.toast-item.toast-danger .toast-icon { color: var(--danger); }
.toast-item.toast-warning { border-left: 3px solid var(--warning); }
.toast-item.toast-warning .toast-icon { color: var(--warning); }
.toast-item.toast-info { border-left: 3px solid var(--accent); }
.toast-item.toast-info .toast-icon { color: var(--accent); }

.toast-message {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.toast-close:hover { opacity: 1; }

.toast-close svg {
    width: 16px;
    height: 16px;
}

/* ===== Download / Progress ===== */
.download-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent);
    transition: border-color var(--transition-fast);
}

.download-card:hover {
    border-color: var(--border-hover);
    border-left-color: var(--accent);
}

.progress {
    height: 8px;
    border-radius: 4px;
    background-color: var(--bg-inset);
    overflow: hidden;
}

.progress-bar {
    transition: width 0.5s ease;
    border-radius: 4px;
    font-size: 0;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
}

.progress-bar.bg-info {
    background: linear-gradient(90deg, var(--accent), #8b5cf6) !important;
}

.progress-lg {
    height: 24px;
    border-radius: var(--radius-sm);
}

.progress-lg .progress-bar {
    font-size: 0.75rem;
    line-height: 24px;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

/* ===== Activity Log ===== */
.activity-item {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-default);
    font-size: 0.85rem;
    transition: background var(--transition-fast);
}
.activity-item:last-child { border-bottom: none; }
.activity-time {
    color: var(--text-faint);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

/* ===== Channel Detail ===== */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.status-indicator.active {
    background-color: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}
.status-indicator.inactive {
    background-color: var(--danger);
}

/* ===== Import Page ===== */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.85rem 1.15rem;
    background: rgba(255,255,255,0.01);
    border-bottom: 1px solid var(--border-default);
}

.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 220px;
    height: 36px;
    font-size: 0.82rem;
}

.filter-bar .filter-count {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.series-row {
    cursor: pointer;
    transition: background var(--transition-fast);
}
.series-row:hover {
    background: var(--accent-subtle) !important;
}
.series-row td {
    padding: 0.6rem 0.85rem;
}

.ep-badge {
    display: inline-block;
    background: var(--accent-muted);
    color: var(--accent);
    border-radius: 10px;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.group-tag {
    display: inline-block;
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border-radius: 4px;
    padding: 0.12rem 0.5rem;
    font-size: 0.72rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-stats {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.15rem;
    background: var(--accent-subtle);
    border-bottom: 1px solid var(--border-default);
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.import-stats strong {
    color: var(--text-primary);
}

/* ===== Settings Page ===== */
.settings-step {
    position: relative;
    padding-left: 3.25rem;
    margin-bottom: 1.5rem;
}

.settings-step .step-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border-default);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    transition: all var(--transition-fast);
    z-index: 1;
}

.settings-step.step-ok .step-number {
    background: var(--success-muted);
    border-color: var(--success);
    color: var(--success);
}

.settings-step .step-connector {
    position: absolute;
    left: 1.075rem;
    top: 2.5rem;
    bottom: -1.5rem;
    width: 2px;
    background: var(--border-default);
}

.settings-step:last-child .step-connector { display: none; }

.step-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.step-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.85rem;
}

.field-help {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.3rem;
    line-height: 1.4;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.login-card {
    max-width: 420px;
    width: 100%;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-card .card-body {
    padding: 2.5rem;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.login-logo svg {
    width: 26px;
    height: 26px;
    color: #fff;
}

/* ===== Dropdown ===== */
.dropdown-menu {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
}

.dropdown-item {
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--accent-subtle);
    color: var(--text-primary);
}

/* ===== Modal ===== */
.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-default);
    padding: 1.15rem 1.5rem;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-default);
    padding: 1rem 1.5rem;
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.5;
}
.btn-close:hover { opacity: 0.8; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.empty-state-icon svg {
    width: 28px;
    height: 28px;
    color: var(--text-faint);
}

.empty-state-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.empty-state-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    max-width: 320px;
    margin: 0 auto;
}

.empty-state-text a {
    color: var(--accent);
}

/* ===== Loading Skeleton ===== */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-elevated) 25%,
        rgba(255,255,255,0.04) 50%,
        var(--bg-elevated) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

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

.skeleton-text {
    height: 0.85rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.skeleton-text:last-child { margin-bottom: 0; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }

.skeleton-stat {
    height: 2rem;
    width: 4rem;
    margin-bottom: 0.5rem;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header-left {
    flex: 1;
    min-width: 0;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ===== Diagnostic Panel (Settings) ===== */
.diag-row {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-default);
    gap: 0.75rem;
}
.diag-row:last-child { border-bottom: none; }
.diag-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    width: 160px;
    flex-shrink: 0;
}
.diag-badge { width: 70px; flex-shrink: 0; }
.diag-msg {
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex: 1;
}

/* ===== Info Box (Settings Storage) ===== */
.info-box {
    background: var(--bg-inset);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem;
    margin-bottom: 1rem;
}

.info-box-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ===== Status Detail Cards ===== */
.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-default);
}
.status-row:last-child { border-bottom: none; }
.status-row-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.status-row-value {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* ===== Action Button Group ===== */
.action-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ===== Utility classes ===== */
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-primary { color: var(--accent) !important; }

.border-default { border-color: var(--border-default) !important; }
.bg-surface { background: var(--bg-surface) !important; }
.bg-base { background: var(--bg-base) !important; }
.bg-elevated { background: var(--bg-elevated) !important; }

hr {
    border-color: var(--border-default);
    opacity: 1;
}

/* Container fluid override */
.main-container {
    max-width: 100%;
    padding: 0;
}

/* ===== Flash messages (header) ===== */
.flash-container {
    margin-bottom: 1.25rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.5rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header-actions { width: 100%; }
    .filter-bar { flex-direction: column; }
    .filter-bar .form-control,
    .filter-bar .form-select { max-width: 100%; }
    .settings-step { padding-left: 2.75rem; }
    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
    .toast-item { min-width: 0; }
}

@media (max-width: 576px) {
    .page-title { font-size: 1.25rem; }
    .action-group { width: 100%; }
    .action-group .btn { flex: 1; justify-content: center; }
}
