:root { 
    --primary: #e10600; 
    --dark: #15151e; 
    --light: #f3f3f3; 
    --green: #2e7d32; 
    --gray: #666; 
}

/* RESET E BASE */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { overflow-x: hidden; width: 100%; }
body { font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: var(--light); margin: 0; padding: 15px; color: #333; display: flex; flex-direction: column; align-items: center; min-height: 100vh; }
h1, h2, h3 { color: var(--dark); margin-bottom: 15px; font-weight: 700; line-height: 1.2; }

/* LAYOUT */
.logo-container { width: 100%; max-width: 1100px; text-align: center; margin: 10px 0 20px 0; padding: 0 10px; }
#secao-login { width: 100%; max-width: 400px; margin: 20px auto; background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
#secao-principal { width: 100%; max-width: 1100px; margin: 0 auto; }

/* HEADER */
.header-app { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: white; padding: 15px 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); flex-wrap: wrap; gap: 10px; }

/* DASHBOARD */
.nav-dashboard { display: grid; grid-template-columns: 280px 1fr; gap: 20px; margin-bottom: 25px; width: 100%; }
.gp-widget { background: var(--dark); color: white; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; border-left: 6px solid var(--primary); box-shadow: 0 4px 15px rgba(0,0,0,0.15); width: 100%; }
.gp-widget-label { font-size: 0.75em; text-transform: uppercase; letter-spacing: 2px; color: #bbb; margin-bottom: 8px; }
.gp-widget-name { font-size: 1.3em; font-weight: 800; margin-bottom: 5px; line-height: 1.1; }
.gp-widget-timer { font-size: 1.4em; font-weight: bold; color: var(--primary); background: rgba(255,255,255,0.1); padding: 8px 20px; border-radius: 30px; margin-top: 10px; white-space: nowrap; }

/* NAV BUTTONS */
.nav-buttons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; width: 100%; }
.tab-link { padding: 10px 5px; border: none; background: white; cursor: pointer; border-radius: 10px; font-weight: 600; font-size: 0.9em; color: #555; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: all 0.2s; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; text-align: center; }
.tab-link:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); color: var(--primary); }
.tab-link.active { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(225, 6, 0, 0.4); transform: translateY(0); }

/* CONTEUDO */
.tab-content { display: none; background: white; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); width: 100%; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* STATS */
.mini-stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 25px; }
.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.mini-stat, .stat-box { background: #f8f9fa; border: 1px solid #eee; border-radius: 10px; padding: 10px 5px; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; width: 100%; }
.mini-label, .stat-label { font-size: 0.7em; color: #777; text-transform: uppercase; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mini-value, .stat-value { font-size: 1.2em; font-weight: 800; color: var(--dark); line-height: 1; word-break: break-all; }

/* FILTRO RIVAIS */
.ranking-filter-container { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; padding: 0 10px; }
.btn-filter { padding: 10px 20px; border: 1px solid #e0e0e0; background: white; border-radius: 8px; cursor: pointer; font-size: 0.95em; font-weight: 600; color: #555; transition: all 0.2s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.05); flex: 1; max-width: 160px; }
.btn-filter:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); color: var(--primary); }
.btn-filter.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 4px 12px rgba(225, 6, 0, 0.3); }

/* ESTRELAS */
.star-btn { cursor: pointer; font-size: 1.1em; margin-right: 8px; transition: transform 0.2s; display: inline-block; }
.star-btn:active { transform: scale(1.4); }
.star-on { color: #d32f2f; text-shadow: 0 1px 2px rgba(0,0,0,0.2); } /* Caveira Vermelha/Escura */
.star-off { color: #d1d1d1; opacity: 0.5; }
.star-off:hover { color: #bbb; opacity: 1; }

/* MUNDIAL */
.list-header { display: flex; justify-content: space-between; align-items: center; margin-top: 25px; margin-bottom: 12px; border-bottom: 2px solid #eee; padding-bottom: 8px; }
.list-header h3 { margin: 0; font-size: 1em; text-transform: uppercase; color: #444; }
.btn-toggle-sm { background: white; border: 1px solid #ccc; color: #555; padding: 5px 12px; border-radius: 20px; font-size: 0.75em; cursor: pointer; font-weight: 700; white-space: nowrap; }
.sortable-list { list-style: none; padding: 0; margin: 0; counter-reset: ranking-counter; }
.sortable-item { background: white; border: 1px solid #e0e0e0; margin-bottom: 8px; padding: 12px 10px 12px 40px; border-radius: 8px; cursor: grab; position: relative; font-weight: 600; color: #444; font-size: 0.95em; }
.sortable-item::before { counter-increment: ranking-counter; content: counter(ranking-counter) "º"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #bbb; font-weight: 800; font-size: 0.9em; width: 20px; text-align: right; }

/* INPUTS E BOTOES */
input, select { width: 100%; padding: 12px; margin: 5px 0 15px 0; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; background: #fff; max-width: 100%; }
.btn-primary { background: var(--primary); color: white; border: none; padding: 12px; width: 100%; border-radius: 8px; cursor: pointer; font-size: 1em; font-weight: bold; }
.btn-secondary { background: var(--dark); color: white; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9em; }
.btn-danger { background: #333; color: white; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-size: 0.9em; font-weight: 600; }
.btn-warning { background: #ff9800; color: white; border: none; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600; width: 100%; }
.btn-success { background: var(--green); color: white; border: none; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600; width: 100%; }
.login-actions { display: flex; justify-content: space-between; margin-top: 15px; gap: 10px; }
.btn-outline { background: transparent; border: 1px solid #ccc; color: #666; padding: 10px; border-radius: 8px; cursor: pointer; font-size: 0.9em; width: 100%; font-weight: 600; }
.notification-box { margin-top: 25px; padding: 15px; background: white; border-radius: 12px; border: 1px solid #eee; text-align: center; width: 100%; }
.btn-notif { padding: 12px; border-radius: 8px; border: none; cursor: pointer; font-weight: bold; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.95em; }
.btn-notif.off { background: #eee; color: #666; border: 1px solid #ddd; }
.btn-notif.on { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }

/* WHATSAPP BUTTONS */
.btn-whatsapp { display: block; width: 100%; padding: 12px; background-color: #25D366; color: white; text-align: center; border-radius: 8px; text-decoration: none; font-weight: bold; font-size: 0.95em; transition: background 0.2s; }
.btn-whatsapp:hover { background-color: #1da851; }

.filter-row { display: flex; gap: 8px; margin-bottom: 15px; align-items: center; width: 100%; }
.filter-row select { flex: 1; margin: 0; min-width: 0; }
.filter-row button { width: auto; padding: 12px 15px; margin: 0; flex-shrink: 0; }

/* TABLE & SCROLL */
div[style*="overflow-x:auto"] { width: 100%; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; min-width: 600px; }
th, td { padding: 12px 8px; border-bottom: 1px solid #eee; text-align: center; font-size: 0.9em; }
th { background: #f9f9f9; color: #555; font-weight: 600; font-size: 0.8em; white-space: nowrap; }

/* MODAL */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2000; backdrop-filter: blur(2px); }
.modal-content { background: white; margin: 10% auto; padding: 25px; width: 90%; max-width: 400px; border-radius: 15px; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,0.3); animation: slideDown 0.3s ease; }
@keyframes slideDown { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.close-btn { position: absolute; right: 15px; top: 15px; cursor: pointer; font-size: 1.8em; color: #999; line-height: 1; padding: 5px; }

/* MOBILE */
@media (max-width: 850px) {
    body { padding: 10px; }
    #secao-login { max-width: 100%; margin: 10px 0; padding: 25px 20px; }
    .header-app { flex-direction: column; align-items: stretch; gap: 15px; padding: 15px; text-align: center; }
    .header-app > div:first-child { width: 100%; margin-bottom: 5px; }
    .header-app > div:last-child { display: flex; gap: 10px; width: 100%; justify-content: space-between; }
    #btn-abrir-perfil, #btn-logout { flex: 1; padding: 12px; justify-content: center; display: flex; align-items: center; }
    .nav-dashboard { grid-template-columns: 1fr; gap: 15px; margin-bottom: 20px; }
    .gp-widget { flex-direction: row; justify-content: space-between; align-items: center; text-align: left; padding: 15px; border-left: 6px solid var(--primary); }
    .gp-widget-label { display: none; }
    .gp-widget-name { font-size: 1.1em; margin: 0; }
    .gp-widget-timer { margin-top: 0; font-size: 1em; padding: 6px 12px; }
    .nav-buttons-grid { grid-template-columns: repeat(3, 1fr); }
    .tab-link { font-size: 0.85em; padding: 8px; }
    .tab-content { padding: 15px; }
    .mini-stats-grid { grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
    .mini-value { font-size: 1.1em; }
    .grid-stats { grid-template-columns: 1fr 1fr; gap: 10px; }

    /* TABELAS RESPONSIVAS */
    #view-etapas table, #view-apostar table, #view-painel table, #view-mundial table, #view-equipes table {
        min-width: 0 !important; width: 100%; table-layout: fixed;
    }
    #view-etapas td, #view-etapas th, #view-apostar td, #view-apostar th, #view-painel td, #view-painel th, #view-mundial td, #view-mundial th, #view-equipes td, #view-equipes th {
        white-space: normal; word-wrap: break-word; padding: 10px 4px; font-size: 0.8em;
    }
    #view-apostar table td:nth-child(2) { font-size: 0.75em; }
    #view-classificacao table { min-width: 650px; }

    @media (max-width: 350px) { .login-actions { flex-direction: column; } }
}