/* ── Variables ─────────────────────────────────────────── */
:root {
    --navy: #1d3557;
    --blue: #1a3a8a;
    --yellow: #ffcc00;
    --bg: #f0f2f5;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1d3557;
    --muted: #64748b;
    --danger: #dc2626;
    --success: #16a34a;
    --sidebar-w: 240px;
}

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

body {
    font-family: "Inter", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Login*/
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
}

.login-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 1px;
}

.login-logo .brand i {
    color: var(--navy);
    font-size: 22px;
}

.login-logo .badge-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
    margin-top: 4px;
}

.login-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}

.login-card > p {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 28px;
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
    display: none;
}

/* ── Fields & Buttons*/
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
    outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26, 58, 138, 0.1);
}

.field textarea {
    resize: vertical;
    min-height: 80px;
}

/* Keep floating label only for login screen */
#login-screen .field {
    position: relative;
    margin-bottom: 16px;
}

#login-screen .field label {
    font-size: 13px;
    position: absolute;
    left: 0;
    top: 0;
    padding: 0.75em;
    margin-left: 0.5em;
    pointer-events: none;
    transition: all 0.3s ease;
    color: var(--muted);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    display: block;
    z-index: 1;
}

#login-screen .field input {
    border-radius: 20px;
    background: transparent;
    box-shadow: none;
}

#login-screen .field input:focus ~ label,
#login-screen .field input:not(:placeholder-shown) ~ label {
    transform: translateY(-50%) scale(0.9);
    margin: 0;
    margin-left: 1.3em;
    padding: 0.4em;
    background-color: var(--surface);
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--navy);
    color: white;
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
}
.btn-primary:hover {
    background: var(--blue);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}
.btn-danger:hover {
    background: #fecaca;
}

.btn-success {
    background: var(--navy);
    color: white;
}
.btn-success:hover {
    background: var(--blue);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* ── App shell ─────────────────────────────────────────── */
#app {
    display: none;
    min-height: 100vh;
}

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

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header .club-name {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--yellow);
}

.sidebar-header .admin-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 4px;
    letter-spacing: 1px;
}

.sidebar nav {
    padding: 16px 0;
    flex: 1;
}

.nav-section-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.35);
    padding: 12px 20px 6px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
}

.nav-item.active {
    background: rgba(255, 204, 0, 0.12);
    color: var(--yellow);
    border-left-color: var(--yellow);
}

.nav-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-start;
}

.logout-Btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition-duration: 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background-color: var(--danger);
}

.logout-sign {
    width: 100%;
    transition-duration: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-sign i {
    font-size: 15px;
    color: white;
}

.logout-text {
    position: absolute;
    right: 0%;
    width: 0%;
    opacity: 0;
    color: white;
    font-size: 13px;
    font-weight: 600;
    transition-duration: 0.3s;
    white-space: nowrap;
}

.logout-Btn:hover {
    width: 130px;
    border-radius: 30px;
    background-color: var(--danger);
}

.logout-Btn:hover .logout-sign {
    width: 30%;
    padding-left: 14px;
}

.logout-Btn:hover .logout-sign i {
    color: white;
}

.logout-Btn:hover .logout-text {
    opacity: 1;
    width: 70%;
    padding-right: 10px;
}

.logout-Btn:active {
    transform: translate(1px, 1px);
}

/* ── Main content*/
.main {
    margin-left: var(--sidebar-w);
    padding: 32px;
    min-height: 100vh;
}

.page {
    display: none;
}
.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
}

.page-header p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

/* ── Card */
.card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
}

/* ── Table  */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead th {
    background: var(--bg);
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

tbody tr:last-child {
    border-bottom: none;
}
tbody tr:hover {
    background: var(--bg);
}

tbody td {
    padding: 12px 16px;
    color: var(--text);
    vertical-align: middle;
}

.actions {
    display: flex;
    gap: 6px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-blazers {
    background: #dbeafe;
    color: #1e40af;
}
.badge-falcons {
    background: #fef9c3;
    color: #854d0e;
}
.badge-elites {
    background: #fce7f3;
    color: #9d174d;
}

.loading-row td {
    padding: 40px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

/* ── Standings grid ────────────────────────────────────── */
.standings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 0;
}

/* ── Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
    line-height: 1;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    position: sticky;
    bottom: 0;
    background: var(--surface);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── Toast */
#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    z-index: 9999;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

#toast.show {
    transform: translateY(0);
    opacity: 1;
}
#toast.success {
    background: var(--success);
}
#toast.error {
    background: var(--danger);
}

/* Roster Builder */
.roster-builder-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

.rb-player-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    transition:
        border-color 0.2s,
        background 0.2s;
    cursor: pointer;
}

.rb-player-row:hover {
    background: var(--bg);
}

.rb-player-row.selected {
    border-color: var(--navy);
    background: rgba(29, 53, 87, 0.05);
}

.rb-player-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--navy);
}

.rb-player-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.rb-player-position {
    font-size: 11px;
    color: var(--muted);
    flex-shrink: 0;
}

.rb-number-input {
    width: 56px !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    text-align: center;
    border: 1.5px solid var(--border) !important;
    flex-shrink: 0;
}

.rb-libero-badge {
    font-size: 10px;
    font-weight: 700;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* ── Animated checkbox ───────────────────────────────────── */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkbox-wrapper .checkbox-label {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.checkbox-wrapper .checkbox-svg {
    width: 22px;
    height: 22px;
}

.checkbox-wrapper .checkbox-box {
    fill: rgba(207, 205, 205, 0.3);
    stroke: var(--navy);
    stroke-width: 2;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 0.6s ease-in;
}

.checkbox-wrapper .checkbox-tick {
    stroke: var(--navy);
    stroke-width: 2;
    stroke-dasharray: 172;
    stroke-dashoffset: 172;
    transition: stroke-dashoffset 0.6s ease-in;
}

.checkbox-wrapper
    input[type="checkbox"]:checked
    + .checkbox-label
    .checkbox-box,
.checkbox-wrapper
    input[type="checkbox"]:checked
    + .checkbox-label
    .checkbox-tick {
    stroke-dashoffset: 0;
}

/* CVA Roster preview table */
.cva-roster-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    font-size: 13px;
}

.cva-roster-table th,
.cva-roster-table td {
    border: 1px solid #333;
    padding: 6px 10px;
}

.cva-roster-table .cva-header {
    background: #f97316;
    color: white;
    font-weight: 700;
    text-align: center;
    font-size: 14px;
}

.cva-roster-table .cva-subheader {
    background: #1d3557;
    color: white;
    font-weight: 700;
}

.cva-roster-table .cva-libero {
    background: #f97316;
    color: white;
    font-weight: 700;
}

.cva-roster-table .cva-staff {
    background: #f97316;
    color: white;
    font-weight: 700;
}

.cva-meta {
    font-family: Arial, sans-serif;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    gap: 40px;
}

.cva-meta strong {
    color: #1d3557;
}

.cva-staff {
    background: #f97316;
    color: white;
    font-weight: 700;
}

/* ── Responsive */
@media (max-width: 900px) {
    .standings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        max-height: 100vh;
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .btn-success {
        padding: 8px;
        font-size: 12px;
    }

    .main {
        margin-left: 0;
        padding: 1px;
        padding-top: 80px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    #roster-tbody td:nth-child(2),
    #page-roster thead th:nth-child(2),
    #roster-tbody td:nth-child(5),
    #page-roster thead th:nth-child(5) {
        display: none;
    }
    #roster-tbody td:last-child,
    #page-roster thead th:last-child {
        display: table-cell;
    }

    #results-tbody td:nth-child(1),
    #results-tbody td:nth-child(2),
    #page-results thead th:nth-child(1),
    #page-results thead th:nth-child(2) {
        display: none;
    }

    #schedule-tbody td:nth-child(2),
    #schedule-tbody td:nth-child(5),
    #page-schedule thead th:nth-child(2),
    #page-schedule thead th:nth-child(5) {
        display: none;
    }

    #activities-tbody td:nth-child(3),
    #page-activities thead th:nth-child(3) {
        display: none;
    }

    #standings-male-tbody td:nth-child(4),
    #standings-male-tbody td:nth-child(5),
    #standings-female-tbody td:nth-child(4),
    #standings-female-tbody td:nth-child(5),
    #page-standings .card thead th:nth-child(4),
    #page-standings .card thead th:nth-child(5) {
        display: none;
    }

    #executives-tbody td:nth-child(3),
    #page-executives thead th:nth-child(3) {
        display: none;
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
    }

    .modal-body {
        padding: 16px;
    }
    .modal-header {
        padding: 16px;
    }
    .modal-footer {
        padding: 12px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .roster-builder-grid {
        grid-template-columns: 1fr;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--navy);
        padding: 0 16px;
        z-index: 150;
    }

    .mobile-topbar .club-name {
        font-size: 13px;
        font-weight: 700;
        color: var(--yellow);
        letter-spacing: 1px;
    }

    .mobile-menu-btn {
        background: none;
        border: none;
        color: white;
        font-size: 22px;
        cursor: pointer;
        padding: 8px;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }

    .mobile-overlay.show {
        display: block;
    }
}

@media (min-width: 769px) {
    .mobile-topbar {
        display: none;
    }
}
