/* ==========================================================================
   College Event Management - design system
   Palette: academic indigo + warm amber accent. Fonts: Plus Jakarta Sans
   (headings) + Inter (body), with system-font fallbacks.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
    --primary: #1e40af;
    --primary-dark: #172e82;
    --primary-soft: #e8eefc;
    --accent: #f59e0b;
    --accent-soft: #fff4dc;
    --success: #047857;
    --success-soft: #dcf5ea;
    --danger: #b42318;
    --danger-soft: #fdeceb;
    --ink: #0f172a;
    --text: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f4f6fb;
    --surface: #ffffff;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-lg: 0 2px 4px rgba(15, 23, 42, .05), 0 20px 48px rgba(15, 23, 42, .12);
    --font-head: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    background-image: radial-gradient(900px 400px at 100% -10%, rgba(30, 64, 175, .08), transparent 60%),
                      radial-gradient(700px 360px at -10% 0%, rgba(245, 158, 11, .07), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--ink);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h2 { font-size: 1.25rem; margin: 0 0 16px; }
h3 { font-size: 1.08rem; margin: 0 0 6px; }

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

img, svg { max-width: 100%; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Layout ------------------------------------------------------------------ */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px 20px 40px; }

.main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }

.dashboard-grid { display: grid; gap: 24px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.stack { display: grid; gap: 16px; }

/* App bar ----------------------------------------------------------------- */
.appbar { margin-bottom: 24px; }

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(120deg, #172e82 0%, #1e40af 55%, #2f5fd0 100%);
    color: #fff;
    padding: 26px 30px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header-row::after {
    content: '';
    position: absolute;
    right: -60px;
    top: -80px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    pointer-events: none;
}

.appbar .header-row { margin-bottom: 0; }

.header-row h1 { margin: 0; font-size: 1.55rem; font-weight: 800; color: #fff; }

.header-row .eyebrow { color: rgba(255, 255, 255, .75); margin-bottom: 6px; }

.eyebrow {
    margin: 0 0 8px;
    color: var(--muted);
    letter-spacing: .12em;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.header-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; position: relative; z-index: 1; }

.logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

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

.header-row .logout,
.header-row .button.secondary {
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .28);
    box-shadow: none;
}

.header-row .logout:hover,
.header-row .button.secondary:hover { background: #fff; color: var(--primary); }

/* Cards & panels ---------------------------------------------------------- */
.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.panel > h2:first-child,
.card > h2:first-child { margin-top: 0; }

/* Forms ------------------------------------------------------------------- */
form { display: grid; gap: 16px; }

.form-group { display: grid; gap: 6px; }

.form-label { display: block; font-size: .9rem; font-weight: 600; color: var(--ink); }

.form-hint { font-size: .82rem; color: var(--muted); margin: 0; }

input, textarea, select {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    font: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    transition: border-color .18s ease, box-shadow .18s ease;
}

input::placeholder, textarea::placeholder { color: #94a3b8; }

input[readonly] { background: #f1f5f9; color: var(--muted); cursor: not-allowed; }

textarea { min-height: 120px; resize: vertical; }

input:hover, textarea:hover, select:hover { border-color: #94a3b8; }

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 64, 175, .15);
}

input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }

/* Buttons ----------------------------------------------------------------- */
button, .button, a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    font: inherit;
    font-size: .97rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}

button:hover, .button:hover, a.button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(30, 64, 175, .25);
}

button:active, .button:active { box-shadow: none; }

button:disabled, .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none; }

button.secondary, .button.secondary, a.button.secondary {
    color: var(--primary);
    background: #fff;
    border: 1px solid #cbd5e1;
    box-shadow: none;
}

button.secondary:hover, .button.secondary:hover, a.button.secondary:hover { background: var(--primary-soft); border-color: var(--primary); }

button.danger, .button.danger { background: var(--danger); border-color: var(--danger); }

button.danger:hover, .button.danger:hover { background: #8f1d14; border-color: #8f1d14; box-shadow: 0 6px 16px rgba(180, 35, 24, .25); }

button.success, .button.success { background: var(--success); border-color: var(--success); }

button.success:hover, .button.success:hover { background: #035f46; border-color: #035f46; box-shadow: 0 6px 16px rgba(4, 120, 87, .25); }

.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .88rem; }

.btn-block { width: 100%; }

a:focus-visible, button:focus-visible, .button:focus-visible, .logout:focus-visible, summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Events ------------------------------------------------------------------ */
.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }

.event, .event-card {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: box-shadow .2s ease, border-color .2s ease;
}

.event:hover, .event-card:hover { box-shadow: var(--shadow); border-color: #c7d2fe; border-left-color: var(--primary); }

.event-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

.event-header h3 { margin: 0; }

.event-date, .event-chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: .8rem;
    font-weight: 600;
    color: #92400e;
    background: var(--accent-soft);
    border-radius: 999px;
    white-space: nowrap;
}

.event p, .event-card p, .event-description { margin: 8px 0 16px; color: var(--text); line-height: 1.65; }

.event-meta { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }

.event-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; background: #fff; font-size: .93rem; }

thead, th { background: #f8fafc; }

th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }

th { color: var(--muted); font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }

tbody tr:hover td, table tr:hover td { background: #f8faff; }

tr:last-child td { border-bottom: none; }

/* Badges, chips, stats ---------------------------------------------------- */
.small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 999px;
    transition: background .18s ease, color .18s ease;
}

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

td .small, td .badge { white-space: nowrap; }

td .small + .small, td .small + .badge { margin-left: 4px; }

td { white-space: normal; }

td:last-child { white-space: nowrap; }

.events-panel .event { display: flex; flex-direction: column; }

.events-panel .event .event-actions, .events-panel .event > a.button { margin-top: auto; align-self: flex-start; }

.small.muted { color: var(--muted); background: #f1f5f9; font-weight: 500; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: .78rem; font-weight: 600; border-radius: 999px; background: #f1f5f9; color: var(--muted); }

.badge-success { background: var(--success-soft); color: var(--success); }

.badge-warn { background: var(--accent-soft); color: #92400e; }

.badge-danger { background: var(--danger-soft); color: var(--danger); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }

.stat .stat-value { display: block; font-family: var(--font-head); font-size: 1.9rem; font-weight: 800; color: var(--primary); line-height: 1.1; }

.stat .stat-label { display: block; margin-top: 4px; font-size: .82rem; font-weight: 500; color: var(--muted); }

.muted { color: var(--muted); }

.no-data { padding: 28px 20px; text-align: center; color: var(--muted); background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: var(--radius-sm); }

/* Alerts & flash ---------------------------------------------------------- */
.error, .alert {
    padding: 13px 16px;
    margin-bottom: 16px;
    font-size: .95rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.error, .alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f5c2bd; }

.alert-success { background: var(--success-soft); color: var(--success); border-color: #a7e3c9; }

.flash {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
    max-width: calc(100vw - 40px);
    padding: 14px 18px;
    font-weight: 500;
    color: #fff;
    background: var(--ink);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}

.flash.show { opacity: 1; transform: none; }

.appfoot { text-align: center; padding: 28px 0 0; color: var(--muted); font-size: .88rem; }

/* Auth / centred pages ---------------------------------------------------- */
.page-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }

.page-card { width: 100%; max-width: 560px; margin: 0 auto; }

.page-card .header-row { background: none; box-shadow: none; padding: 0 0 16px; color: inherit; overflow: visible; border-radius: 0; }

.page-card .header-row::after { display: none; }

.page-card .header-row h1 { color: var(--ink); }

.page-card .header-row .logout { color: var(--primary); background: var(--primary-soft); border-color: transparent; }

.page-card .header-row .logout:hover { color: #fff; background: var(--primary); }

.page-card .header-row .eyebrow { color: var(--muted); }

.page-heading { margin: 0; font-size: 1.7rem; font-weight: 800; color: var(--ink); }

.page-subtitle { margin-top: 8px; font-size: .95rem; color: var(--muted); }

.auth-card { max-width: 940px; padding: 0; overflow: hidden; box-shadow: var(--shadow-lg); }

.auth-section { overflow: hidden; border-radius: var(--radius); }

.auth-grid { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 540px; }

.auth-preview, .auth-form { padding: 44px 40px; background: #fff; }

.auth-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    color: #fff;
    background: linear-gradient(155deg, #172e82 0%, #1e40af 55%, #2f5fd0 100%);
    overflow: hidden;
}

.auth-preview::before, .auth-preview::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }

.auth-preview::before { width: 240px; height: 240px; top: -80px; right: -70px; background: rgba(255, 255, 255, .09); }

.auth-preview::after { width: 150px; height: 150px; bottom: -40px; left: -40px; background: rgba(245, 158, 11, .22); }

.auth-preview > * { position: relative; z-index: 1; }

.auth-preview h1 { margin: 0; font-size: 2.3rem; font-weight: 800; color: #fff; letter-spacing: -0.03em; }

.auth-preview p, .auth-preview .eyebrow { color: rgba(255, 255, 255, .85); margin: 0; }

.auth-preview .small { background: rgba(255, 255, 255, .15); color: #fff; align-self: flex-start; }

.auth-feature-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 12px; }

.auth-feature-list li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .92); font-size: .95rem; }

.auth-feature-list .icon { width: 20px; height: 20px; padding: 6px; box-sizing: content-box; background: rgba(255, 255, 255, .16); border-radius: 50%; }

.auth-form { display: flex; flex-direction: column; justify-content: center; gap: 20px; }

.auth-form h2 { font-size: 1.5rem; margin: 0 0 4px; }

.label-inline { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.label-inline a { font-size: .92rem; font-weight: 500; text-decoration: none; }

.label-inline a:hover { text-decoration: underline; }

/* Token / receipt blocks ---------------------------------------------------- */
.token-box { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .9rem; padding: 10px 14px; background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: var(--radius-sm); word-break: break-all; color: var(--ink); }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 960px) {
    .main, .auth-grid { grid-template-columns: 1fr; }
    .auth-grid { min-height: 0; }
    .auth-preview, .auth-form { padding: 32px 28px; }
}

@media (max-width: 680px) {
    .container { padding: 16px 14px 32px; }
    .header-row { flex-direction: column; align-items: stretch; padding: 22px 20px; }
    .header-actions { justify-content: stretch; }
    .header-actions > * { flex: 1; }
    .card, .panel { padding: 20px 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .event-header { flex-direction: column; gap: 8px; }
    .auth-preview h1 { font-size: 1.9rem; }
    th, td { padding: 11px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
    body { background: #fff; }
    .flash, .header-actions, .appfoot { display: none; }
}

@media (max-width: 680px) {
    .auth-feature-list { display: none; }
    .auth-preview { padding: 26px 22px; gap: 10px; }
    .auth-form { padding: 26px 22px; }
}

/* Let grid/flex children shrink so wide tables scroll inside .table-wrap instead of widening the page */
.container, .card, .panel, .dashboard-grid > *, .main > *, .grid-2 > *, .stack > * { min-width: 0; }

.table-wrap { max-width: 100%; }

@media (max-width: 680px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stat { padding: 14px 16px; }
    .stat .stat-value { font-size: 1.5rem; }
}

@media (max-width: 680px) {
    .table-wrap table { min-width: 620px; }
    .table-wrap { box-shadow: inset -12px 0 10px -12px rgba(15, 23, 42, .25); }
}
