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

:root {
    --navy: #0f172a;
    --navy-light: #1e293b;
    --indigo: #6366f1;
    --indigo-dark: #4f46e5;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --red: #ef4444;
    --green: #22c55e;
    --yellow: #eab308;
    --gold: #f59e0b;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
}

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

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
    background: var(--navy);
    color: var(--white);
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
}
.nav-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-brand {
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}
.nav-brand:hover { text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-user { color: var(--gray-300); font-size: .875rem; }
.nav-link { color: var(--gray-300); font-size: .875rem; }
.nav-link:hover { color: var(--white); }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
    background: var(--navy);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-md);
}
.login-title {
    text-align: center;
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: .25rem;
}
.login-subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
    font-size: .875rem;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: .35rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .875rem;
    transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}
.btn:hover { opacity: .9; }
.btn-primary { background: var(--indigo); color: var(--white); }
.btn-primary:hover { background: var(--indigo-dark); opacity: 1; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; background: var(--gray-100); color: var(--gray-700); }
.btn-sm:hover { background: var(--gray-200); }
.btn-full { width: 100%; }
.btn-danger { background: var(--red); color: var(--white); }

/* ── Alert ────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Dashboard ────────────────────────────────────────────── */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.dashboard-header h1 { font-size: 1.5rem; color: var(--navy); }

.filters-bar {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.filter-input, .filter-select {
    padding: .45rem .75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .8rem;
    background: var(--white);
}
.filter-input { flex: 1; min-width: 180px; }
.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--indigo);
}

/* ── School Cards Grid ────────────────────────────────────── */
.schools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 1024px) { .schools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .schools-grid { grid-template-columns: 1fr; } }

.school-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: box-shadow .15s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.school-card:hover { box-shadow: var(--shadow-md); }

.card-top { display: flex; align-items: center; gap: .75rem; }
.card-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--indigo);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.card-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.card-title { font-weight: 600; font-size: .95rem; color: var(--navy); line-height: 1.3; }
.card-location { font-size: .8rem; color: var(--gray-500); }

.card-stats {
    display: flex;
    gap: .75rem;
    font-size: .78rem;
    color: var(--gray-600);
    flex-wrap: wrap;
}
.card-stats span { white-space: nowrap; }

.card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-ncaa1 { background: #dbeafe; color: #1e40af; }
.badge-ncaa2 { background: #dcfce7; color: #166534; }
.badge-ncaa3 { background: #ffedd5; color: #9a3412; }
.badge-naia  { background: #f3e8ff; color: #6b21a8; }
.badge-club  { background: var(--gray-100); color: var(--gray-600); }
.badge-none  { background: var(--gray-100); color: var(--gray-400); }
.badge-muted { background: var(--gray-100); color: var(--gray-600); font-size: .65rem; }

.badge-status {
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 500;
}
.status-suggested      { background: #e0f2fe; color: #075985; }
.status-following      { background: #fef3c7; color: #92400e; }
.status-applying       { background: #ede9fe; color: #5b21b6; }
.status-applied        { background: #ede9fe; color: #5b21b6; }
.status-enrolled       { background: #d1fae5; color: #065f46; }
.status-not_interested { background: #fee2e2; color: #991b1b; }

/* ── Stars ────────────────────────────────────────────────── */
.stars { display: inline-flex; gap: 1px; }
.star { font-size: .85rem; }
.star-filled-high { color: var(--gold); }
.star-filled-med  { color: var(--yellow); }
.star-filled-low  { color: var(--gray-400); }
.star-empty { color: var(--gray-200); }

.stars-input { display: inline-flex; gap: 2px; cursor: pointer; }
.stars-input .star { font-size: 1.4rem; cursor: pointer; transition: color .1s; }
.stars-input .star:hover { color: var(--gold) !important; }

/* ── Modal ────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
}
.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    width: 95%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h2 { font-size: 1.1rem; color: var(--navy); }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0 .25rem;
}
.modal-body { padding: 1.25rem 1.5rem; }

.search-row { display: flex; gap: .5rem; }
.search-row .filter-input { flex: 1; }

/* ── Scorecard Results ────────────────────────────────────── */
.scorecard-results { margin-top: 1rem; }
.scorecard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: .5rem;
    transition: background .1s;
}
.scorecard-item:hover { background: var(--gray-50); }
.scorecard-name { font-weight: 500; font-size: .9rem; }
.scorecard-loc { font-size: .8rem; color: var(--gray-500); }
.scorecard-rate { font-size: .8rem; color: var(--gray-500); }

/* ── Detail Page ──────────────────────────────────────────── */
.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: .875rem;
    color: var(--gray-500);
}
.back-link:hover { color: var(--indigo); }

.detail-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.detail-logo {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    background: var(--indigo);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.75rem;
    flex-shrink: 0;
}
.detail-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.detail-title h1 { font-size: 1.5rem; color: var(--navy); }
.detail-location { color: var(--gray-500); font-size: .9rem; }
.detail-website { font-size: .85rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .75rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    text-align: center;
}
.stat-label { font-size: .75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .25rem; }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--navy); }

.section-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.section-card h2 {
    font-size: 1rem;
    color: var(--navy);
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--gray-100);
}

.entry-controls { display: flex; gap: 1.5rem; align-items: flex-end; margin-bottom: 1rem; }
.all-entries { font-size: .85rem; color: var(--gray-600); }
.all-entries .entry-row { margin-bottom: .35rem; }

/* ── Tags ─────────────────────────────────────────────────── */
.tags-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--white);
}
.tag-remove {
    cursor: pointer;
    opacity: .7;
    font-size: .7rem;
}
.tag-remove:hover { opacity: 1; }
.tag-add-row { display: flex; gap: .5rem; align-items: center; }
.tag-add-row input[type="text"] {
    padding: .35rem .6rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .8rem;
    width: 180px;
}
.tag-add-row input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
}

/* ── Majors ───────────────────────────────────────────────── */
.majors-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.major-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-700);
}
.major-remove { cursor: pointer; opacity: .5; font-size: .7rem; }
.major-remove:hover { opacity: 1; }

/* ── Notes ────────────────────────────────────────────────── */
.notes-feed { margin-bottom: 1rem; }
.note-item {
    padding: .75rem 0;
    border-bottom: 1px solid var(--gray-100);
}
.note-item:last-child { border-bottom: none; }
.note-meta { font-size: .78rem; color: var(--gray-500); margin-bottom: .25rem; }
.note-meta strong { color: var(--gray-700); }
.note-text { font-size: .875rem; white-space: pre-wrap; }

.note-form { display: flex; flex-direction: column; gap: .5rem; }
.note-form textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .875rem;
    resize: vertical;
}
.note-form textarea:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ── Lacrosse Info Display ────────────────────────────────── */
.lax-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem .75rem;
    font-size: .875rem;
    margin-bottom: .75rem;
}
.lax-info-grid .lax-label { color: var(--gray-500); font-size: .78rem; }
.lax-info-grid .lax-value { color: var(--gray-800); }

.edit-form { margin-top: .75rem; }

/* ── Rankings ────────────────────────────────────────────── */
.badge-ranking {
    background: #fef3c7;
    color: #92400e;
    font-weight: 700;
}
.ranking-badge-large {
    display: inline-block;
    font-size: .95rem;
    font-weight: 600;
    color: var(--navy);
}
.ranking-history-item {
    display: inline-block;
    padding: .1rem .4rem;
    margin: .15rem .25rem .15rem 0;
    border-radius: var(--radius);
    background: var(--gray-100);
    font-size: .72rem;
    color: var(--gray-600);
}

/* ── Major Groups ────────────────────────────────────────── */
.major-group { margin-bottom: .5rem; }
.major-group-letter {
    font-size: .7rem;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .2rem;
}
.major-group-items { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ── Loading ──────────────────────────────────────────────── */
.loading { text-align: center; padding: 2rem; color: var(--gray-400); font-size: .9rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state p { margin-top: .5rem; font-size: .9rem; }
