/* ============================================================
   FightTrak Management Platform — Admin Dashboard Styles
   ============================================================ */

/* ----- CSS Variables ----- */
:root {
    --primary: #E63946;
    --primary-dark: #D12F3B;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #F5F5F5;
    --surface: #FFFFFF;
    --text: #1D1D1D;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #1D1D1D;
    --sidebar-width: 240px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --radius-card: 8px;
    --radius-btn: 6px;
    --radius-badge: 4px;
}


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

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text);
    background: var(--background);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    line-height: 1.3;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    display: block;
}


/* ----- Keyframes ----- */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

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

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ==========================================================
   Loading / Spinner
   ========================================================== */
.loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}


/* ==========================================================
   Login Screen
   ========================================================== */
#loginScreen {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--sidebar-bg);
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

#loginScreen.active {
    display: flex;
}

.auth-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 40px 36px 36px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
}

.auth-card .logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: -80px auto 20px;
    border: 4px solid var(--surface);
    box-shadow: var(--shadow);
}

.auth-card h2 {
    margin-bottom: 8px;
    font-size: 22px;
}

.auth-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-form {
    text-align: left;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.12);
}


/* ==========================================================
   Buttons
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-btn);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.4;
}

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

.btn-primary {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: var(--background);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
}


/* ==========================================================
   Sidebar
   ========================================================== */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.sidebar-brand span {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
}

#sidebarNav {
    flex: 1;
    padding: 12px 0;
}

#sidebarNav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

#sidebarNav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

#sidebarNav a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
}

#sidebarNav a .nav-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-footer .user-email {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.sidebar-footer button:hover {
    color: #fff;
}


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

#mainLayout {
    width: 100%;
}


/* ----- Top Bar ----- */
#topbar {
    position: sticky;
    top: 0;
    background: var(--surface);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 50;
    gap: 16px;
}

#topbar h1 {
    font-size: 20px;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ----- Content Area ----- */
#content {
    flex: 1;
    padding: 24px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.25s ease;
}


/* ==========================================================
   Cards
   ========================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.card-header {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 16px;
}


/* ----- Stat Cards ----- */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

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


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


/* ==========================================================
   Data Tables
   ========================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: var(--background);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th {
    padding: 12px;
    text-align: left;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.data-table tbody tr {
    cursor: default;
}


/* ==========================================================
   Search Bar
   ========================================================== */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.12);
}

.search-bar select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-family: inherit;
    min-width: 140px;
    background: var(--surface);
    cursor: pointer;
}

.search-bar select:focus {
    outline: none;
    border-color: var(--primary);
}


/* ==========================================================
   Badges
   ========================================================== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: var(--radius-badge);
    line-height: 1.4;
    white-space: nowrap;
}

.badge-ibjjf {
    background: #fef3c7;
    color: #92400e;
}

.badge-smoothcomp {
    background: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}


/* ==========================================================
   Modals
   ========================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.25s ease;
}

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

.modal-header h2,
.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-header .close-btn,
.modal-header .modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-header .close-btn:hover,
.modal-header .modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}


/* ----- User Flags Modal ----- */
.user-flags-modal .modal-content {
    max-width: 640px;
}

.user-flags-readonly {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    font-size: 14px;
    margin-bottom: 20px;
}

.user-flags-readonly dt {
    color: var(--text-secondary);
    font-weight: 500;
}

.user-flags-readonly dd {
    color: var(--text);
}

.user-flags-section-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.user-flags-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.user-flags-form-row:last-child {
    border-bottom: none;
}

.user-flags-form-row label {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.user-flags-form-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}


/* ==========================================================
   Scraper Cards
   ========================================================== */
.scraper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}

.scraper-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 20px;
}

.scraper-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scraper-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.scraper-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.scraper-status.status-running::before {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.scraper-status.status-idle::before {
    background: var(--text-secondary);
}

.scraper-status.status-error::before {
    background: var(--danger);
}

.duration-bar {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 24px;
    vertical-align: middle;
    background: var(--background);
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
    max-width: 120px;
}

.duration-bar .bar,
.duration-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    min-height: 3px;
    transition: width 0.3s ease;
}


/* ==========================================================
   Notification Dashboard
   ========================================================== */
.queue-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}


/* ==========================================================
   Toast / Admin Notice
   ========================================================== */
#adminNotice {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    min-width: 280px;
    max-width: 420px;
    padding: 14px 20px;
    border-radius: var(--radius-card);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease;
    display: none;
}

#adminNotice.active {
    display: block;
}

#adminNotice.success {
    background: var(--success);
    color: #fff;
}

#adminNotice.error {
    background: var(--danger);
    color: #fff;
}

#adminNotice.info {
    background: #3b82f6;
    color: #fff;
}


/* ==========================================================
   Messages
   ========================================================== */
.message {
    padding: 12px 16px;
    border-radius: var(--radius-btn);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}


/* ==========================================================
   Tabs
   ========================================================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    gap: 0;
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}


/* ==========================================================
   Athlete Details / Scroll Tables
   ========================================================== */
.athlete-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.athlete-details-table th {
    text-align: left;
    padding: 8px 10px;
    background: var(--background);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.athlete-details-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.athlete-details-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.table-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
}


/* ==========================================================
   Source Icons
   ========================================================== */
.source-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    border-radius: 2px;
}


/* ==========================================================
   Utility Classes
   ========================================================== */
.text-center {
    text-align: center;
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}


/* ==========================================================
   Section Toolbar & Search Components
   ========================================================== */
.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-group {
    display: flex;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-label {
    font-size: 14px;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.12);
}

.filter-select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-family: inherit;
    min-width: 140px;
    background: var(--surface);
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}


/* ==========================================================
   Subsections
   ========================================================== */
.subsection {
    margin-bottom: 32px;
}

.subsection-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}


/* ==========================================================
   Placeholder & Helper Text
   ========================================================== */
.placeholder-text {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 20px 0;
    text-align: center;
}

.helper-text {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.error-text {
    color: var(--danger);
}

.success-text {
    color: var(--success);
}


/* ==========================================================
   Clickable Rows
   ========================================================== */
.clickable-row {
    cursor: pointer;
    transition: background 0.15s;
}

.clickable-row:hover {
    background: rgba(230, 57, 70, 0.04) !important;
}


/* ==========================================================
   Detail Headers
   ========================================================== */
.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-title {
    font-weight: 600;
    font-size: 16px;
}


/* ==========================================================
   Stat Card Variants
   ========================================================== */
.stat-warning {
    border-left: 3px solid var(--warning);
}

.stat-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stats-grid-sm {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}


/* ==========================================================
   Tool Cards
   ========================================================== */
.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}


/* ==========================================================
   Auto-refresh Toggle
   ========================================================== */
.auto-refresh-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.auto-refresh-toggle input[type="checkbox"] {
    accent-color: var(--primary);
}


/* ==========================================================
   Summary Cards Row
   ========================================================== */
.summary-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}


/* ==========================================================
   Bulk Actions Bar
   ========================================================== */
.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    margin-bottom: 16px;
}

.selection-count {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}


/* ==========================================================
   System Tools
   ========================================================== */
.system-tools-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.system-tool-btn {
    min-width: 160px;
}

.system-results {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 16px;
    font-size: 13px;
    overflow-x: auto;
}

.system-results pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}


/* ==========================================================
   Scraper Card Internals
   ========================================================== */
.scraper-source-heading {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 24px 0 12px;
}

.scraper-source-heading:first-child {
    margin-top: 0;
}

.scraper-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.scraper-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.scraper-tier {
    font-weight: 600;
    font-size: 14px;
    margin-right: 6px;
}

.scraper-schedule {
    font-size: 12px;
    color: var(--text-secondary);
}

.scraper-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

.scraper-last-run {
    color: var(--text-secondary);
}

.scraper-duration {
    font-weight: 500;
}

.scraper-summary {
    color: var(--text-secondary);
    font-size: 12px;
}

.scraper-error {
    font-size: 12px;
    padding: 6px 8px;
    background: #fef2f2;
    border-radius: var(--radius-badge);
    word-break: break-word;
}

.scraper-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 28px;
    margin-top: 4px;
}

.mini-bar {
    width: 6px;
    border-radius: 2px 2px 0 0;
    min-height: 4px;
}

.scraper-card-footer {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ==========================================================
   User Flags Modal Internals
   ========================================================== */
.flags-section {
    margin-bottom: 20px;
}

.flags-section h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.info-row {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 90px;
    flex-shrink: 0;
}

.monospace {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
}

.flag-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    cursor: pointer;
}

.flag-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}


/* ==========================================================
   Athlete Details Modal
   ========================================================== */
.athlete-summary {
    margin-bottom: 16px;
}

.athlete-info-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--text-secondary);
}

.athlete-info-row strong {
    color: var(--text);
}

.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
    gap: 0;
}

.modal-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.modal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.athlete-tab-content {
    animation: fadeIn 0.2s ease;
}


/* ==========================================================
   Sidebar User Email
   ========================================================== */
.sidebar-user-email {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ==========================================================
   Responsive (max-width: 768px)
   ========================================================== */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        transition: left 0.3s ease;
        z-index: 200;
    }

    #sidebar.open {
        left: 0;
    }

    main {
        margin-left: 0;
    }

    #topbar {
        padding: 12px 16px;
    }

    #topbar h1 {
        font-size: 16px;
    }

    #content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }

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

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

    .search-bar {
        flex-direction: column;
    }

    .search-bar input,
    .search-bar select {
        min-width: unset;
        width: 100%;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .modal {
        padding: 12px;
    }

    .modal-content {
        border-radius: 12px;
    }

    .user-flags-readonly {
        grid-template-columns: 1fr;
    }

    .section-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-group {
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        min-width: unset;
        width: 100%;
    }

    .scraper-cards {
        grid-template-columns: 1fr;
    }

    .summary-cards-row {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .system-tools-grid {
        flex-direction: column;
    }

    .system-tool-btn {
        min-width: unset;
        width: 100%;
    }
}
