/* ── Base ── */
body {
    background: #f1f5f9;
    color: #1e293b;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ── Neutraliza utilitários Tailwind escuros ── */
.text-slate-50 { color: #1e293b !important; }
.text-white    { color: #1e293b !important; }
.text-white\/85 { color: #334155 !important; }
.text-white\/78 { color: #475569 !important; }
.text-white\/70 { color: #64748b !important; }
.text-white\/65 { color: #64748b !important; }
.text-white\/60 { color: #94a3b8 !important; }

/* ── Card ── */
.glass {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
    border-color: transparent !important;
}

/* ── Logo ── */
.logo {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: contain;
    flex-shrink: 0;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: linear-gradient(135deg, #16a34a, #4ade80);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    flex-shrink: 0;
}

/* ── Form ── */
.label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
}

.input {
    width: 100%;
    border-radius: 12px;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #1e293b;
    outline: none;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}

.input:focus {
    border-color: #16a34a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .10);
}

.input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* ── Buttons ── */
.btn {
    border-radius: 12px;
    padding: 11px 18px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    background: #16a34a;
    color: #fff !important;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
}

.btn:hover {
    background: #15803d;
    box-shadow: 0 4px 14px rgba(22, 163, 74, .28);
}

.btn-secondary {
    border-radius: 12px;
    padding: 11px 18px;
    font-weight: 700;
    font-size: 14px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #475569 !important;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* ── Pill ── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1f5f9;
    font-size: 12px;
    font-weight: 500;
    color: #475569 !important;
    border: none !important;
}

/* ── Tabs ── */
.tab {
    padding: 8px 18px;
    border-radius: 999px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all .15s;
}

.tab:hover {
    border-color: #16a34a;
    color: #16a34a;
}

.tab.active {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(22, 163, 74, .22);
}

/* ── Table ── */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    font-size: 13px;
    vertical-align: middle;
    color: #1e293b;
}

.table th {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Status ── */
.bad  { color: #dc2626; font-weight: 700; }
.ok   { color: #16a34a; font-weight: 700; }
.warn { color: #d97706; font-weight: 700; }

/* ── Sidebar ── */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 10px 10px 4px;
}

.nav-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 6px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    text-align: left;
    transition: background .12s, color .12s;
}

.nav-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.nav-item.active {
    background: #f0fdf4;
    color: #16a34a;
    font-weight: 600;
}

.nav-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Mobile sidebar toggle button */
.sidebar-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}

/* ── Sidebar overlay backdrop ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 40;
}

.sidebar-overlay.open {
    display: block;
}

/* Sidebar drawer: abaixo de 1200px */
@media (max-width: 1200px) {
    .sidebar-toggle {
        display: flex;
    }

    .app-layout {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* Drawer lateral */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px !important;
        max-width: 85vw;
        z-index: 50;
        border-radius: 0 20px 20px 0 !important;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform .25s ease;
        display: block !important;
    }

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

    .sidebar-nav {
        flex-direction: column;
        gap: 2px;
        padding: 0;
    }

    .nav-section-label,
    .nav-divider {
        display: block !important;
    }

    #adminNavSection {
        display: block !important;
    }

    .nav-item {
        width: 100% !important;
        padding: 11px 14px;
        font-size: 14px;
    }
}

/* ── Collapse ── */
.collapse-header {
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}

.collapse-header:hover {
    background: #f8fafc;
}

.collapse-body {
    overflow: hidden;
    transition: max-height .25s ease, opacity .2s ease, padding .2s ease;
    max-height: 2000px;
    opacity: 1;
}

.collapse-body.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.collapse-icon {
    color: #94a3b8;
    transition: transform .22s ease;
    flex-shrink: 0;
}

.collapse-icon.rotated {
    transform: rotate(-90deg);
}

/* ── Pred table (fixed layout para inputs alinhados) ── */
.pred-table {
    table-layout: fixed;
    width: 100%;
}
.pred-table colgroup col:first-child { width: 130px; }
.pred-date-cell {
    width: 130px;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    vertical-align: middle;
}

/* ── Bet status badges ── */
.bet-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.bet-badge--open   { background: #dcfce7; color: #15803d; }
.bet-badge--closed { background: #fee2e2; color: #dc2626; }
.bet-time          { font-size: 10px; color: #64748b; white-space: nowrap; }
.bet-time--urgent  { color: #dc2626; font-weight: 600; }

/* ── Alerta palpites urgentes ── */
.preds-alert {
    background: #fff7ed;
    border: 1.5px solid #fed7aa;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
}
.preds-alert-title {
    font-size: 13px;
    font-weight: 700;
    color: #c2410c;
    margin-bottom: 8px;
}
.preds-alert-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.preds-alert-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}
.preds-alert-match { color: #374151; font-weight: 500; }
.preds-alert-time  { color: #dc2626; font-weight: 700; }
.match-badge-col { display: flex; align-items: center; gap: 6px; }

/* ── Match prediction row ── */
.match-pred-row {
    display: grid;
    grid-template-columns: minmax(0, 180px) auto 1fr;
    align-items: center;
    gap: 8px;
}

.match-team--home {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.match-team--away {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.match-away-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.match-away-name {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 190px;
    min-width: 190px;
    overflow: hidden;
}

.match-team--home .team-name,
.match-team--away .team-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-score {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.match-input {
    width: 52px !important;
    padding: 8px 4px !important;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
}

.match-sep {
    font-size: 14px;
    font-weight: 700;
    color: #94a3b8;
}

/* ── Steppers ── */
.stepper-btns {
    display: none;
    flex-direction: column;
    gap: 2px;
}
.stepper-btn {
    width: 34px;
    height: 26px;
    border-radius: 6px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background .1s, transform .08s;
}
.stepper-btn:active { background: #e2e8f0; transform: scale(0.9); }
.stepper-btn:disabled { opacity: 0.35; cursor: default; }
.stepper-val {
    min-width: 26px;
    text-align: center;
    font-weight: 700;
    font-size: 17px;
    color: #1e293b;
}

.result-num {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 17px;
    color: #1e293b;
    line-height: 1;
}
.result-num.no-result {
    color: #cbd5e1;
    font-size: 14px;
}

/* ── Teams / Flags ── */
.team-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.team-flag {
    width: 28px;
    height: 21px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
    flex-shrink: 0;
}

/* ── Pred badges (resultado) ── */
.pred-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.pred-badge--p7 { background: #14532d; color: #fff; }
.pred-badge--p4 { background: #16a34a; color: #fff; }
.pred-badge--p3 { background: #bbf7d0; color: #14532d; }
.pred-badge--p1 { background: #dcfce7; color: #166534; }
.pred-badge--p0 { background: #fff;    color: #16a34a; border: 1.5px solid #bbf7d0; }

.pts-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    background: #f0fdf4;
    color: #15803d;
}

/* ── Resultado: extra info row ── */
.res-my-pred {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}
.res-all-link {
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 3px 9px;
    white-space: nowrap;
    transition: background .12s, color .12s;
}
.res-all-link:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-box {
    width: 100%;
    max-width: 460px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}
.modal-close-btn:hover { color: #475569; }

/* ── Filter badges ── */
.filter-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    transition: background .15s, color .15s, border-color .15s;
}
.filter-badge:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}
.filter-badge.active {
    background: #f0fdf4;
    border-color: #16a34a;
    color: #16a34a;
    font-weight: 600;
}

/* ── Code ── */
code {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 12px;
}

/* ── Evita zoom automático no iOS ao focar inputs (font-size < 16px dispara zoom) ── */
@media (max-width: 800px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* ── Palpites: responsividade mobile ── */
@media (max-width: 800px) {
    /* Reduz padding do wrapper externo: 16px → 8px por lado (+16px) */
    #app-wrapper {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Reduz padding da section: p-5(20px) → 12px por lado (+16px) */
    .tab-section {
        padding: 12px !important;
    }

    /* Reduz padding do collapse-body: px-5(20px) → 8px por lado (+24px) */
    .collapse-body {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Steppers no mobile */
    .stepper-btns { display: flex; }
    .stepper-btn { width: 32px; height: 24px; font-size: 16px; }
    /* Remove o table-layout fixed e zera a col reservada para a data */
    .pred-table { table-layout: auto !important; }
    .pred-table col:first-child { width: 0 !important; }

    /* Oculta coluna de data — vem via ::before */
    .pred-date-cell { display: none !important; }
    .pred-table thead { display: none; }

    /* Grid 4 colunas: flag | 1fr | 1fr | flag
       Linha 1: nomes se expandem sobre as colunas das bandeiras
       Linha 2: bandeiras nas extremidades, score no centro         */
    .match-pred-row {
        display: grid !important;
        grid-template-columns: auto 1fr 1fr auto;
        grid-template-areas:
            "date   date   date   date"
            "hname  hname  aname  aname"
            "hflag  score  score  aflag"
            "badge  badge  badge  badge";
        align-items: center;
        gap: 4px 6px;
        width: 100%;
    }

    /* Linha 0: data */
    .match-pred-row::before {
        content: attr(data-date);
        grid-area: date;
        font-size: 11px;
        color: #94a3b8;
        text-align: center;
    }

    /* Expõe filhos diretamente ao grid */
    .match-team--home   { display: contents; }
    .match-away-wrapper { display: contents; }
    .match-away-name    { display: contents; }

    /* Linha 1: nomes */
    .match-team--home > .team-name {
        grid-area: hname;
        text-align: left;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        align-self: end;
    }
    .match-away-name > .team-name {
        grid-area: aname;
        text-align: right;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        align-self: end;
    }

    /* Linha 2: bandeiras nas extremidades */
    .match-team--home > .team-flag {
        grid-area: hflag;
        align-self: center;
    }
    .match-away-name > .team-flag {
        grid-area: aflag;
        align-self: center;
        justify-self: end;
    }

    /* Linha 2: score centralizado entre as bandeiras */
    .match-score {
        grid-area: score;
        justify-content: center;
    }

    /* Linha 3: badge centralizado */
    .match-badge-col {
        grid-area: badge;
        justify-content: center;
    }
}

/* ── Extras Summary: responsividade mobile ── */
@media (max-width: 800px) {
    #extrasSummaryTable,
    #extrasSummaryTable tbody {
        display: block !important;
        width: 100%;
    }

    /* Oculta cabeçalho de colunas */
    #extrasSummaryTable thead { display: none; }

    /* Cada participante vira um card */
    #extrasSummaryTable tbody tr {
        display: block;
        width: 100%;
        padding: 12px 0;
        border-bottom: 1px solid #f1f5f9;
    }
    #extrasSummaryTable tbody tr:last-child { border-bottom: none; }

    /* Cada célula vira uma linha: label + valor */
    #extrasSummaryTable tbody tr td {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 3px 0 !important;
        font-size: 13px;
        border: none;
    }

    /* Nome do participante — destaque, sem label */
    #extrasSummaryTable tbody tr td:first-child {
        font-size: 14px;
        font-weight: 700;
        padding-bottom: 8px !important;
        border-bottom: 1px solid #f8fafc;
        margin-bottom: 4px;
    }

    /* Labels automáticos via ::before */
    #extrasSummaryTable tbody tr td:nth-child(2)::before { content: "Campeão:"; }
    #extrasSummaryTable tbody tr td:nth-child(3)::before { content: "Vice:"; }
    #extrasSummaryTable tbody tr td:nth-child(4)::before { content: "Terceiro:"; }
    #extrasSummaryTable tbody tr td:nth-child(5)::before { content: "Artilheiro:"; }
    #extrasSummaryTable tbody tr td:nth-child(6)::before { content: "Pontos:"; }

    #extrasSummaryTable tbody tr td:nth-child(2)::before,
    #extrasSummaryTable tbody tr td:nth-child(3)::before,
    #extrasSummaryTable tbody tr td:nth-child(4)::before,
    #extrasSummaryTable tbody tr td:nth-child(5)::before,
    #extrasSummaryTable tbody tr td:nth-child(6)::before {
        color: #94a3b8;
        font-size: 12px;
        font-weight: 500;
        min-width: 80px;
        flex-shrink: 0;
    }
}

/* Conteúdo alternativo desktop/mobile no ranking */
.rank-mobile { display: none; }
.rank-desktop { display: inline; }

/* ── Ranking: responsividade mobile ── */
@media (max-width: 800px) {
    .rank-mobile { display: inline; }
    .rank-desktop { display: none; }
    .rank-table,
    .rank-table tbody {
        display: block !important;
        width: 100%;
    }

    .rank-table colgroup { display: none; }

    /* Cada linha vira grid: conteúdo (3 linhas) | badge (direita) */
    .rank-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "date  badge"
            "teams badge"
            "score badge";
        column-gap: 8px;
        row-gap: 3px;
        padding: 8px 0;
        border-bottom: 1px solid #f1f5f9;
        align-items: center;
    }
    .rank-table tbody tr:last-child { border-bottom: none; }

    /* Linha 1 — data/hora, centralizado */
    .rank-table tbody tr td:nth-child(1) {
        grid-area: date;
        font-size: 11px !important;
        color: #94a3b8 !important;
        padding: 0 !important;
        white-space: nowrap !important;
        text-align: center !important;
    }

    /* Linha 2 — times, centralizado */
    .rank-table tbody tr td:nth-child(2) {
        grid-area: teams;
        font-size: 12px !important;
        padding: 0 !important;
        text-align: center !important;
    }

    /* Linha 3 — placar final (palpite) */
    .rank-table tbody tr td:nth-child(3) {
        grid-area: score;
        font-size: 12px !important;
        padding: 0 !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    /* Badge — direita, centralizado verticalmente */
    .rank-table tbody tr td:nth-child(4) {
        grid-area: badge;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
    }

    /* Linha "sem jogos" com colspan */
    .rank-table tbody tr td[colspan] {
        grid-column: 1 / -1;
    }
}

/* ── Topbar mobile < 340px ── */
@media (max-width: 800px) {
    .topbar-inner {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .topbar-left {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        gap: 8px !important;
    }

    .topbar-pills {
        display: none !important;
    }

    #userBar {
        flex-direction: column !important;
        align-items: center !important;
        width: 100%;
        gap: 8px !important;
    }

    .userbar-info {
        justify-content: center;
    }

    .topbar-user-name {
        display: block !important;
        text-align: center !important;
    }

    #btnLogout {
        width: 100%;
    }

    #subStatusGuest {
        display: none !important;
    }
}

/* ── Ao Vivo ── */
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.7); }
}
