/* ── Base ─────────────────────────────────────────────── */
:root {
    --brand-color: #1d50d4;
    --brand-hover: #1642b8;
    --brand-light: #eef2ff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-subtle: #f8fafc;
    --bg-white: #ffffff;
    --radius: 0.625rem;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

html { font-size: 16px; height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    color: var(--text-primary);
    background: var(--bg-subtle);
    min-height: 100%;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-color); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }

/* ── Header ───────────────────────────────────────────── */
.site-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Accent stripe at very top */
.site-header::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-color), #7c3aed);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-primary) !important;
    letter-spacing: -0.03em;
    text-decoration: none !important;
}

.brand-hash { color: var(--brand-color); }

.nav-link {
    color: var(--text-muted) !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.7rem !important;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
    color: var(--text-primary) !important;
    background: var(--bg-subtle);
    text-decoration: none;
}

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-white);
    margin-top: auto;
}

/* ── Page wrapper ─────────────────────────────────────── */
.container.py-4 { padding-top: 2rem !important; padding-bottom: 3rem !important; }

/* ── List view — the main event ───────────────────────── */
.list-view-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.list-view-header {
    padding: 2rem 2rem 1.75rem;
    border-bottom: 3px solid var(--brand-color);
    background: linear-gradient(160deg, #eef2ff 0%, #f5f3ff 55%);
    position: relative;
}

.list-view-header::after {
    content: '#';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 6rem;
    font-weight: 900;
    color: var(--brand-color);
    opacity: 0.06;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.top-list-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    position: relative;
}

.top-list-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.4rem;
    align-items: center;
    position: relative;
}

.top-list-meta a { color: var(--brand-color); font-weight: 600; }
.top-list-meta a:hover { text-decoration: underline; }
.top-list-meta .meta-sep { color: var(--border-color); }

.top-list-ol {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: list-counter;
}

.top-list-ol li {
    counter-increment: list-counter;
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s;
}

.top-list-ol li:last-child { border-bottom: none; }
.top-list-ol li:hover { background: #fafbff; }

.top-list-ol li::before {
    content: counter(list-counter);
    font-size: 1.4rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: var(--brand-color);
    opacity: 0.3;
    min-width: 4.5rem;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
    border-right: 1px solid var(--border-color);
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
}

/* First item stands out — full color, larger */
.top-list-ol li:nth-child(1)::before {
    opacity: 1;
    font-size: 1.65rem;
    background: var(--brand-light);
    color: var(--brand-color);
}

.top-list-item-text {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    padding: 1.1rem 1.5rem;
    display: flex;
    align-items: center;
}

/* ── Cards (index/profile list cards) ────────────────── */
.list-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.85rem 1.2rem;
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.list-card--ranked {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.85rem 1.2rem;
}

.list-card-rank {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--brand-color);
    opacity: 0.2;
    line-height: 1.2;
    min-width: 1.75rem;
    text-align: center;
    flex-shrink: 0;
    padding-top: 0.05rem;
    font-variant-numeric: tabular-nums;
}

.list-card--ranked:first-child .list-card-rank { opacity: 1; }

.list-card-body { flex: 1; min-width: 0; }

.list-card:hover {
    border-color: var(--brand-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.list-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    display: block;
}

.list-card-title:hover { color: var(--brand-color); text-decoration: none; }
.list-card-meta { font-size: 0.78rem; color: var(--text-muted); }

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar-section {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.sidebar-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.9rem 1.1rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-subtle);
    margin: 0;
}

.sidebar-list { margin: 0; padding: 0.3rem 0; }

.sidebar-list li {
    padding: 0;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-list li:last-child { border-bottom: none; }

.sidebar-list-link {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.55rem 1.1rem 0.15rem;
}

.sidebar-list-link:hover { color: var(--brand-color); text-decoration: none; }

.sidebar-list-preview {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.1rem 1.1rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.sidebar-list-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0 1.1rem 0.55rem;
}

/* ── Forms ────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: 0.875rem; margin-bottom: 0.35rem; }

.form-control, .form-select {
    border-color: var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--bg-white);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(29, 80, 212, 0.12);
}

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

/* ── Buttons ──────────────────────────────────────────── */
.btn { font-weight: 500; border-radius: var(--radius); }

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

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

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

/* ── Page heading ─────────────────────────────────────── */
.page-heading {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

/* ── Auth card ────────────────────────────────────────── */
.auth-card {
    max-width: 420px;
    margin: 2.5rem auto;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem 2.25rem;
}

.auth-card-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
}

/* ── Hero ─────────────────────────────────────────────── */
.hero-section {
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
    border: 1px solid var(--border-color);
    border-radius: calc(var(--radius) * 1.5);
    padding: 2.5rem 2rem;
}

.hero-preview-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transform: rotate(1.5deg);
    width: 100%;
    max-width: 240px;
}

.hero-preview-header {
    background: linear-gradient(160deg, #eef2ff 0%, #f5f3ff 55%);
    border-bottom: 3px solid var(--brand-color);
    padding: 0.8rem 1rem;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.hero-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: preview-rank;
}

.hero-preview-list li {
    counter-increment: preview-rank;
    display: flex;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-primary);
    gap: 0.6rem;
}

.hero-preview-list li:last-child { border-bottom: none; }

.hero-preview-list li::before {
    content: counter(preview-rank);
    font-size: 1rem;
    font-weight: 900;
    color: var(--brand-color);
    opacity: 0.25;
    min-width: 1.2rem;
    text-align: center;
    flex-shrink: 0;
}

.hero-preview-list li:first-child::before { opacity: 1; }

.hero-badge {
    display: inline-block;
    background: var(--brand-color);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.hero-highlight {
    color: var(--brand-color);
    position: relative;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 38ch;
}

/* ── Section headings ─────────────────────────────────── */
.section-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.section-heading-icon { font-size: 1rem; }

/* ── List card preview ────────────────────────────────── */
.list-card-preview {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0.5rem;
    counter-reset: preview-counter;
}

.list-card-preview li {
    counter-increment: preview-counter;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.list-card-preview li::before {
    content: counter(preview-counter);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-color);
    opacity: 0.5;
    min-width: 1rem;
    text-align: right;
    flex-shrink: 0;
}

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--bg-white);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state-text { color: var(--text-muted); margin-bottom: 1rem; }

/* ── FAQ ──────────────────────────────────────────────── */
.faq-body { padding: 0.75rem 1.1rem; }
.faq-item { padding-bottom: 0.9rem; margin-bottom: 0.9rem; border-bottom: 1px solid var(--border-color); }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.faq-question { font-weight: 700; font-size: 0.875rem; margin-bottom: 0.3rem; color: var(--text-primary); }
.faq-answer { font-size: 0.8rem; color: var(--text-muted); margin: 0; line-height: 1.55; }

/* ── Reorder buttons (Edit page) ─────────────────────── */
.reorder-btn {
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1.3;
    min-width: 1.8rem;
}

/* ── Pagination ───────────────────────────────────────── */
.pagination { font-size: 0.85rem; }

/* ── Validation ───────────────────────────────────────── */
.validation-summary-errors ul { margin-bottom: 0; padding-left: 1.25rem; }

/* ── Utilities ────────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.min-w-0 { min-width: 0; }
