/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: #1e293b;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
    border-bottom: 1px solid #334155;
    text-decoration: none;
    display: block;
    letter-spacing: 0.02em;
}

.sidebar-brand:hover { color: #f1f5f9; }

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

.sidebar-nav .nav-item { padding: 0 0.5rem; }

.sidebar-nav .nav-link {
    color: #94a3b8;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: #334155;
    color: #f1f5f9;
}

.sidebar-nav .nav-link .bi { font-size: 1rem; }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #334155;
    font-size: 0.8rem;
    color: #64748b;
}

.sidebar-footer .display-name {
    color: #94a3b8;
    font-weight: 500;
}

/* ── Main content ────────────────────────────────────────────────────── */
.main-content {
    margin-left: 240px;
    min-height: 100vh;
    background: #f1f5f9;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    margin: 0;
}

.page-body {
    padding: 1.5rem;
    animation: pageFadeIn 0.18s ease-out;
}

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

/* ── Stat cards ──────────────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.stat-card-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.2rem;
}

/* ── Tables ──────────────────────────────────────────────────────────── */
.content-card {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

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

.content-card-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1e293b;
}

.table-container { overflow-x: auto; }

.table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    color: #334155;
    font-size: 0.875rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f8fafc; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge-group {
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ── Overlay modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-box {
    background: #fff;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-box-header {
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1e293b;
}

.modal-box-body { padding: 1.25rem; }

.modal-box-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ── Progress bar ────────────────────────────────────────────────────── */
.progress-bar-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    min-width: 280px;
    max-width: 400px;
    border-radius: 0.625rem;
    padding: 0.875rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 0.875rem;
    animation: slideIn 0.2s ease;
}

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

/* ── Login page ──────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4);
}

/* ── Broadcast page ──────────────────────────────────────────────────── */
.broadcast-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Password copy ───────────────────────────────────────────────────── */
.password-copy {
    cursor: pointer;
    border-radius: 4px;
    padding: 1px 4px;
    transition: background 0.15s;
}

.password-copy:hover {
    background: #f1f5f9;
}

/* ── Inline edit ─────────────────────────────────────────────────────── */
.inline-edit-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Connection indicator ────────────────────────────────────────────── */
#components-reconnect-modal { display: none !important; }

#reconnect-overlay {
    position: fixed;
    inset: 0;
    background: rgba(241, 245, 249, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.reconnect-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.reconnect-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}
