/* ============================================================
   Shrewsbury Little League — Admin Panel CSS
   ============================================================ */

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

:root {
    --brand:       #1a5c2a;   /* SLL green */
    --brand-dark:  #134421;
    --brand-light: #e8f4ec;
    --accent:      #e8a000;   /* gold */
    --danger:      #c0392b;
    --success:     #27ae60;
    --warn:        #e67e22;
    --text:        #222;
    --text-light:  #555;
    --border:      #ddd;
    --bg:          #f5f5f5;
    --white:       #fff;
    --nav-w:       220px;
    --radius:      6px;
    --shadow:      0 1px 3px rgba(0,0,0,.12);
}

body { font-family: system-ui, -apple-system, sans-serif; font-size: 15px;
       color: var(--text); background: var(--bg); line-height: 1.5; }

/* ---- Nav ---- */
.admin-nav {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--nav-w);
    background: var(--brand); color: #fff;
    display: flex; flex-direction: column;
    overflow-y: auto; z-index: 100;
}
.nav-brand { padding: 1.25rem 1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.15); }
.nav-brand a { color: #fff; text-decoration: none; font-weight: 700; font-size: 1rem; }
.nav-sub { display: block; font-size: .75rem; opacity: .7; margin-top: .2rem; }
.nav-links { list-style: none; padding: .5rem 0; flex: 1; }
.nav-links li a {
    display: block; padding: .6rem 1rem; color: rgba(255,255,255,.85);
    text-decoration: none; font-size: .9rem;
    border-left: 3px solid transparent;
    transition: background .15s;
}
.nav-links li.active a,
.nav-links li a:hover {
    background: rgba(255,255,255,.1); color: #fff;
    border-left-color: var(--accent);
}
.nav-divider { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid rgba(255,255,255,.15); }
.nav-hr { border-top: 1px solid rgba(255,255,255,.15); margin: .5rem 1rem; }
.nav-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.15); font-size: .8rem; }
.nav-user { display: block; color: rgba(255,255,255,.7); margin-bottom: .4rem; }
.nav-user em { font-style: normal; opacity: .6; }
.nav-logout { color: rgba(255,255,255,.8); text-decoration: none; font-size: .8rem; }
.nav-logout:hover { color: #fff; }

/* ---- Main content ---- */
.admin-main {
    margin-left: var(--nav-w);
    padding: 2rem;
    max-width: 1100px;
}
/* Pages with no sidebar nav at all (e.g. draft/live.php's anonymous
   share-link view) — without this, .admin-main keeps reserving 220px
   of blank space on the left for a nav that was never included. */
.no-nav .admin-main { margin-left: 0; margin-right: auto; }
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.admin-header h2 { font-size: 1.4rem; }

/* ---- Login page ---- */
.login-page { background: var(--brand); min-height: 100vh;
              display: flex; align-items: center; justify-content: center; }
.login-wrap { background: var(--white); border-radius: var(--radius);
              padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo h1 { color: var(--brand); font-size: 1.3rem; }
.login-logo p  { color: var(--text-light); font-size: .9rem; }

/* ---- Alerts ---- */
.alert { padding: .85rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .9rem; }
.alert ul { margin: .25rem 0 0 1.25rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-warn    { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* ---- Buttons ---- */
.btn {
    display: inline-block; padding: .5rem 1rem; border-radius: var(--radius);
    border: none; cursor: pointer; font-size: .875rem; font-weight: 500;
    text-decoration: none; transition: opacity .15s, background .15s;
    white-space: nowrap;
}
.btn:hover { opacity: .88; }
.btn-primary  { background: var(--brand);   color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-full     { width: 100%; text-align: center; }
.btn-sm       { padding: .3rem .7rem; font-size: .8rem; }
.btn-xs       { padding: .15rem .4rem; font-size: .75rem; }

/* ---- Forms ---- */
.admin-form   { max-width: 760px; }
.form-group   { margin-bottom: 1.25rem; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-bottom { align-items: end; }
.form-check   { display: flex; align-items: center; gap: .5rem; }
.form-check label { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap;
                margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
label         { display: block; font-size: .875rem; font-weight: 500;
                margin-bottom: .35rem; color: var(--text); }
input[type="text"], input[type="email"], input[type="url"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
    width: 100%; padding: .5rem .75rem; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: .9rem; color: var(--text);
    background: var(--white); transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26,92,42,.12);
}
textarea { resize: vertical; min-height: 120px; }
.required    { color: var(--danger); }
.field-hint  { font-size: .8rem; color: var(--text-light); margin-top: .3rem; }
.filter-bar  { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-bar select { width: auto; }

/* ---- Tables ---- */
.admin-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.admin-table th { text-align: left; padding: .6rem .75rem; background: var(--bg);
                  border-bottom: 2px solid var(--border); font-weight: 600; }
.admin-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:hover td { background: #fafafa; }
.row-inactive td { opacity: .55; }
.table-actions { white-space: nowrap; }
.table-actions .btn { margin-right: .25rem; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: .2rem .5rem; border-radius: 99px;
         font-size: .75rem; font-weight: 600; }
.badge-published   { background: #d4edda; color: #155724; }
.badge-draft       { background: #e2e3e5; color: #383d41; }
.badge-type-post         { background: #cce5ff; color: #004085; }
.badge-type-announcement { background: #fff3cd; color: #856404; }
.badge-type-event        { background: #d4edda; color: #155724; }
.badge-you         { background: var(--accent); color: #333; font-size: .7rem; }
.badge-role-superadmin   { background: #f8d7da; color: #721c24; }
.badge-role-editor       { background: #cce5ff; color: #004085; }
.badge-role-sponsor_mgr  { background: #fff3cd; color: #856404; }
.badge-role-field_status { background: #d4edda; color: #155724; }

/* ---- Dashboard ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
             gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 1.25rem 1rem;
             box-shadow: var(--shadow); text-align: center; border-top: 3px solid var(--brand); }
.stat-card.stat-warn  { border-top-color: var(--warn); }
.stat-card.stat-alert { border-top-color: var(--danger); }
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--brand); }
.stat-label  { font-size: .8rem; color: var(--text-light); }
.quick-actions { margin-bottom: 2rem; }
.quick-actions h3 { margin-bottom: .75rem; }
.action-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.dashboard-section { margin-top: 2rem; }
.dashboard-section h3 { margin-bottom: .75rem; }
.pin-icon { margin-right: .25rem; }

/* Used as a plain wrapper on several pages (draft/index.php, clinics/
   edit.php + players.php, division-overrides/index.php, coaching/team.php)
   but had no actual style until now — a tinted card visually separates a
   page's controls from its main content/board underneath. */
.admin-panel { background: var(--brand-light); border: 1px solid var(--border);
               border-radius: var(--radius); padding: 1.25rem 1.5rem; }

/* Draft board's upper controls (draft/session.php) — rows of consistent
   height/gap instead of one loose flex-wrap, so buttons of different
   widths don't create ragged spacing between rows. */
/* align-items: stretch (not center) so both columns share the same
   height — needed for the filter row / QR action row to line up at
   the same bottom edge via margin-top: auto below. */
.draft-controls { display: flex; gap: 2rem; align-items: stretch; flex-wrap: wrap; }
.draft-controls-main { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: .75rem; }
.draft-controls-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.draft-controls-row-bottom { margin-top: auto; }
.draft-controls-label { font-size: .75rem; color: var(--text-light); white-space: nowrap; }
/* flexbox column + align-items:center rather than text-align:center —
   the QR library's own output (table/canvas, depending on browser support)
   is block-level and text-align doesn't reliably center that; flex
   alignment centers it regardless of what element it turns out to be. */
.draft-controls-qr { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.draft-qr-caption { margin: 0 0 .4rem; }
.draft-qr-actions { display: flex; gap: .5rem; margin-top: auto; padding-top: .5rem; }

/* ---- Field cards ---- */
.field-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.field-card  { background: var(--white); border-radius: var(--radius);
               padding: 1.25rem; box-shadow: var(--shadow);
               border-left: 5px solid var(--success); }
.field-card.field-closed { border-left-color: var(--danger); }
.field-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.field-card-header h3 { font-size: 1rem; }
.field-badge { font-size: .85rem; font-weight: 600; }
.field-address { font-size: .85rem; color: var(--text-light); margin-bottom: .5rem; }
.field-note    { font-size: .85rem; background: #fff3cd; padding: .35rem .6rem;
                 border-radius: var(--radius); margin-bottom: .5rem; }
.field-updated { font-size: .75rem; color: var(--text-light); margin-bottom: .75rem; }

/* ---- Sponsor & alumni thumbs ---- */
.sponsor-thumb, .alumni-thumb { width: 50px; height: 40px; object-fit: contain; }
.current-logo, .current-photo { margin-bottom: .75rem; }
.current-logo p, .current-photo p { font-size: .8rem; color: var(--text-light); margin-bottom: .3rem; }
.logo-preview  { max-width: 160px; max-height: 80px; object-fit: contain;
                 border: 1px solid var(--border); padding: 4px; }
.photo-preview { width: 100px; height: 100px; object-fit: cover; border-radius: var(--radius); }
.no-logo, .no-photo { font-size: .75rem; color: var(--text-light); }
.tier-heading  { font-size: 1rem; margin: 1.5rem 0 .5rem; text-transform: uppercase;
                 letter-spacing: .05em; }
.tier-gold   { color: #856404; }
.tier-silver { color: #495057; }
.tier-bronze { color: #7d4a00; }
.sponsor-tier-section { margin-bottom: 2rem; }

/* ---- Division checks (fields admin) ---- */
.division-checks { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .4rem; }
.division-checks label { display: flex; align-items: center; gap: .3rem;
                         font-size: .85rem; cursor: pointer; font-weight: normal; }

/* ---- FAQ section ---- */
.faq-section { margin-bottom: 2rem; }
.faq-section h3 { margin-bottom: .5rem; }

/* ---- Empty states ---- */
.empty-state    { color: var(--text-light); padding: 2rem; text-align: center; }
.empty-state-sm { color: var(--text-light); font-size: .875rem; padding: .5rem 0; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .admin-nav  { width: 100%; position: static; height: auto; }
    .admin-main { margin-left: 0; padding: 1rem; }
    .form-row   { grid-template-columns: 1fr; }
    .field-cards { grid-template-columns: 1fr; }
    .stat-grid  { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Instagram import panel ---- */
.ig-import-panel {
    background: #f0f7ff;
    border: 1px solid #c8dff7;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.ig-import-heading {
    font-size: .9rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: .3rem;
}
.ig-import-hint {
    font-size: .82rem;
    color: var(--text-light);
    margin-bottom: .75rem;
}
.ig-import-row {
    display: flex;
    gap: .5rem;
}
.ig-import-row input {
    flex: 1;
    font-size: .875rem;
    padding: .45rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.ig-status {
    font-size: .82rem;
    margin-top: .5rem;
    min-height: 1.2em;
    color: var(--text-light);
}
.ig-status.success { color: #1a7a3c; }
.ig-status.error   { color: #c0392b; }

/* ============================================================
   Draft tool additions — consolidated (replaces three earlier
   separate snippets: badge/alert aliases, layout, mobile swipe).
   Order inside this file matters: base rules first, mobile
   overrides last, so the cascade resolves correctly regardless
   of where this block sits in the overall admin.css file.
   ============================================================ */

/* ---- Alert/badge aliases (names used by draft markup that don't
   exist in the base stylesheet: alert-error/alert-warn and
   badge-published/draft/type-*/you/role-* are the real names) ---- */
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.badge-setup       { background: #e2e3e5; color: #383d41; }
.badge-in_progress { background: #cce5ff; color: #004085; }
.badge-complete    { background: #d4edda; color: #155724; }
.badge-coach-hc { background: #f8d7da; color: #721c24; } /* head coach's kid — deliberately bolder than assistant */
.badge-coach-ac { background: #fff3cd; color: #856404; } /* assistant coach's kid */
.draft-badge { margin-left: .35rem; font-size: .7rem; padding: .1rem .4rem; vertical-align: middle; }

/* ---- Draft board layout (shared by session.php and live.php) ---- */
.draft-layout { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.draft-pool { flex: 0 0 260px; }
.draft-teams { flex: 1; display: flex; gap: 1rem; flex-wrap: wrap; }
.draft-team-column { flex: 1 1 200px; min-width: 200px; border: 1px solid #ddd; border-radius: 6px; padding: 0.5rem; min-height: 200px; }
.draft-team-column.drag-over { background: #f0f6ff; border-color: #1a2d5a; }
.draft-team-column h4 { border-left: 6px solid #ccc; padding-left: 0.5rem; margin-top: 0; }
.draft-card { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 0.5rem; margin-bottom: 0.5rem; cursor: grab; position: relative; }
.draft-card-name { font-weight: 600; }
.draft-card-scores { font-size: 0.85rem; color: #555; }
.draft-card-remove { position: absolute; top: 2px; right: 4px; border: none; background: none; font-size: 1rem; cursor: pointer; color: #999; }
.draft-card-remove:hover { color: #c0392b; }
.draft-icon-badge { display: inline-block; font-size: 1.1rem; line-height: 1; margin-left: .3rem;
                     background: #f0f0f0; border-radius: 50%; padding: .2rem .3rem; vertical-align: middle; cursor: help; }
#pool-cards { max-height: 70vh; overflow-y: auto; }

/* ---- Mobile swipe carousel: pool + team panels as swipeable pages ----
   Declared LAST and inside the media query so these overrides win
   the cascade against the unconditional rules above on narrow screens. */
.draft-tabs { display: none; }

@media (max-width: 640px) {
    .draft-tabs {
        display: flex;
        gap: .4rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: .5rem;
        margin-bottom: .5rem;
        scrollbar-width: none;
    }
    .draft-tabs::-webkit-scrollbar { display: none; }
    .draft-tabs button {
        flex: 0 0 auto;
        padding: .4rem .8rem;
        border-radius: 999px;
        border: 1px solid var(--border);
        background: #fff;
        font-size: .8rem;
        white-space: nowrap;
        cursor: pointer;
    }
    .draft-tabs button.active {
        background: var(--brand);
        color: #fff;
        border-color: var(--brand);
    }

    .draft-layout {
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    .draft-teams { display: contents; }

    /* min-width:100% (not just flex-basis) forces full-width panels even
       inside a nowrap flex row with overflow — this is what actually
       stops "continuous strip" and forces one-panel-per-screen paging. */
    .draft-panel {
        flex: 0 0 100%;
        min-width: 100%;
        scroll-snap-align: start;
    }
}

/* ============================================================
   Admin rebrand — navy/gold to match the public site, instead of
   green. Redefining --brand/--accent here (after the original
   :root block) cascades everywhere those variables are already
   used — every .btn-primary, focus ring, stat-card border, etc.
   across all admin pages — without editing those pages at all.
   REPLACES the earlier nav-only color patch (--nav-navy/--nav-gold);
   remove that block if it's still in admin.css.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@600;700&display=swap');

:root {
    --brand:       #1a2d5a; /* was green #1a5c2a — now site navy */
    --brand-dark:  #111e3d; /* was #134421 — now site navy-dark */
    --brand-light: #eef1f7; /* was light green — now light navy tint */
    --accent:      #c9a84c; /* was orange-gold #e8a000 — now site gold */
}

/* ---- Nav: logo badge + collapsible section groups ---- */
.nav-brand a { display: flex; align-items: center; gap: .55rem; }

.nav-logo-img { height: 36px; width: auto; flex-shrink: 0; }

.nav-section-label {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%;
    background: none; border: none; border-left: 3px solid transparent;
    cursor: pointer;
    padding: .6rem 1rem;
    font-family: 'Oswald', system-ui, sans-serif;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.55);
    font-weight: 700;
}
.nav-section-label:hover { color: rgba(255,255,255,.8); }
.nav-section-label .chevron {
    width: 6px; height: 6px;
    border-right: 2px solid rgba(255,255,255,.5);
    border-bottom: 2px solid rgba(255,255,255,.5);
    transform: rotate(45deg);
    transition: transform .15s;
    flex-shrink: 0;
}
.nav-section.collapsed .nav-section-label .chevron { transform: rotate(-45deg); }
.nav-section-items { overflow: hidden; }
.nav-section.collapsed .nav-section-items { display: none; }

/* Softball Rules — a real link (not a collapsible toggle), but
   typeset like the nav-section-label headers rather than the plain
   Dashboard/My Teams links, since it reads as a reference area rather
   than an editing tool. */
.nav-links li a.nav-label-style {
    font-family: 'Oswald', system-ui, sans-serif;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    color: rgba(255,255,255,.55);
}