/*
 * Futexcel WCP Addon — CSS Moderno
 * Sobrescreve o style.css do World Cup Predictor.
 *
 * Estratégia: usa as mesmas classes do plugin (.wcup-header, .zebra, etc.)
 * com especificidade maior para garantir override.
 *
 * SEÇÕES:
 *   1. Variáveis e base
 *   2. Tabelas gerais (zebra, wcp-group, ranking)
 *   3. Cabeçalho e linhas
 *   4. Colunas especiais (pontos, review, score)
 *   5. Tabela de palpites (predictor)
 *   6. Widget de previsões do usuário
 *   7. Módulo Pontos Extras (fwcp-)
 *   8. Mensagens
 *   9. Responsivo
 */

/* ══════════════════════════════════════════
   1. VARIÁVEIS E BASE
══════════════════════════════════════════ */

:root {
    --wcp-primary:      #1e3a5f;
    --wcp-primary-light:#2563eb;
    --wcp-accent:       #f59e0b;
    --wcp-header-bg:    #1e3a5f;
    --wcp-header-color: #ffffff;
    --wcp-row-alt:      #f1f5f9;
    --wcp-row-even:     #ffffff;
    --wcp-border:       #e2e8f0;
    --wcp-text:         #1a1a2e;
    --wcp-muted:        #64748b;
    --wcp-radius:       8px;
    --wcp-shadow:       0 2px 8px rgba(0,0,0,0.08);
    --wcp-font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ══════════════════════════════════════════
   2. TABELAS GERAIS
══════════════════════════════════════════ */

table.zebra,
table.wcp-group,
table.scores {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--wcp-radius);
    overflow: hidden;
    box-shadow: var(--wcp-shadow);
    margin-bottom: 24px;
    font-family: var(--wcp-font);
    font-size: 0.92em;
}

table.zebra th,
table.wcp-group th,
table.scores th {
    border: none;
    padding: 11px 14px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.82em;
}

table.zebra td,
table.wcp-group td,
table.scores td {
    border: none;
    border-bottom: 1px solid var(--wcp-border);
    padding: 10px 14px;
    vertical-align: middle;
    color: var(--wcp-text);
}

/* ══════════════════════════════════════════
   3. CABEÇALHO E LINHAS
══════════════════════════════════════════ */

.wcup-header,
tr.wcup-header {
    background-color: var(--wcp-header-bg) !important;
    color: var(--wcp-header-color) !important;
    line-height: 1.4em;
}

.wcup-header th,
tr.wcup-header th,
tr.wcup-header td {
    color: var(--wcp-header-color) !important;
    background-color: var(--wcp-header-bg) !important;
}

/* Linhas alternadas */
table.zebra tr.alt td {
    background-color: var(--wcp-row-alt) !important;
    color: var(--wcp-text);
}

table.zebra tr.even td {
    background-color: var(--wcp-row-even) !important;
    color: var(--wcp-text);
}

/* Linha normal (ranking e outros) */
.wcup-row {
    line-height: 1.6em;
    transition: background 0.12s;
}

table.zebra tr.wcup-row:hover td,
table.zebra tr:hover td,
table.wcp-group tr:hover td {
    background-color: #eff6ff !important;
}

/* Última linha sem borda */
table.zebra tr:last-child td,
table.wcp-group tr:last-child td {
    border-bottom: none;
}

/* ══════════════════════════════════════════
   4. COLUNAS ESPECIAIS
══════════════════════════════════════════ */

.wcup-points {
    text-align: center !important;
    font-weight: 700;
    color: var(--wcp-primary-light);
    width: 7%;
    padding-right: 14px !important;
}

.wcup-review {
    text-align: center !important;
    width: 10%;
}

.wcup-review img {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.wcup-review img:hover {
    opacity: 1;
}

.wcup-score {
    text-align: center !important;
    width: 17%;
    font-weight: 600;
    color: var(--wcp-primary);
}

/* Time / equipe */
.wcup-team a {
    color: var(--wcp-primary-light) !important;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.wcup-team a:hover {
    color: var(--wcp-primary) !important;
}

/* Bandeiras */
.wcup_flag,
img.wcup_flag {
    border: none !important;
    box-shadow: none !important;
    border-radius: 2px;
}

/* ══════════════════════════════════════════
   5. TABELA DE PALPITES (PREDICTOR)
══════════════════════════════════════════ */

table.predictor {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--wcp-font);
    font-size: 0.94em;
}

table.predictor td {
    border: none;
    padding: 8px 6px;
    vertical-align: middle;
}

table.predictor td.sep {
    border-bottom: 1px solid var(--wcp-border) !important;
    text-align: center;
    color: var(--wcp-muted);
    font-size: 0.85em;
    padding: 4px 0;
}

/* Times (esquerda e direita) */
table.predictor td.l,
table.predictor td.r {
    width: 40%;
    font-weight: 500;
    color: var(--wcp-text);
}

table.predictor td.l {
    text-align: left;
}

table.predictor td.r {
    text-align: right;
}

/* Inputs de gols */
table.predictor td.cl input,
table.predictor td.cr input {
    width: 2.8em;
    text-align: center;
    font-weight: 700;
    font-size: 1em;
    padding: 7px;
    border: 1px solid var(--wcp-border);
    border-radius: 5px;
    background: #fff;
    color: var(--wcp-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

table.predictor td.cl input:focus,
table.predictor td.cr input:focus {
    outline: none;
    border-color: var(--wcp-primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* Linha de predição */
table tr.predict td {
    padding-top: 18px;
}

/* Tabela knockout */
table.knockout {
    margin: 1em 0;
    font-size: 82%;
    width: 100%;
    font-family: var(--wcp-font);
}

/* ══════════════════════════════════════════
   6. WIDGET DE PREVISÕES DO USUÁRIO
══════════════════════════════════════════ */

.wcup_user_pred_widget {
    font-size: 88%;
    font-family: var(--wcp-font);
}

.wcup_user_pred_widget td,
.wcup_user_pred_widget th {
    padding: 8px 10px;
}

/* ══════════════════════════════════════════
   7. MÓDULO PONTOS EXTRAS (fwcp-)
══════════════════════════════════════════ */

.fwcp-bonus-wrap {
    max-width: 600px;
    font-family: var(--wcp-font);
    font-size: 0.95em;
    color: var(--wcp-text);
}

.fwcp-question {
    background: #ffffff;
    border: 1px solid var(--wcp-border);
    border-radius: var(--wcp-radius);
    padding: 16px 18px;
    margin-bottom: 14px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.fwcp-question:focus-within {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.fwcp-question label {
    display: block;
    font-weight: 600;
    font-size: 0.96em;
    color: var(--wcp-primary);
    margin-bottom: 10px;
}

.fwcp-question select {
    width: 100%;
    padding: 9px 36px 9px 12px;
    font-size: 0.94em;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: var(--wcp-text);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b7280' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: border-color 0.15s;
}

.fwcp-question select:focus {
    outline: none;
    border-color: var(--wcp-primary-light);
    background-color: #fff;
}

/* Botão de envio */
.fwcp-submit {
    margin-top: 20px;
}

.fwcp-submit button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    font-size: 0.96em;
    font-weight: 600;
    background: var(--wcp-primary-light);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: var(--wcp-font);
}

.fwcp-submit button:hover  { background: var(--wcp-primary); }
.fwcp-submit button:active { transform: scale(0.98); }
.fwcp-submit button:disabled { background: #93c5fd; cursor: not-allowed; }

/* Tabela de resultados */
.fwcp-bonus-results {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 2px solid var(--wcp-border);
    font-family: var(--wcp-font);
}

.fwcp-bonus-results h3 {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--wcp-primary);
    margin: 0 0 14px 0;
}

.fwcp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--wcp-radius);
    overflow: hidden;
    box-shadow: var(--wcp-shadow);
    font-size: 0.9em;
}

.fwcp-table thead tr {
    background: var(--wcp-header-bg);
}

.fwcp-table thead th {
    padding: 10px 14px;
    text-align: left;
    color: #fff;
    font-weight: 600;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fwcp-table tbody tr {
    border-bottom: 1px solid var(--wcp-border);
    transition: background 0.12s;
}

.fwcp-table tbody tr:nth-child(even) { background: var(--wcp-row-alt); }
.fwcp-table tbody tr:hover           { background: #eff6ff; }

.fwcp-table tbody td {
    padding: 10px 14px;
    vertical-align: middle;
}

.fwcp-table tfoot tr {
    background: #f1f5f9;
    border-top: 2px solid #cbd5e1;
}

.fwcp-table tfoot td {
    padding: 11px 14px;
    font-weight: 700;
    color: var(--wcp-primary);
}

.fwcp-pts {
    text-align: right !important;
    font-weight: 700;
    color: var(--wcp-primary-light);
    min-width: 48px;
}

.fwcp-na,
.fwcp-undef {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.88em;
}

/* ══════════════════════════════════════════
   8. MENSAGENS
══════════════════════════════════════════ */

.fwcp-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 0.92em;
    border-left: 4px solid transparent;
    font-family: var(--wcp-font);
}

.fwcp-info    { background: #eef6ff; border-color: #3b82f6; color: #1e3a5f; }
.fwcp-success { background: #f0faf2; border-color: #22c55e; color: #14532d; }
.fwcp-error   { background: #fff5f5; border-color: #ef4444; color: #7f1d1d; }

/* ══════════════════════════════════════════
   9. RESPONSIVO
══════════════════════════════════════════ */

@media only screen and (max-width: 600px) {

    table.wcp-group,
    table.zebra,
    .wcup_clock {
        font-size: 80%;
    }

    table.predictor,
    table.scores {
        font-size: 75%;
    }

    table.knockout {
        font-size: 52%;
    }

    table.zebra td,
    table.wcp-group td,
    .fwcp-table tbody td,
    .fwcp-table thead th {
        padding: 8px 10px;
    }

    .fwcp-bonus-wrap {
        max-width: 100%;
    }

    .fwcp-submit button {
        width: 100%;
        justify-content: center;
    }
}

/* ══════════════════════════════════════════
   GRUPOS PRIVADOS
══════════════════════════════════════════ */

.fwcp-groups-wrap { max-width:640px; font-family:var(--wcp-font); }

.fwcp-group-create {
    background:#f8fafc; border:1px solid var(--wcp-border);
    border-radius:var(--wcp-radius); padding:18px 20px; margin-bottom:24px;
}
.fwcp-group-create h3 { margin:0 0 12px; font-size:1em; color:var(--wcp-primary); }
.fwcp-hint { font-size:0.82em; color:var(--wcp-muted); margin:8px 0 0; }

.fwcp-group-card {
    border:1px solid var(--wcp-border); border-radius:var(--wcp-radius);
    padding:16px 18px; margin-bottom:16px; background:#fff;
    box-shadow:var(--wcp-shadow);
}
.fwcp-group-header {
    display:flex; justify-content:space-between; align-items:center;
    margin-bottom:12px;
}
.fwcp-group-name { font-weight:700; font-size:1.05em; color:var(--wcp-primary); }
.fwcp-badge-count {
    display:inline-block; background:#e0f2fe; color:#0369a1;
    font-size:0.78em; font-weight:600; border-radius:999px;
    padding:2px 8px; margin-left:8px;
}

.fwcp-invite-box { margin:10px 0; }
.fwcp-invite-box label { font-size:0.85em; font-weight:600; color:var(--wcp-muted); margin-bottom:4px; display:block; }

.fwcp-members-list { margin-top:12px; border-top:1px solid var(--wcp-border); padding-top:10px; }
.fwcp-members-list p { margin:0 0 6px; font-size:0.88em; color:var(--wcp-muted); }
.fwcp-members-list ul { margin:0; padding:0; list-style:none; }

.fwcp-group-ranking h3 { font-size:1.05em; color:var(--wcp-primary); margin-bottom:10px; }

/* Botões */
.fwcp-btn {
    padding:9px 18px; font-size:0.93em; font-weight:600;
    background:var(--wcp-primary-light); color:#fff;
    border:none; border-radius:6px; cursor:pointer;
    transition:background 0.2s;
}
.fwcp-btn:hover { background:var(--wcp-primary); }

.fwcp-btn-sm {
    padding:4px 10px; font-size:0.8em; font-weight:600;
    background:#f1f5f9; color:var(--wcp-text);
    border:1px solid var(--wcp-border); border-radius:4px;
    cursor:pointer; transition:background 0.15s;
}
.fwcp-btn-sm:hover { background:#e2e8f0; }
.fwcp-btn-danger { color:#dc2626 !important; border-color:#fca5a5 !important; }
.fwcp-btn-danger:hover { background:#fef2f2 !important; }

/* ══════════════════════════════════════════
   HISTÓRICO DE POSIÇÕES
══════════════════════════════════════════ */

.fwcp-history-chart {
    max-width:700px; margin-bottom:24px;
    padding:16px; border:1px solid var(--wcp-border);
    border-radius:var(--wcp-radius); background:#fff;
    box-shadow:var(--wcp-shadow);
}
.fwcp-history-chart h3 { margin:0 0 14px; font-size:1em; color:var(--wcp-primary); }

.fwcp-history-table { max-width:480px; }

.fwcp-arrow { font-size:0.82em; font-weight:700; padding:2px 5px; border-radius:3px; }
.fwcp-arrow.fwcp-up   { color:#16a34a; background:#dcfce7; }
.fwcp-arrow.fwcp-down { color:#dc2626; background:#fee2e2; }
.fwcp-arrow.fwcp-same { color:#64748b; background:#f1f5f9; }
.fwcp-arrow.fwcp-new  { color:#7c3aed; background:#ede9fe; }

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */

.fwcp-badges-wrap { max-width:600px; margin-bottom:24px; }
.fwcp-badges-wrap h3 { font-size:1.05em; color:var(--wcp-primary); margin:0 0 14px; }

.fwcp-badges-grid {
    display:flex; flex-wrap:wrap; gap:12px;
}

.fwcp-badge {
    display:flex; flex-direction:column; align-items:center;
    width:88px; padding:12px 8px; border-radius:10px;
    border:2px solid transparent; cursor:default;
    transition:transform 0.15s, box-shadow 0.15s;
    text-align:center;
}
.fwcp-badge:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,0.1); }

.fwcp-badge-earned {
    background:linear-gradient(135deg,#fef9c3,#fef3c7);
    border-color:#f59e0b;
}
.fwcp-badge-locked {
    background:#f8fafc; border-color:#e2e8f0; opacity:0.5;
    filter:grayscale(1);
}

.fwcp-badge-icon { font-size:2em; line-height:1; margin-bottom:5px; }
.fwcp-badge-name { font-size:0.72em; font-weight:600; color:var(--wcp-primary); line-height:1.2; }

/* Tabela todos os badges */
.fwcp-badges-all { max-width:600px; }

/* ══════════════════════════════════════════
   RESPONSIVO — NOVOS MÓDULOS
══════════════════════════════════════════ */

@media (max-width:600px) {
    .fwcp-badges-grid { gap:8px; }
    .fwcp-badge { width:76px; padding:10px 6px; }
    .fwcp-badge-icon { font-size:1.7em; }
    .fwcp-group-header { flex-direction:column; align-items:flex-start; gap:8px; }
}

/* ── Pontuação personalizada por grupo ─────────────────────── */
.fwcp-scoring-section {
    margin-top: 12px;
    border-top: 1px dashed #ddd;
    padding-top: 10px;
}

.fwcp-scoring-body table {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}

.fwcp-scoring-body table tbody tr:hover {
    background: #f0f4ff;
}

.fwcp-scoring-badge {
    display: inline-block;
    font-size: 11px;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 2px 7px;
    margin-left: 8px;
    vertical-align: middle;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Ranking interativo do grupo [wcp-meu-grupo-ranking] ───── */
.fwcp-my-group-ranking {
    margin: 0 auto;
}

.fwcp-mgr-controls {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
}

.fwcp-mgr-controls label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    display: block;
    margin-bottom: 4px;
}

.fwcp-mgr-controls select {
    min-width: 180px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.fwcp-mgr-output {
    margin-top: 16px;
    min-height: 60px;
}

.fwcp-mgr-output .fwcp-group-ranking {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.fwcp-mgr-output .fwcp-group-ranking > div:first-child strong {
    font-size: 15px;
    color: #1e293b;
}

/* ── Responsivo: empilha controles em telas pequenas ────────── */
@media (max-width: 600px) {
    .fwcp-mgr-controls {
        flex-direction: column;
        align-items: stretch !important;
    }
    .fwcp-mgr-controls select {
        width: 100%;
        min-width: unset;
    }
}

/* ── Legenda de critérios de desempate ──────────────────── */
.fwcp-tiebreak-legend {
    font-size: 11px;
    color: #9ca3af;
    margin: 6px 0 0;
    padding: 6px 10px;
    border-top: 1px solid #f3f4f6;
    line-height: 1.6;
}
.fwcp-tiebreak-legend strong {
    color: #6b7280;
}

/* ── Countdown timer bônus ──────────────────────────────── */
.fwcp-deadline-box {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
}

.fwcp-countdown {
    display: inline-block;
    font-size: 15px;
    letter-spacing: .03em;
    padding: 3px 10px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #bfdbfe;
    font-weight: 600;
    color: #2563eb;
    min-width: 110px;
    text-align: center;
}