/* ── CSS Custom Properties (defaults — overridden by JS branding) ── */
:root {
    --primary-color: #1a2744;
    --accent-color: #e8293c;
    --bg-light: #f8f9fa;
    --text-muted: #5c636a;
    --nav-dark: #1a2744;
    --bracket-bg: #1a2744;
    --bracket-label: #8a9aba;
    --bracket-tbd: #909090;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-light);
}

/* WCAG AA: Boost .text-muted contrast on light backgrounds (4.5:1 minimum) */
.text-muted {
    color: var(--text-muted) !important;
}

main {
    flex: 1;
}

/* ── Skip Navigation (WCAG) ──────────────────────────────────── */

.skip-nav {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--primary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 9999;
    font-weight: 600;
    text-decoration: none;
    border-bottom-right-radius: 0.375rem;
    transition: top 0.15s ease;
}
.skip-nav:focus {
    top: 0;
}

/* ── Focus Indicators (WCAG AA) ──────────────────────────────── */

*:focus-visible {
    outline: 3px solid #4a6fa5;
    outline-offset: 2px;
}

.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid #4a6fa5;
    outline-offset: 2px;
}

/* Dark-background focus fix */
.navbar-dark .nav-link:focus-visible,
.bg-dark .btn:focus-visible {
    outline-color: #7aa2e0;
}

/* ── Table accessibility ─────────────────────────────────────── */

.table th[scope="col"] {
    white-space: nowrap;
}

/* ── Reduced motion preference ───────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── League Store Button ──────────────────────────────────────── */

.league-store-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
    color: #fff !important;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2e4a8a 60%, #1a3a6e 100%);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 8px rgba(26,39,68,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    position: relative;
    overflow: hidden;
}

.league-store-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, rgba(255,255,255,0) 40%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0) 60%);
    background-size: 200% 100%;
    background-position: 200% 0;
    transition: background-position 0.4s ease;
}

.league-store-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(26,39,68,0.45), inset 0 1px 0 rgba(255,255,255,0.18);
    background: linear-gradient(135deg, #1e2f54 0%, #3558a8 60%, #1e4a88 100%);
}

.league-store-btn:hover::before {
    background-position: -200% 0;
}

.league-store-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(26,39,68,0.3);
}

.league-store-btn i {
    font-size: 0.95em;
    opacity: 0.9;
}

.signup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 2rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    position: relative;
    overflow: hidden;
}

.signup-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, rgba(255,255,255,0) 40%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0) 60%);
    background-size: 200% 100%;
    background-position: 200% 0;
    transition: background-position 0.4s ease;
}

.signup-btn:hover {
    transform: translateY(-1px);
    color: #fff !important;
}

.signup-btn:hover::before {
    background-position: -200% 0;
}

.signup-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.signup-btn i {
    font-size: 0.95em;
    opacity: 0.9;
}

.signup-btn-red {
    background: linear-gradient(135deg, var(--accent-color) 0%, #e8293c 60%, #b80e1e 100%);
}
.signup-btn-red:hover {
    background: linear-gradient(135deg, #d4182b 0%, #f03247 60%, #cc1020 100%);
    box-shadow: 0 4px 16px rgba(180,10,30,0.45), inset 0 1px 0 rgba(255,255,255,0.18);
}

.signup-btn-navy {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2e4a8a 60%, #1a3a6e 100%);
}
.signup-btn-navy:hover {
    background: linear-gradient(135deg, #1e2f54 0%, #3558a8 60%, #1e4a88 100%);
    box-shadow: 0 4px 16px rgba(26,39,68,0.45), inset 0 1px 0 rgba(255,255,255,0.18);
}

.official-ac-item:hover, .official-ac-item.bg-light {
    background: #e8f0fe !important;
}

.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
    border: none;
    margin-bottom: 1rem;
}

.card-header {
    background-color: var(--primary-color);
    color: #ffffff;
    border-bottom: 2px solid #2e4a7a;
    font-weight: 600;
}

.table th {
    background-color: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
}

.player-photo {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
}

.player-photo-lg {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,.1);
}

.team-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.team-logo-lg {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

.stats-card {
    text-align: center;
    padding: 1rem;
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
    color: #0d6efd;
}

.stats-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 600;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-highlight:hover {
    background-color: #f0f4ff;
    cursor: pointer;
}

/* ── Mobile Responsive ─────────────────────────────────────────── */

/* Prevent horizontal overflow from tables */
html, body {
    overflow-x: hidden;
}

/* Make table-responsive scroll containers more obvious on mobile */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* ── Toast Notifications ────────────────────────────────────── */

#toast-container .toast {
    min-width: 280px;
    max-width: 420px;
    border-left: 4px solid;
    font-size: 0.9rem;
}
#toast-container .toast.toast-success { border-left-color: #198754; }
#toast-container .toast.toast-danger  { border-left-color: #dc3545; }
#toast-container .toast.toast-warning { border-left-color: #ffc107; }
#toast-container .toast.toast-info    { border-left-color: #0d6efd; }

#toast-container .toast .toast-body {
    padding: 0.65rem 1rem;
    word-break: break-word;
}
#toast-container .toast .btn-close {
    opacity: 0.5;
}
#toast-container .toast .btn-close:hover {
    opacity: 1;
}

@media (max-width: 575.98px) {
    #toast-container {
        left: 0; right: 0;
        padding: 0.5rem;
    }
    #toast-container .toast {
        min-width: unset;
        max-width: 100%;
        width: 100%;
    }
}

/* ── Form Validation ────────────────────────────────────────── */

.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12'%3e%3ccircle cx='6' cy='6' r='4.5' fill='%23dc3545'/%3e%3cpath stroke='white' stroke-width='2' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='white'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}
.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: #198754;
}

/* Smaller fonts on mobile for data-heavy tables */
@media (max-width: 575.98px) {
    .table {
        font-size: 0.78rem;
    }

    .table th, .table td {
        padding: 0.25rem 0.35rem;
    }

    /* Shrink player photos on mobile */
    .player-photo {
        width: 40px;
        height: 40px;
    }

    .player-photo-lg {
        width: 100px;
        height: 100px;
    }

    .team-logo-lg {
        width: 64px;
        height: 64px;
    }

    /* Stats values smaller on mobile */
    .stats-value {
        font-size: 1.5rem;
    }

    /* Stack team detail header vertically */
    .display-5 {
        font-size: 1.75rem;
    }

    /* Make navbar brand smaller */
    .navbar-brand {
        font-size: 0.95rem;
    }

    /* Reduce card header font sizes */
    .card-header h5, .card-header h6 {
        font-size: 0.9rem;
    }

    /* Ensure buttons wrap on mobile */
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }

    /* Notification panel full width on mobile */
    .notif-dropdown {
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 70vh;
        border-radius: 0 !important;
    }
}

@media (max-width: 767.98px) {
    /* Stack side-by-side filter bars vertically */
    .d-flex.flex-wrap.gap-2,
    .d-flex.flex-wrap.gap-3 {
        gap: 0.5rem;
    }

    /* Full-width form selects on small screens */
    .form-select-sm,
    .form-control-sm {
        font-size: 0.82rem;
    }

    /* Season/team filter bars should wrap */
    .d-flex.align-items-center.gap-2 {
        flex-wrap: wrap;
    }

    /* Stack the schedule iCal card */
    #ical-team-select,
    #ical-season-select {
        width: 100% !important;
    }

    /* Team cards full width on tablet */
    .col-md-4.mb-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Scorekeeper form: stack period goal inputs on very small screens */
@media (max-width: 400px) {
    #sk-home-p1, #sk-home-p2, #sk-home-p3,
    #sk-away-p1, #sk-away-p2, #sk-away-p3 {
        font-size: 0.85rem;
    }
}

.nav-link.active {
    font-weight: bold;
    border-bottom: 2px solid #fff;
}

/* ── Help System ──────────────────────────────────────────────────────────── */

.help-tutorial-card {
    border-top: 3px solid #0d6efd;
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.help-tutorial-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.help-tutorial-card.audience-public  { border-top-color: #198754; }
.help-tutorial-card.audience-staff   { border-top-color: #0d6efd; }
.help-tutorial-card.audience-admin   { border-top-color: #dc3545; }

.help-step-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.help-step-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.9rem;
}
.help-step-list .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: #e9ecef;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.help-step-list .step-icon {
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
    color: #6c757d;
}

.help-tip-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 0.6rem 1rem;
    border-radius: 0.375rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.help-video-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 0.375rem;
}
.help-video-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0.375rem;
}

.faq-admin-controls {
    display: inline-flex;
    gap: 0.25rem;
}
.faq-admin-controls .btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
}

/* ── Legal Pages (Privacy / Terms) ─────────────────────────────────────────── */
.legal-page-content h2 { font-size: 1.5rem; margin-bottom: 0.75rem; color: var(--primary-color); }
.legal-page-content h3 { font-size: 1.1rem; margin-top: 1.25rem; margin-bottom: 0.5rem; color: var(--primary-color); }
.legal-page-content p { margin-bottom: 0.75rem; line-height: 1.6; }
.legal-page-content ul { margin-bottom: 0.75rem; padding-left: 1.5rem; }
.legal-page-content li { margin-bottom: 0.25rem; line-height: 1.5; }

/* ── Playoff Bracket ───────────────────────────────────────────────────────── */
.bracket-container {
    display: flex;
    align-items: flex-start;
    gap: 0;
    overflow-x: auto;
    padding: 1rem 0;
}
.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 220px;
}
.bracket-round-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a8c4ff;
    margin-bottom: 0.25rem;
    text-align: center;
}
.bracket-consolation-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffc107;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    text-align: center;
}
.bracket-card {
    background: var(--primary-color);
    border: 1px solid #2a3a5e;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.2s;
}
.bracket-card:hover {
    border-color: #4a6fa5;
}
.bracket-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a9aba;
    margin-bottom: 0.35rem;
}
.bracket-team {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: #ddd;
}
.bracket-seed {
    font-weight: 700;
    font-size: 0.75rem;
    min-width: 1.5rem;
}
.bracket-name {
    flex: 1;
}
.bracket-score {
    font-size: 0.85rem;
    min-width: 1.5rem;
    text-align: right;
}
.bracket-winner .bracket-name {
    color: #fff;
    font-weight: 700;
}
.bracket-loser .bracket-name {
    color: #909090;
    text-decoration: line-through;
}
.bracket-tbd {
    color: #909090;
    font-style: italic;
}
.bracket-connector {
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    min-width: 2rem;
    justify-content: center;
}

/* ── Live Scoring ──────────────────────────────────────────────────────── */
@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.pulse-live {
    animation: pulse-live 1.5s ease-in-out infinite;
}

/* ── Showcase / Landing Page ──────────────────────────────────── */

.showcase-page .showcase-hero {
    min-height: 480px;
    display: flex;
    align-items: center;
}
.showcase-hero-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    padding: 4px;
}
.showcase-screenshot-frame {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.showcase-screenshot-inner {
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.showcase-video-frame {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.showcase-page .card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.showcase-page .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.12) !important;
}

}