/*
 * ETA Admin — design system
 * CSS-variable layer on top of Bootstrap 5.3. Do not remove the Bootstrap
 * stylesheet — this file only overrides its variables/components.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand accent — change this one value to re-skin the whole app. */
    --brand-h: 231;
    --brand-s: 84%;
    --brand-l: 58%;
    --brand: hsl(var(--brand-h) var(--brand-s) var(--brand-l));
    --brand-600: hsl(var(--brand-h) var(--brand-s) 50%);
    --brand-700: hsl(var(--brand-h) var(--brand-s) 42%);
    --brand-50: hsl(var(--brand-h) 100% 97%);
    --brand-100: hsl(var(--brand-h) 95% 93%);

    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --surface-3: #f1f3f9;
    --body-bg: #f5f6fa;
    --border: #e6e8f0;
    --text: #1a1d29;
    --text-muted: #6b7280;
    --text-subtle: #9aa0ac;

    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
    --shadow: 0 1px 3px 0 rgba(16, 24, 40, 0.08), 0 1px 2px -1px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.05);
    --shadow-lg: 0 12px 24px -4px rgba(16, 24, 40, 0.1), 0 4px 8px -2px rgba(16, 24, 40, 0.06);

    --sidebar-w: 268px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 60px;

    --font-sans: 'Inter', 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------------------------------------------------------------- base */

html, body {
    background-color: var(--body-bg);
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    font-size: 0.9375rem;
}

a {
    color: var(--brand);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

small, .text-muted {
    color: var(--text-muted) !important;
}

code {
    color: var(--brand-700);
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.tabular-nums, .money, .vote-count {
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ bootstrap */

:root {
    --bs-primary: var(--brand);
    --bs-primary-rgb: 79, 97, 233;
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius);
    --bs-border-radius-sm: 6px;
    --bs-body-font-family: var(--font-sans);
    --bs-body-bg: var(--body-bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--border);
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-700);
    --bs-success: var(--success);
    --bs-warning: var(--warning);
    --bs-danger: var(--danger);
    --bs-info: var(--info);
}

.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: box-shadow 0.15s ease, transform 0.05s ease;
}

.btn:active {
    transform: translateY(0.5px);
}

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

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--brand-700);
    border-color: var(--brand-700);
}

.btn-sm {
    border-radius: 7px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* Cards */

.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

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

.card-body {
    padding: 1.25rem;
}

/* Forms */

.form-control,
.form-select {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px hsl(var(--brand-h) var(--brand-s) var(--brand-l) / 18%);
}

.form-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.form-text {
    font-size: 0.8125rem;
}

/* Alerts / toasts */

.alert {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.alert-success { background-color: #ecfdf3; border-color: #abefc6; color: #067647; }
.alert-danger  { background-color: #fef3f2; border-color: #fecdca; color: #b42318; }
.alert-warning { background-color: #fffaeb; border-color: #fedf89; color: #93370d; }
.alert-info    { background-color: #ecfeff; border-color: #a5f3fc; color: #0c4a6e; }

.toast {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* Status pills */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.status-pill-success { background: #ecfdf3; color: #067647; }
.status-pill-danger  { background: #fef3f2; color: #b42318; }
.status-pill-warning { background: #fffaeb; color: #93370d; }
.status-pill-info    { background: #ecfeff; color: #0c4a6e; }
.status-pill-neutral { background: var(--surface-3); color: var(--text-muted); }

/* Breadcrumb */

.breadcrumb {
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
}

.breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--brand);
}

.breadcrumb-item.active {
    color: var(--text);
    font-weight: 600;
}

/* Badges (legacy bg-* badges used across views) */

.badge {
    font-weight: 600;
    border-radius: 6px;
}

/* ---------------------------------------------------------------- shell */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    z-index: 1040;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.75rem;
}

.topbar-brand {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.topbar-brand .bi {
    color: var(--brand);
}

.topbar-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.topbar-toggle:hover {
    background: var(--surface-3);
    color: var(--text);
}

.topbar-spacer { flex: 1 1 auto; }

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

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.3rem 0.7rem 0.3rem 0.3rem;
    color: var(--text);
    font-weight: 600;
    font-size: 0.85rem;
}

.user-menu-btn:hover {
    background: var(--surface-3);
}

.user-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--brand-100);
    color: var(--brand-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex: none;
}

/* Sidebar */

.app-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 1030;
    transition: width 0.18s ease, transform 0.2s ease;
    padding-bottom: 1rem;
}

.app-sidebar::-webkit-scrollbar { width: 8px; }
.app-sidebar::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 10px; }
.app-sidebar::-webkit-scrollbar-track { background-color: transparent; }

.app-shell.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-w-collapsed);
}

.sidebar-group {
    padding: 0.85rem 0.9rem 0.3rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-subtle);
    white-space: nowrap;
    overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar-group {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 0.6rem;
}

.sidebar-nav .nav-item { margin-bottom: 2px; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav .nav-link .bi {
    font-size: 1.05rem;
    width: 1.4rem;
    text-align: center;
    flex: none;
    color: var(--text-subtle);
}

.sidebar-nav .nav-link:hover {
    background-color: var(--surface-3);
    color: var(--text);
}

.sidebar-nav .nav-link:hover .bi { color: var(--text); }

.sidebar-nav .nav-link.active {
    background-color: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.sidebar-nav .nav-link.active .bi { color: var(--brand); }

.app-shell.sidebar-collapsed .sidebar-nav .nav-text { display: none; }

/* Mobile off-canvas sidebar */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important;
        box-shadow: var(--shadow-lg);
    }
    .app-shell.sidebar-open .app-sidebar {
        transform: translateX(0);
    }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        top: var(--topbar-h);
        background: rgba(15, 17, 21, 0.45);
        z-index: 1025;
        display: none;
    }
    .app-shell.sidebar-open .sidebar-backdrop {
        display: block;
    }
}

/* Main content */

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--sidebar-w);
    padding-top: calc(var(--topbar-h) + 1.25rem);
    padding-bottom: 2rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    transition: margin-left 0.18s ease;
}

.app-shell.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-w-collapsed);
}

@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

.app-footer {
    margin-left: var(--sidebar-w);
    padding: 1rem 1.5rem 1.5rem;
    color: var(--text-subtle);
    font-size: 0.8125rem;
    transition: margin-left 0.18s ease;
}

.app-shell.sidebar-collapsed .app-footer { margin-left: var(--sidebar-w-collapsed); }

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

/* Page header */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.375rem;
    margin-bottom: 0.15rem;
}

.page-header .page-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Stat cards */

.stat-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.stat-card .stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex: none;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-card .stat-delta {
    font-size: 0.75rem;
    font-weight: 700;
}

/* Empty state */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state .bi {
    font-size: 2.25rem;
    color: var(--text-subtle);
    margin-bottom: 0.75rem;
    display: inline-block;
}

.empty-state h5 {
    color: var(--text);
    margin-bottom: 0.35rem;
}

/* Skeleton loaders */

.skeleton {
    background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
    background-size: 400% 100%;
    animation: skeleton-wave 1.4s ease infinite;
    border-radius: 6px;
}

@keyframes skeleton-wave {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* Sticky table headers (opt-in via <x-table-responsive sticky>) */

.table-sticky-head thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--surface-2);
    box-shadow: 0 1px 0 var(--border);
}

/* ------------------------------------------------------------ DataTables */

div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text);
    padding: 0.3rem 0.6rem;
}

div.dataTables_wrapper div.dataTables_filter input {
    margin-left: 0.5rem;
}

table.dataTable thead th {
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    background-color: var(--surface-2);
}

table.dataTable tbody td {
    vertical-align: middle;
    border-bottom-color: var(--border);
}

table.dataTable.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--surface-2);
    box-shadow: none;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button {
    border-radius: 6px;
    margin: 0 1px;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button.current,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff !important;
}

.dt-buttons .btn,
.dt-button {
    border-radius: var(--radius-sm) !important;
}

/* ---------------------------------------------------------------- auth */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--body-bg);
    padding: 1.5rem;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.auth-brand .bi { color: var(--brand); font-size: 1.4rem; }

/* ------------------------------------------------------------- check-in */

.checkin-shell {
    min-height: calc(100vh - var(--topbar-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.checkin-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.75rem;
}

.checkin-card .form-control {
    font-size: 1.25rem;
    padding: 0.9rem 1rem;
    text-align: center;
    letter-spacing: 0.04em;
}

.checkin-card .btn {
    font-size: 1.05rem;
    padding: 0.85rem 1rem;
}

.checkin-result {
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.checkin-result .bi {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

@media (max-width: 480px) {
    .checkin-card { padding: 1.25rem; }
}

.checkin-main {
    padding-top: calc(var(--topbar-h) + 1rem);
    min-height: 100vh;
}

/* ----------------------------------------------------- legacy page content
 * Pages built their own left margin to clear the old fixed sidebar
 * (`.content` from admin.css). `.app-main` now provides that offset at the
 * shell level, so neutralise the old per-page margin to avoid stacking
 * both. Keeping the `.content`/`.col` classes themselves (lots of inline
 * JS/markup still reference them) — just zeroing their legacy spacing.
 */
.app-main .content {
    margin-left: 0 !important;
    margin-top: 0 !important;
    min-height: auto !important;
}
