/* Farseer — Tennis Astrology Prediction Engine */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #1a1a2e;
    border-right: 1px solid #2a2a4a;
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid #2a2a4a;
}

.sidebar-header h2 {
    color: #a78bfa;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-header .subtitle {
    font-size: 0.72rem;
    color: #666;
    margin-top: 0.2rem;
}

.nav-links {
    list-style: none;
    padding: 1rem 0;
}

.nav-links li a {
    display: block;
    padding: 0.6rem 1.25rem;
    color: #b0b0c0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.nav-links li a:hover {
    background: #2a2a4a;
    color: #fff;
}

.nav-links li a.active {
    background: #2a2a4a;
    color: #a78bfa;
    border-left: 3px solid #a78bfa;
}

/* Main content */
.content {
    margin-left: 220px;
    padding: 2rem;
    flex: 1;
    max-width: 1100px;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    color: #fff;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.stat-accent { color: #a78bfa; }
.stat-warn { color: #f59e0b; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.15s;
    text-decoration: none;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #7c3aed; color: #fff; }
.btn-secondary { background: #374151; color: #e0e0e0; }
.btn-success { background: #059669; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }

/* Status banner */
.status-banner {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.status-banner.info { background: #1e3a5f; color: #93c5fd; }
.status-banner.success { background: #14532d; color: #86efac; }
.status-banner.error { background: #7f1d1d; color: #fca5a5; }
.status-banner.hidden { display: none; }

/* Sections */
.section {
    margin-top: 2rem;
}

.section h2 {
    font-size: 1.15rem;
    color: #d0d0e0;
    margin-bottom: 1rem;
}

/* Tabs (for player tour switcher, prediction status filters) */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #2a2a4a;
}

.tab-btn {
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #b0b0c0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover { color: #fff; }
.tab-btn.active { color: #a78bfa; border-bottom-color: #a78bfa; }

.tab-count {
    background: #2a2a4a;
    color: #aaa;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 0.3rem;
}

.tab-btn.active .tab-count {
    background: #a78bfa;
    color: #fff;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-tier-a { background: #059669; color: #fff; }
.badge-tier-b { background: #ca8a04; color: #000; }
.badge-tier-c { background: #dc2626; color: #fff; }

.badge-surface-hard { background: #3b82f6; color: #fff; }
.badge-surface-clay { background: #d97706; color: #fff; }
.badge-surface-grass { background: #16a34a; color: #fff; }

.badge-correct { background: #059669; color: #fff; }
.badge-incorrect { background: #dc2626; color: #fff; }
.badge-pending { background: #6b7280; color: #fff; }

.badge-confidence {
    background: #7c3aed;
    color: #fff;
}

.badge-tour-atp { background: #2563eb; color: #fff; }
.badge-tour-wta { background: #db2777; color: #fff; }

.badge-mode {
    background: #2a2a4a;
    color: #b0b0c0;
}

/* Two-column layout */
.dash-columns {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    margin: 0;
}

/* Card lists */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Player cards */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.player-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: border-color 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.player-card:hover {
    border-color: #7c3aed;
}

.player-card h3 {
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 0.4rem;
}

.player-card-meta {
    font-size: 0.78rem;
    color: #888;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.player-card .sun-sign {
    color: #a78bfa;
    font-weight: 500;
}

/* Match cards */
.match-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    transition: border-color 0.15s;
}

.match-card:hover {
    border-color: #7c3aed;
}

.match-card h3 {
    font-size: 1rem;
    color: #fff;
    margin-bottom: 0.4rem;
}

.match-card-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.match-card-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.match-winner {
    color: #86efac;
    font-weight: 600;
}

.match-loser {
    color: #888;
}

.match-score {
    color: #a78bfa;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Prediction cards */
.prediction-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: border-color 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.prediction-card:hover {
    border-color: #7c3aed;
}

.prediction-card.card-correct {
    border-left: 3px solid #059669;
}

.prediction-card.card-incorrect {
    border-left: 3px solid #dc2626;
}

.prediction-card h3 {
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 0.4rem;
}

.prediction-card-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #888;
    flex-wrap: wrap;
    align-items: center;
}

/* Confidence bar */
.confidence-bar {
    width: 100%;
    height: 8px;
    background: #2a2a4a;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.confidence-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.confidence-bar-fill.high { background: #059669; }
.confidence-bar-fill.medium { background: #ca8a04; }
.confidence-bar-fill.low { background: #dc2626; }

/* Score comparison grid (prediction detail) */
.score-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.score-column {
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1rem;
}

.score-column h3 {
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 0.75rem;
}

.score-column.winner {
    border-color: #059669;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.score-row-label {
    color: #888;
}

.score-row-value {
    color: #e0e0e0;
    font-weight: 600;
}

/* Transit table */
.transit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.transit-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: #888;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #2a2a4a;
}

.transit-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #1a1a2e;
}

.transit-table tr:hover td {
    background: #1a1a2e;
}

.retrograde {
    color: #f59e0b;
    font-size: 0.72rem;
    font-weight: 600;
}

/* Calibration table */
.calibration-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #2a2a4a;
}

.calibration-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    color: #888;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #141425;
}

.calibration-table td {
    padding: 0.6rem 1rem;
    border-top: 1px solid #2a2a4a;
}

/* Analysis block (prediction detail) */
.analysis-block {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1rem 0;
}

.analysis-block h3 {
    font-size: 0.85rem;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.analysis-block p,
.analysis-block li {
    font-size: 0.85rem;
    color: #c0c0d0;
    line-height: 1.5;
}

.analysis-block ul {
    list-style: none;
    padding: 0;
}

.analysis-block li {
    padding: 0.25rem 0;
    padding-left: 1rem;
    position: relative;
}

.analysis-block li::before {
    content: "\2192";
    position: absolute;
    left: 0;
    color: #a78bfa;
}

.analysis-text {
    white-space: pre-wrap;
    font-size: 0.85rem;
    color: #c0c0d0;
    line-height: 1.6;
}

/* Outcome banner (prediction detail) */
.outcome-banner {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.outcome-banner.correct {
    background: #14532d;
    border: 1px solid #059669;
}

.outcome-banner.incorrect {
    background: #7f1d1d;
    border: 1px solid #dc2626;
}

.outcome-banner.pending-outcome {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
}

.outcome-banner h2 {
    font-size: 1.1rem;
    color: #fff;
    margin: 0;
}

.outcome-banner p {
    font-size: 0.85rem;
    color: #c0c0d0;
    margin: 0;
}

/* Key transits list */
.key-transit {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.35rem 0;
    font-size: 0.82rem;
}

.key-transit .transit-aspect {
    font-weight: 600;
    min-width: 80px;
}

.key-transit .transit-aspect.positive { color: #10b981; }
.key-transit .transit-aspect.negative { color: #ef4444; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden { display: none; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 101;
}

.modal-content h2 {
    font-size: 1.15rem;
    color: #fff;
    margin-bottom: 1.25rem;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover { color: #fff; }

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
}

/* Forms */
.form-section {
    margin-bottom: 1rem;
}

.form-section label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.form-section select,
.form-section input,
.form-section textarea {
    width: 100%;
    background: #0f0f1a;
    color: #e0e0e0;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
}

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

.computed-field {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: #666;
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    font-style: italic;
}

.computed-field-active {
    color: #a78bfa;
    font-style: normal;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-note {
    font-size: 0.8rem;
    color: #888;
    padding: 0.5rem 0.75rem;
    background: #141425;
    border-radius: 6px;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

/* Placeholder text */
.placeholder {
    color: #666;
    font-style: italic;
    padding: 2rem 0;
    text-align: center;
}

/* Accuracy banner (dashboard) */
.accuracy-banner {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.accuracy-banner .big-number {
    font-size: 2rem;
    font-weight: 700;
    color: #a78bfa;
}

.accuracy-banner .big-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Resolve form */
.resolve-section {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.resolve-section h3 {
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 1rem;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 2rem;
    color: #888;
}

/* ---------- Mobile Responsive ---------- */

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 0.75rem 0;
        border-right: none;
        border-bottom: 1px solid #2a2a4a;
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 1rem 0.5rem;
        border-bottom: none;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        padding: 0.25rem 0.5rem;
    }

    .nav-links li a {
        padding: 0.4rem 0.75rem;
        font-size: 0.82rem;
    }

    .nav-links li a.active {
        border-left: none;
        border-bottom: 2px solid #a78bfa;
    }

    .content {
        margin-left: 0;
        padding: 1rem;
        max-width: 100%;
    }

    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 0.5rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .dash-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

    .score-comparison {
        grid-template-columns: 1fr;
    }

    .player-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .accuracy-banner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .modal-content {
        width: 95%;
        padding: 1.25rem;
        max-height: 90vh;
    }

    .tab-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .btn { font-size: 0.8rem; padding: 0.4rem 0.75rem; }
    .btn-sm { font-size: 0.72rem; padding: 0.25rem 0.5rem; }

    .page-header h1 { font-size: 1.2rem; }

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