/* BaselineHQ — Base Styles */

/* ── Transducer Font Family ── */
@font-face {
    font-family: 'Transducer';
    src: url('../fonts/transducer-normalregular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Transducer';
    src: url('../fonts/transducer-normalregularitalic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Transducer';
    src: url('../fonts/transducer-normalmedium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Transducer';
    src: url('../fonts/transducer-normalbold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Transducer';
    src: url('../fonts/transducer-normalblack.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Transducer Condensed';
    src: url('../fonts/transducer-condensedregular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Transducer Condensed';
    src: url('../fonts/transducer-condensedmedium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Transducer Condensed';
    src: url('../fonts/transducer-condensedbold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Transducer Condensed';
    src: url('../fonts/transducer-condensedblack.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-display: 'Transducer', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: 'Transducer', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-condensed: 'Transducer Condensed', 'Transducer', -apple-system, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;

    --primary: #0050ba;
    --primary-dark: #003d8f;
    --primary-light: #e8f0fe;
    --danger: #dc3545;
    --warning: #f0ad4e;
    --success: #28a745;
    --info: #17a2b8;
    --text: #1a1a2e;
    --text-muted: #6c757d;
    --bg: #f4f6f9;
    --white: #ffffff;
    --border: #dde1e7;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.15s ease;
}

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

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: #1a1a2e;
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.3px;
    padding: 1.1rem 1.25rem 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
}

.sidebar-nav { flex: 1; padding: 0.5rem 0; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1.25rem;
    color: #99a3b5;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
    border: none;
    border-left: 3px solid transparent;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
}
.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}
.sidebar-link.active {
    color: #fff;
    border-left-color: var(--primary);
    background: rgba(0,80,186,0.12);
    font-weight: 700;
}
.sidebar-link svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-sub {
    padding: 0.15rem 0 0.35rem;
}
.sidebar-sublink {
    display: block;
    padding: 0.35rem 1.25rem 0.35rem 3.1rem;
    color: #7a8499;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition);
}
.sidebar-sublink:hover { color: #fff; background: rgba(255,255,255,0.04); }
.sidebar-sublink.active { color: #fff; font-weight: 700; }

.sidebar-bottom {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 0.5rem 0;
    margin-top: auto;
    background: rgba(0,0,0,0.1);
}
.sidebar-logout { color: #7a8499; }
.sidebar-logout:hover { color: #ff8a8a; }

/* Sidebar layout offset */
body.has-sidebar main { margin-left: 220px; }
body.has-sidebar .messages { margin-left: 220px; }

/* ── Navbar (unauthenticated only) ── */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(0,40,100,0.15);
}

.nav-brand {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--white);
    text-decoration: none;
    letter-spacing: 0.3px;
}

.nav-links { display: flex; gap: 0.25rem; align-items: center; }
.nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.nav-links a:hover {
    color: var(--white);
    background: rgba(255,255,255,0.12);
}

/* ── Messages ── */
.messages { padding: 0 1.5rem; margin: 1rem 0; }

.alert {
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error, .alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Layout ── */
main { padding: 1.5rem; }

.content-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
}
.auth-container {
    max-width: 420px;
    margin: 2.5rem auto;
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0,0,0,0.04);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.header-actions { display: flex; gap: 0.5rem; align-items: center; }

h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    letter-spacing: -0.01em;
}
.subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--white);
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,80,186,0.1);
}
textarea.form-input { resize: vertical; }
.form-help { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 0.25rem; }

.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.form-checkbox { width: auto; }

.auth-link { margin-top: 1rem; text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.auth-link a { color: var(--primary); font-weight: 500; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    gap: 0.4rem;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 2px 4px rgba(0,50,140,0.2);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 3px 8px rgba(0,50,140,0.3); transform: translateY(-1px); }
.btn-secondary { background: var(--white); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c82333; }
.btn-warning { background: var(--warning); color: var(--text); }
.btn-small { padding: 0.25rem 0.55rem; font-size: 0.78rem; }
.btn-large { padding: 0.75rem 1.5rem; font-size: 0.95rem; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--warning); }

/* ── Status badges ── */
.status-badge {
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}
.status-ok { background: #d4edda; color: #155724; }
.status-warning { background: #fff3cd; color: #856404; }
.status-info { background: #d1ecf1; color: #0c5460; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-condensed);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-pending { background: #e2e8f0; color: #64748b; }
.badge-running { background: #dbeafe; color: #2563eb; }
.badge-completed { background: #d1fae5; color: #059669; }
.badge-failed { background: #fee2e2; color: #dc2626; }
.badge-self { background: var(--primary-light); color: var(--primary); }

.gc-data-badge {
    height: 1.1em; width: auto; vertical-align: middle;
    margin-left: 0.3rem; opacity: 0.85;
    border-radius: 3px;
}
.gc-data-badge:hover { opacity: 1; }

/* ── Info box ── */
.info-box {
    background: var(--primary-light);
    border: 1px solid #b3d4fc;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
}
.info-box ol { margin-left: 1.25rem; margin-top: 0.5rem; }
.info-box li { margin-bottom: 0.25rem; }
.info-box code { background: rgba(0,0,0,0.06); padding: 0.1rem 0.35rem; border-radius: var(--radius-sm); font-size: 0.82rem; font-family: var(--font-mono); }

/* ── Team grid ── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.team-card {
    display: block;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
}
.team-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary); transform: translateY(-2px); }

.team-card-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 0.5rem; }
.team-card-header h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.star { color: var(--warning); font-size: 1.1rem; }
.team-meta { font-size: 0.82rem; color: var(--text-muted); }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th {
    text-align: left;
    padding: 0.55rem 0.5rem;
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
    font-family: var(--font-condensed);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.data-table td { padding: 0.5rem; border-bottom: 1px solid var(--border); }
.data-table tr:hover { background: var(--primary-light); }

.text-error { color: var(--danger); font-size: 0.82rem; }

/* ── Progress bar ── */
.progress-container { text-align: center; }

.progress-bar-wrapper {
    width: 100%;
    height: 26px;
    background: #e9ecef;
    border-radius: 13px;
    overflow: hidden;
    margin: 2rem 0 1rem;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #4a90d9);
    border-radius: 13px;
    transition: width 0.3s ease;
    min-width: 0;
}

.progress-info { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-muted); }

/* ── Action buttons ── */
.action-buttons { display: flex; gap: 1rem; margin: 2rem 0; justify-content: center; flex-wrap: wrap; }
.report-info { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.5rem; }
.report-info p { margin-bottom: 0.25rem; }

/* ── Program header ── */
.program-header-info { display: flex; align-items: center; gap: 1rem; }
.program-logo { width: 48px; height: 48px; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow-sm); }
.program-logo-sm { width: 28px; height: 28px; border-radius: var(--radius-sm); object-fit: cover; }
.team-card-title-row { display: flex; align-items: center; gap: 0.5rem; }
.program-notes { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.5rem; }

/* ── Season cards ── */
.season-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    margin-bottom: 1rem;
    background: var(--white);
    transition: box-shadow var(--transition);
}
.season-card:hover { box-shadow: var(--shadow); }
.season-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.season-card-header h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; }
.season-card-actions { display: flex; gap: 0.5rem; }

.season-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.season-link-slot {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all var(--transition);
}
.season-link-slot.filled {
    border-style: solid;
    border-color: rgba(0,80,186,0.2);
    background: var(--primary-light);
}

.slot-label {
    font-family: var(--font-condensed);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.slot-team-name { font-size: 0.85rem; font-weight: 600; }
.slot-record { font-size: 0.78rem; color: var(--text-muted); }
.slot-empty { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }
.slot-actions { margin-top: 0.5rem; display: flex; gap: 0.25rem; justify-content: center; flex-wrap: wrap; }

/* ── Player status badges ── */
.badge-active { background: #d1fae5; color: #059669; }
.badge-unknown { background: #e2e8f0; color: #64748b; }
.badge-graduated { background: #fee2e2; color: #dc2626; }

/* ── Bulk actions bar ── */
.bulk-actions-bar {
    background: var(--primary-light);
    border: 1px solid #b3d4fc;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
}
.bulk-divider { color: var(--border); }

/* ── Sortable table headers ── */
.sortable-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-table th.sortable:hover { background: var(--primary-light); }
.sort-arrow { font-size: 0.6rem; color: var(--text-muted); margin-left: 0.15rem; }
.sort-arrow::after { content: "▲▼"; }
th.sort-asc .sort-arrow::after { content: "▲"; color: var(--primary); }
th.sort-desc .sort-arrow::after { content: "▼"; color: var(--primary); }
th.sort-asc .sort-arrow, th.sort-desc .sort-arrow { color: var(--primary); }

/* ── Roster filters ── */
.roster-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}
.roster-filters .form-input { flex: none; }
.roster-filters input[type="text"] { width: 200px; }
.roster-filters select { width: auto; min-width: 120px; }

/* ── Misc ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.danger-zone { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

pre { white-space: pre-wrap; word-break: break-word; font-size: 0.78rem; max-height: 300px; overflow-y: auto; font-family: var(--font-mono); }

/* ── Log panel ── */
.log-panel {
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-align: left;
}
.log-header {
    background: #1e1e2e;
    color: #ccc;
    padding: 0.4rem 0.75rem;
    font-family: var(--font-condensed);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.log-body {
    background: #1e1e2e;
    color: #d4d4d4;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
    padding: 0.75rem;
    max-height: 320px;
    overflow-y: auto;
}
.log-line { white-space: pre-wrap; }
.log-line:last-child { color: #4ec9b0; }

/* ══════════════════════════════════════════
   Responsive — iPad / Tablet / Phone
   ══════════════════════════════════════════ */

/* iPad landscape and smaller desktops */
@media (max-width: 1024px) {
    main { padding: 1rem; }
    .content-container { padding: 1.25rem; }
    .season-links-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .team-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .page-header { flex-direction: column; align-items: flex-start; }
    .header-actions { flex-wrap: wrap; }
}

/* Mobile menu toggle button — hidden by default, shown on small screens */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 201;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2.5px;
    background: white;
    border-radius: 2px;
}
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar.mobile-open ~ .mobile-overlay { display: block; }

/* iPad portrait / large phones */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        width: 220px;
        transition: left 0.25s ease;
        z-index: 200;
    }
    .sidebar.mobile-open { left: 0; }

    .mobile-menu-toggle { display: flex; }

    body.has-sidebar main { margin-left: 0; padding-top: 3.2rem; }
    body.has-sidebar .messages { margin-left: 0; }

    main { padding: 0.75rem; padding-top: 3.2rem; }
    .content-container { padding: 1rem; border-radius: var(--radius); }
    .auth-container { margin: 1rem; padding: 1.5rem; }

    h1 { font-size: 1.25rem; }
    h2 { font-size: 1.05rem; }

    .season-links-grid { grid-template-columns: 1fr; }
    .season-card { padding: 0.85rem; }
    .slot-actions { flex-direction: column; }
    .slot-actions .btn { font-size: 0.72rem; }

    .header-actions { width: 100%; justify-content: flex-start; }

    .data-table { font-size: 0.78rem; }
    .data-table th, .data-table td { padding: 0.35rem 0.3rem; }

    .hide-mobile { display: none; }

    .bulk-actions-bar { font-size: 0.72rem; gap: 0.35rem; }

    .team-grid { grid-template-columns: 1fr; }

    .btn { padding: 0.4rem 0.75rem; font-size: 0.82rem; }
    .btn-small { padding: 0.2rem 0.4rem; font-size: 0.72rem; }

    .roster-filters { flex-direction: column; }
    .roster-filters .form-input,
    .roster-filters input[type="text"],
    .roster-filters select { width: 100%; min-width: unset; }
}

/* Small phones */
@media (max-width: 480px) {
    body.has-sidebar main { margin-left: 0; }
    body.has-sidebar .messages { margin-left: 0; }

    main { padding: 0.5rem; padding-top: 3rem; }
    .content-container { padding: 0.75rem; border-radius: 0; }

    .program-header-info { flex-direction: column; gap: 0.5rem; }
    .program-logo { width: 36px; height: 36px; }

    .data-table th, .data-table td { padding: 0.25rem 0.2rem; font-size: 0.72rem; }
    .data-table input[type="url"] { min-width: 150px !important; font-size: 0.72rem; }

    .mobile-menu-toggle {
        top: 0.4rem;
        left: 0.5rem;
        width: 34px;
        height: 34px;
    }
}

/* ── Print ── */
@media print {
    .navbar, .sidebar, .header-actions, .btn, .bulk-actions-bar,
    .danger-zone, .roster-filters, form[id="pbr-form"],
    form[id="bulk-form"], .no-print { display: none !important; }
    body.has-sidebar main { margin-left: 0; }
    main { max-width: 100%; padding: 0; margin: 0; }
    .content-container { box-shadow: none; padding: 0; border: none; }
    body { background: white; font-size: 10pt; }
    .data-table { page-break-inside: auto; }
    .data-table tr { page-break-inside: avoid; }
}
