:root {
    --br-green: #009c3b; --br-yellow: #ffdf00; --br-blue: #002776;
    --bg-light: #f4f6f8; --text-dark: #333; --white: #ffffff; --error: #d9534f;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Roboto', sans-serif; }
body { background-color: var(--bg-light); color: var(--text-dark); overflow-x: hidden; }

/* MODAL */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
    z-index: 2000; opacity: 1; transition: opacity 0.3s;
}
.modal-overlay.hidden { display: none; opacity: 0; }
.modal-content { background: #fff; padding: 30px; border-radius: 8px; width: 90%; max-width: 400px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.modal-content p { font-size: 1.1rem; margin-bottom: 25px; line-height: 1.4; font-weight: bold; color: var(--br-blue); }
.modal-btns { display: flex; gap: 15px; justify-content: center; }

/* Header & Layout */
.main-header {
    position: fixed; top: 0; left: 0; width: 100%; height: 70px;
    background: linear-gradient(90deg, var(--br-green) 0%, var(--br-blue) 100%);
    display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.2); z-index: 1000;
}
.menu-btn { display: none; background: none; border: none; color: white; font-size: 1.8rem; cursor: pointer; padding: 5px; }
.logo-container { color: var(--white); display: flex; align-items: center; gap: 10px; font-size: 1.2rem; margin: 0 auto; }
.header-spacer { width: 30px; display: none; } 

.app-layout { display: flex; height: 100vh; padding-top: 70px; }
.sidebar { width: 240px; background-color: var(--white); border-right: 1px solid #ddd; padding: 20px 10px; overflow-y: auto; flex-shrink: 0; z-index: 999; }
.sidebar-overlay { display: none; position: fixed; top: 70px; left: 0; width: 100%; height: calc(100vh - 70px); background: rgba(0,0,0,0.5); z-index: 998; }
.menu-title { font-size: 0.8rem; color: #888; text-transform: uppercase; margin-bottom: 15px; padding-left: 10px; }
.menu-item { display: block; padding: 12px 15px; color: var(--br-blue); cursor: pointer; font-weight: bold; border-radius: 6px; margin-bottom: 5px; transition: 0.2s; }
.menu-item:hover { background-color: rgba(0, 156, 59, 0.1); color: var(--br-green); }

.content-area { flex: 1; padding: 30px; overflow-y: auto; background-color: var(--bg-light); width: 100%; }

/* Cards */
.card { background: var(--white); padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); display: none; max-width: 500px; margin: 0 auto; text-align: center; }
.card.wide-card { max-width: 900px; } 
.card.active { display: block; animation: fadeIn 0.3s; }
h2 { margin-bottom: 25px; color: var(--br-blue); }
.subtitle-small { font-size: 0.85rem; color: #666; margin-top: -15px; margin-bottom: 20px; }

/* Regulamento */
.regulamento-text { text-align: left; font-size: 1rem; line-height: 1.6; }
.reg-list-main { list-style-type: none; padding-left: 0; }
.reg-list-main > li { margin-bottom: 20px; }
.reg-list-main > li > strong { color: var(--br-blue); font-size: 1.1rem; display: block; margin-bottom: 8px; }
.reg-sublist { list-style-type: none; padding-left: 20px; margin-top: 10px; }
.reg-sublist li { margin-bottom: 8px; }
.pix-item { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.btn-copy { padding: 4px 10px; font-size: 0.85rem; background: var(--br-green); color: white; border: none; border-radius: 4px; cursor: pointer; transition: 0.2s; font-weight: bold; }
.btn-copy:hover { background: #007a2e; }

/* Grid de Jogos e Apostas */
.flag-icon { width: 30px; height: 20px; border-radius: 2px; border: 1px solid #ccc; object-fit: cover; }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 20px; margin-top: 20px; }
.game-card { border: 1px solid #eee; border-radius: 8px; padding: 15px; background: #fafafa; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.game-info { font-size: 0.95rem; color: #333; margin-bottom: 10px; text-align: center; }
.match-input { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.1rem; font-weight: bold; width: 100%; }

.team-name { width: 90px; text-align: center; font-size: 0.9rem; word-wrap: break-word; line-height: 1.2; }

.score-input { width: 40px; padding: 5px; text-align: center; font-size: 1.2rem; border-radius: 5px; border: 1px solid #ccc; font-weight: bold; }
.score-input::-webkit-outer-spin-button, .score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input[type=number] { -moz-appearance: textfield; }
.vs { color: var(--br-yellow); text-shadow: 1px 1px 0 #999; margin: 0 5px; }
.earned-points { text-align: center; font-weight: bold; font-size: 1.1rem; color: var(--br-green); margin-top: 5px; }
.official-result-display { text-align: center; font-weight: bold; font-size: 1.1rem; color: var(--br-blue); margin-top: 15px; margin-bottom: 5px; }

/* Stats Custom Cards */
.stats-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 20px; align-items: stretch; }
.stats-grid-2 { display: flex; justify-content: center; gap: 15px; margin-top: 20px; flex-wrap: wrap; align-items: stretch; }
.stats-grid-2 .stat-card { flex: 1 1 300px; max-width: 400px; }

/* Alinhamento corrigido para o topo de maneira consistente */
.stat-card { 
    border: 1px solid #eee; border-radius: 8px; padding: 15px; 
    background: #fafafa; display: flex; flex-direction: column; 
    align-items: center; justify-content: flex-start; 
    min-height: 120px; height: 100%; width: 100%; overflow: hidden;
}
.stat-title { font-size: 0.9rem; color: #555; text-align: center; margin-bottom: 10px; font-weight: bold; width: 100%; }
.stat-value { font-size: 2rem; font-weight: bold; color: var(--br-blue); margin-top: auto; margin-bottom: auto; text-align: center; }
.stat-subtitle { font-size: 1.1rem; color: var(--text-dark); margin-top: 5px; text-align: center; }
.stat-game-content { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 100%; margin-top: 10px; margin-bottom: auto; }
.stat-crav-number { font-size: 1.6rem; font-weight: bold; color: var(--br-blue); margin-top: 10px; text-align: center; }

/* Tabelas e Filtros */
.table-container { overflow-x: auto; width: 100%; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; text-align: left; font-size: 0.95rem; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid #ddd; }
.data-table th { background-color: var(--br-blue); color: var(--white); font-weight: bold; }
.data-table tr:hover { background-color: #f1f1f1; }

.name-cell { display: flex; justify-content: space-between; align-items: center; gap: 5px; }
.name-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.medals-container { display: flex; gap: 2px; flex-shrink: 0; }
.medal-icon { width: 18px; height: 18px; }

.filter-group { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; }
.filter-group select, .filter-group button { flex: 1; }

/* Meus Palpites Especifico */
.scrollable-list { max-height: 65vh; overflow-y: auto; border: 1px solid #ddd; border-radius: 5px; }

tr.crossed-out { background-color: #f9f9f9; }
tr.crossed-out .game-time-phase, 
tr.crossed-out .palpite-row-content { text-decoration: line-through; opacity: 0.6; }

.palpite-row-content { display: flex; align-items: center; justify-content: center; gap: 5px; font-weight: bold; font-size: 1.1rem; flex-wrap: wrap; }
.game-time-phase { width: 90px; text-align: center; font-size: 0.85rem; padding: 8px 4px !important; line-height: 1.2; border-right: 1px solid #eee; }
.score-exact { white-space: nowrap; margin: 0 4px; }

/* Navegação Fases */
.phase-nav { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 20px; }
.nav-arrow { background: none; border: none; font-size: 2rem; cursor: pointer; color: var(--br-blue); padding: 0 10px; }
.nav-arrow:disabled { color: #ccc; cursor: default; }
#current-phase-title { margin-bottom: 0; font-size: 1.3rem; text-align: center; flex: 1; }

/* Palpites automáticos */
.auto-fill-section { margin-top: 30px; border-top: 1px solid #eee; padding-top: 20px; }
.auto-fill-section h3 { font-size: 1.1rem; color: var(--br-blue); margin-bottom: 15px; }
.auto-fill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 250px; margin: 0 auto; }
.btn-autofill { width: 100%; padding: 8px 0; }

/* Forms Gerais e Admin */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.admin-block { text-align: left; margin-bottom: 20px; }
.admin-block h3 { font-size: 1rem; margin-bottom: 10px; color: #555; }
.code-box { background:#eee; padding:10px; margin-top:5px; max-height:200px; overflow:auto; font-size: 0.85rem; }
.result-admin-area { display:flex; align-items:center; gap:10px; justify-content:center; flex-wrap: wrap; }
.team-name-admin { font-weight: bold; font-size: 0.9rem; }
.score-input-admin { width:50px; text-align:center; padding: 5px; font-size: 1.1rem; }
hr { border: 0; border-top: 1px solid #eee; margin: 25px 0; }
.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 0.9rem; }
.input-group input, select, textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 1rem; background: #fff;}

/* Botões Login & Outros */
.btn-group-login { display: flex; gap: 20px; justify-content: center; margin-top: 25px; }
.forgot-link-container { margin-top: 20px; text-align: center; }
.link-small { font-size: 0.9rem; color: var(--br-blue); text-decoration: underline; cursor: pointer; }
.btn-group { display: flex; gap: 15px; justify-content: center; margin-top: 20px; }
.btn { padding: 12px 20px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; width: 100%; transition: 0.3s; font-size: 1rem; }
.btn-primary { background-color: var(--br-green); color: var(--white); }
.btn-primary:hover { background-color: #007a2e; }
.btn-primary:disabled { background-color: #ccc; cursor: not-allowed; }
.btn-outline { background: transparent; border: 2px solid var(--br-blue); color: var(--br-blue); }
.btn-outline:hover { background: var(--br-blue); color: var(--white); }
.error-msg { color: var(--error); margin-top: 15px; font-size: 0.9rem; min-height: 20px; line-height: 1.3; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ========================================= */
/* CSS RESPONSIVO PARA DISPOSITIVOS MÓVEIS */
/* ========================================= */
@media (max-width: 768px) {
    .menu-btn { display: block; }
    .header-spacer { display: block; }
    .logo-container h1 { font-size: 1.1rem; }
    
    .sidebar { position: fixed; left: -260px; top: 70px; height: calc(100vh - 70px); transition: left 0.3s ease; box-shadow: 2px 0 10px rgba(0,0,0,0.2); width: 250px; }
    .sidebar.open { left: 0; }
    
    .content-area { padding: 15px 10px; width: 100%; }
    .card { padding: 20px 10px; margin: 10px 0; width: 100%; }
    .btn-group-login { flex-direction: column; gap: 10px; }
    
    .games-grid { grid-template-columns: 1fr; gap: 15px; }
    
    .stats-grid-3 { grid-template-columns: 1fr; }
    .stats-grid-2 { flex-direction: column; align-items: center; }
    .stats-grid-2 .stat-card { width: 100%; max-width: 100%; padding: 15px 10px; }
    .stat-game-content { width: 100%; overflow: hidden; }

    .form-grid { grid-template-columns: 1fr; }
    .filter-group { flex-direction: column; align-items: stretch; }
    .filter-group select, .filter-group button { width: 100%; flex: none; }
    
    .match-input { gap: 4px; font-size: 1rem; }
    .team-name { width: 65px; font-size: 0.8rem; white-space: normal; word-wrap: break-word; }
    .score-input { width: 38px; min-height: 44px; font-size: 1.1rem; padding: 4px; } 
    .flag-icon { width: 25px; height: 16px; }
    .vs { font-size: 0.9rem; }
    
    .input-group input, .input-group select { min-height: 44px; }
    .btn { min-height: 44px; }

    .data-table th, .data-table td { padding: 8px 5px; font-size: 0.85rem; }
    
    /* Aumento do espaço reservado ao nome (de 100px para 140px) */
    .name-text { max-width: 140px; }

    .game-time-phase { width: 65px; font-size: 0.75rem; padding: 5px 2px !important; }
    .palpite-row-content { font-size: 0.9rem; gap: 2px; }
    .score-exact { margin: 0 2px; }
}