/**
 * match-modal.css  (Batch 2.9)
 *
 * Lightweight modal that opens when a match card on /partidos.html is tapped.
 * Shows the user's Oficial and Completa predictions, plus the actual result
 * if the match has finalized.
 *
 * Also adds clickable-card affordances (pointer cursor, hover state, focus ring).
 */

/* ============================================================================
 * Clickable card affordances
 * ============================================================================ */

.match-card[role="button"] {
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.1s ease, background-color 0.15s ease;
    -webkit-tap-highlight-color: rgba(125, 211, 252, 0.18);
}

.match-card[role="button"]:hover {
    border-color: rgba(125, 211, 252, 0.35);
    background-color: rgba(255, 255, 255, 0.02);
}

.match-card[role="button"]:active {
    transform: scale(0.995);
}

.match-card[role="button"]:focus-visible {
    outline: 2px solid rgba(125, 211, 252, 0.65);
    outline-offset: 2px;
}

/* ============================================================================
 * Modal scaffold
 * ============================================================================ */

.match-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4, 16px);
}

.match-modal[hidden] {
    display: none !important;
}

.match-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: match-modal-fade-in 0.18s ease;
}

@keyframes match-modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.match-modal__dialog {
    position: relative;
    background: linear-gradient(170deg, #16284a 0%, #0c1a32 100%);
    border: 1px solid rgba(125, 211, 252, 0.16);
    border-radius: var(--r-xl, 22px);
    padding: var(--sp-5, 20px);
    max-width: 480px;
    width: 100%;
    max-height: calc(100vh - var(--sp-7, 32px));
    overflow-y: auto;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 30px 70px rgba(2, 6, 16, 0.6);
    animation: match-modal-slide-in 0.2s ease;
}

@keyframes match-modal-slide-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.match-modal__close {
    position: absolute;
    top: var(--sp-3, 12px);
    right: var(--sp-3, 12px);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
}

.match-modal__close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary, #fff);
}

.match-modal__close:focus-visible {
    outline: 2px solid rgba(125, 211, 252, 0.65);
    outline-offset: 2px;
}

/* ============================================================================
 * Modal header
 * ============================================================================ */

.match-modal__header {
    padding-right: var(--sp-7, 36px);
    margin-bottom: var(--sp-4, 16px);
}

.match-modal__stage-line {
    display: flex;
    gap: var(--sp-2, 8px);
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
    margin-bottom: var(--sp-3, 12px);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.match-modal__match-num {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.match-modal__title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3, 12px);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin: 0 0 var(--sp-2, 8px);
    flex-wrap: wrap;
    text-align: center;
}

.match-modal__team-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 0 1 auto;
    min-width: 0;
}

.match-modal__flag {
    font-size: 2.5rem;
    line-height: 1;
}

.match-modal__team-name {
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.match-modal__vs {
    font-size: 0.75rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
    text-transform: uppercase;
    letter-spacing: 0.06em;
    align-self: center;
    padding-bottom: var(--sp-5, 20px);
}

.match-modal__kickoff {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    margin-top: var(--sp-2, 8px);
}

/* ============================================================================
 * Modal body sections
 * ============================================================================ */

.match-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4, 16px);
}

.match-modal__section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--r-md, 12px);
    padding: var(--sp-3, 12px) var(--sp-4, 16px);
}

.match-modal__section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
    margin: 0 0 var(--sp-3, 12px);
}

/* Result row */

.match-modal__result-row {
    display: flex;
    align-items: baseline;
    gap: var(--sp-3, 12px);
    flex-wrap: wrap;
}

.match-modal__score {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    line-height: 1;
}

.match-modal__outcome {
    font-size: 0.85rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

/* Prediction rows */

.match-modal__pred {
    display: flex;
    align-items: center;
    gap: var(--sp-3, 12px);
    flex-wrap: wrap;
    padding: var(--sp-2, 8px) 0;
}

.match-modal__pred + .match-modal__pred {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: var(--sp-2, 8px);
    padding-top: var(--sp-3, 12px);
}

.match-modal__pred-badge {
    flex-shrink: 0;
}

.match-modal__pred-score {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    line-height: 1;
    letter-spacing: 0.02em;
}

.match-modal__pred-dash {
    margin: 0 4px;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
}

.match-modal__pred-outcome {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    padding-left: 0;
    margin-top: 2px;
}

.match-modal__pred--empty .match-modal__pred-mode {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
}

.match-modal__pred-empty-text {
    font-size: 0.85rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    font-style: italic;
    margin-left: auto;
}

.match-modal__no-predictions {
    color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
    text-align: center;
    margin: var(--sp-3, 12px) 0;
    font-size: 0.9rem;
}

/* ============================================================================
 * Modal footer
 * ============================================================================ */

.match-modal__footer {
    margin-top: var(--sp-4, 16px);
    display: flex;
    gap: var(--sp-2, 8px);
}

.match-modal__footer .btn {
    flex: 1;
}

/* ============================================================================
 * Mobile adjustments
 * ============================================================================ */

@media (max-width: 480px) {
    .match-modal {
        padding: var(--sp-2, 8px);
        align-items: flex-end;
    }

    .match-modal__dialog {
        max-height: 92vh;
        border-radius: var(--r-lg, 16px) var(--r-lg, 16px) 0 0;
        animation: match-modal-slide-up 0.22s ease;
    }

    @keyframes match-modal-slide-up {
        from { opacity: 0; transform: translateY(24px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .match-modal__flag {
        font-size: 2rem;
    }

    .match-modal__team-name {
        font-size: 0.85rem;
        max-width: 95px;
    }

    .match-modal__pred-score {
        font-size: 1.25rem;
    }
}

@media (max-width: 380px) {
    .match-modal__title {
        gap: var(--sp-2, 8px);
    }
}

/* ============================================================
   [Quick-edit] Editor inline de la predicción Oficial
   (home "Tu próximo partido" + modal de partidos.html)
   ============================================================ */
.qe {
    margin-top: var(--sp-3, 12px);
    padding-top: var(--sp-3, 12px);
    border-top: 1px solid var(--border, rgba(255,255,255,0.10));
}
.qe__label {
    margin: 0 0 10px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, rgba(255,255,255,0.6));
}

.qe__scoreline {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 14px;
}
.qe__team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    max-width: 140px;
}
.qe__flag { font-size: 1.9rem; line-height: 1; }
.qe__flag img { width: 1.9rem; height: 1.9rem; border-radius: 4px; object-fit: cover; }
.qe__team-name {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}
.qe__x { align-self: center; font-size: 1.2rem; opacity: 0.5; padding-top: 24px; }

.qe__stepper {
    display: flex;
    align-items: center;
    gap: 6px;
}
.qe__step {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid rgba(74, 143, 239, 0.45);
    background: rgba(74, 143, 239, 0.12);
    color: inherit;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s, transform 0.06s;
}
.qe__step:hover { background: rgba(74, 143, 239, 0.22); }
.qe__step:active { transform: scale(0.92); }
.qe__val {
    min-width: 28px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* Knockout: quién avanza */
.qe__ko {
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border, rgba(255,255,255,0.10));
}
.qe__ko-q {
    margin: 0 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}
.qe__ko-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.qe__ko-row:last-child { margin-bottom: 0; }
.qe__ko-btn {
    flex: 1;
    padding: 9px 8px;
    border-radius: 9px;
    border: 1px solid var(--border, rgba(255,255,255,0.14));
    background: rgba(255,255,255,0.04);
    color: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qe__ko-btn:hover { border-color: rgba(74,143,239,0.5); }
.qe__ko-btn.is-sel {
    background: rgba(74,143,239,0.20);
    border-color: var(--accent-blue, #4a8fef);
    color: #fff;
}

/* Outcome model (NFL) */
.qe__outcome-btns {
    display: flex;
    gap: 8px;
}
.qe__oc {
    flex: 1;
    padding: 12px 8px;
    border-radius: 10px;
    border: 1px solid var(--border, rgba(255,255,255,0.14));
    background: rgba(255,255,255,0.04);
    color: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
}
.qe__oc:hover { border-color: rgba(74,143,239,0.5); }
.qe__oc.is-sel {
    background: rgba(74,143,239,0.20);
    border-color: var(--accent-blue, #4a8fef);
    color: #fff;
}

.qe__save {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border-radius: 999px;
    border: none;
    background: var(--accent-blue, #4a8fef);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.qe__save:hover { background: var(--accent-blue-hover, #5b9bf5); }
.qe__save:disabled { opacity: 0.6; cursor: default; }

.qe__status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    text-align: center;
}
.qe__status[data-kind="success"] {
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.35);
    color: #6ee7b7;
}
.qe__status[data-kind="error"] {
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.30);
    color: #f87171;
}

/* ============================================================
   [Próximo partido] Carta clicable en el home + cuenta regresiva
   ============================================================ */
.next-match-card {
    display: block;
    width: 100%;
    max-width: 480px;
    margin: var(--sp-5, 20px) auto 0;
    padding: 16px 18px;
    text-align: left;
    border-radius: 16px;
    border: 1px solid rgba(74, 143, 239, 0.35);
    background: linear-gradient(160deg, rgba(74,143,239,0.14), rgba(74,143,239,0.05));
    color: inherit;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}
.next-match-card:hover {
    transform: translateY(-2px);
    border-color: rgba(74, 143, 239, 0.6);
    box-shadow: 0 8px 24px rgba(74, 143, 239, 0.18);
}
.next-match-card__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-blue, #4a8fef);
    margin-bottom: 10px;
}
.next-match-card__body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.nmc-team {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.nmc-team--away { flex-direction: row-reverse; text-align: right; }
.nmc-flag { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.nmc-flag img { width: 1.6rem; height: 1.6rem; border-radius: 4px; object-fit: cover; }
.nmc-name {
    font-size: 0.95rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nmc-vs { font-size: 0.8rem; opacity: 0.55; flex-shrink: 0; }
.next-match-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* [Fix overflow móvil] En pantallas chicas el pick baja de línea en vez de
       empujar la tarjeta más allá del viewport. */
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.82rem;
}
.nmc-kickoff { color: var(--text-secondary, rgba(255,255,255,0.6)); min-width: 0; }
.nmc-pred { font-weight: 600; flex-shrink: 1; min-width: 0; }
.nmc-pred[data-state="has"] { color: var(--accent-green, #10b981); }
.nmc-pred[data-state="none"] { color: var(--accent-blue, #4a8fef); }

/* Countdown line inside the match modal header */
.match-modal__countdown {
    margin-top: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-blue, #4a8fef);
    text-align: center;
}
