* { margin: 0; padding: 0; box-sizing: border-box; }

header h1 { font-size: 1.5rem; margin-bottom: 5px; text-align: left;}

/* Paineis de Info */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; margin: 40px 0; }
@media (max-width: 800px) { .info-grid { grid-template-columns: 1fr; } }

.info-box { background: var(--bg-card); padding: 20px; border: 1px solid var(--card-border); font-size: 0.9rem; box-shadow: -7px 7px 0 1px var(--card-shadow); }
.info-box h3 { margin-bottom: 10px; border-bottom: 2px solid var(--card-border); padding-bottom: 5px; display: inline-block; }
.info-box ul { list-style-type: none; padding-left: 0; }
.info-box li { margin-bottom: 6px; line-height: 1.4; position: relative; padding-left: 15px; }
.info-box li::before { content: "•"; color: #e94560; font-weight: bold; position: absolute; left: 0; }

/* Lista de Repescagem */
.playoff-list strong { display: block; margin-top: 5px; font-size: 0.95rem; }
.playoff-group-items { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; margin-top: 4px; }
.playoff-item { display: inline-flex; align-items: center; background: var(--card-shadow); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--card-border); font-size: 0.85rem; }

.flag-mini { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; margin-right: 5px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

/* Barra de Ação */
.action-bar { display: flex; gap: 10px; margin-bottom: 20px; align-items: stretch; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; flex: 0 0 auto; }

.controls button { padding: 0 20px; height: 50px; font-size: 0.9rem; font-weight: bold; cursor: pointer; transition: all 0.2s ease; text-transform: uppercase; letter-spacing: 0.5px; color: white; display: flex; align-items: center; gap: 8px; }

#sortearTudoBtn { background: var(--card-shadow); color: #e97e72; border: 1px solid var(--card-border); }
#sortearUmBtn { background: var(--card-shadow); border: 1px solid var(--card-border); color: #27ae60; }
#resetBtn { background: var(--card-shadow); border: 1px solid var(--card-border); color: #3498db; }
#printBtn { background: var(--card-shadow); border: 1px solid var(--card-border); color: #9b59b6; }

button:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
button:active { transform: scale(0.98); }

.status { flex: 1; text-align: center; padding: 0 20px; font-size: 0.9rem; background: var(--card-shadow); border: 1px solid var(--card-border); font-weight: 600; height: 50px; display: flex; align-items: center; justify-content: center; margin-bottom: 0; text-transform: uppercase; }

@media (max-width: 850px) {
    .action-bar { flex-direction: column; }
    .controls { justify-content: center; width: 100%; }
    .status { width: 100%; }
    button { flex: 1; justify-content: center; }
}

/* Bandeiras */
.flag-img, .flag-custom { width: 24px; height: 18px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); display: inline-block; vertical-align: middle; margin-right: 8px; }
.flag-img { object-fit: cover; background: #eee; }
.flag-custom { display: inline-flex; align-items: center; justify-content: center; color: white; font-weight: 900; font-family: sans-serif; font-size: 10px; letter-spacing: 0.5px; }
.flag-eu { background-color: #003399; }
.flag-int { background-color: #009b3a; }

/* Potes */
.potes-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 30px; }
.pote { background: var(--bg-card); padding: 10px; border: 1px solid var(--card-border); }
.pote h3 { text-align: center; margin-bottom: 8px; font-size: 0.9rem; padding: 4px; color: white; }
.pote1 h3 { background: #e74c3c; }
.pote2 h3 { background: #f39c12; }
.pote3 h3 { background: #27ae60; }
.pote4 h3 { background: #f1c40f; color: #333; }
.pote-teams { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; font-size: 0.75rem; }

.team-badge { padding: 4px 8px; background: var(--card-shadow); border-radius: 4px; transition: 0.3s; border: 1px solid var(--card-border); display: flex; align-items: center; }
.team-badge.sorted { opacity: 0.4; text-decoration: line-through; background: #ddd; filter: grayscale(100%); }
.team-badge.current { background: var(--accent-cyan); color: #FFF; transform: scale(1.1); border-color: var(--card-border); z-index: 2; }
.team-badge.current .flag-img { border: 1px solid white; }

/* Grupos */
.groups-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
@media (max-width: 1024px) { .groups-container { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .groups-container { grid-template-columns: repeat(2, 1fr); } .potes-container { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .groups-container { grid-template-columns: 1fr; } .potes-container { grid-template-columns: 1fr; } }

.group { background: var(--bg-card); border: 1px solid var(--card-border); }
.group-header { background: rgba(0, 140, 140, 0.1); color: var(--accent-cyan); padding: 8px; text-align: center; font-weight: bold; border-bottom: 1px solid var(--card-border);}
.group-slot { display: flex; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--card-border); height: 40px; font-size: 0.9rem; position: relative; }
.group-slot:last-child { border-bottom: none; }

/* Cores das Bordas baseadas no POTE */
.group-slot.pot1 { border-left: 4px solid #e97e72; }
.group-slot.pot2 { border-left: 4px solid #f1be6c; }
.group-slot.pot3 { border-left: 4px solid #60b483; }
.group-slot.pot4 { border-left: 4px solid #ffe57d; }
.group-slot.filled { background-color: var(--card-shadow); }

.slot-pos { font-size: 0.7rem; color: #999; margin-right: 8px; font-weight: bold; width: 10px; }
.slot-team { font-weight: 600; margin-left: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.conf-label { font-size: 0.65rem; color: #999; margin-left: auto; font-weight: bold; padding-left: 5px; }

.highlight { animation: flash 0.5s ease-in-out infinite;  }
@keyframes flash {
0% {
    background-color: #008c8c;
    color: white;
}
50% {
    background-color: #008c8c7c;
}
100% {
    background-color: #008c8c00
}
}

/* Animação de Grupo Inválido (Conflito de Regra) */
.group-slot.error { 
    animation: flash-error 0.4s ease-in-out; 
    background-color: #ffe6e6; 
    border-left-color: #e74c3c !important; /* Força borda vermelha */
}

@keyframes flash-error {
    0% { background-color: #e74c3c; color: white; }
    50% { background-color: #ffcccc; color: #333; }
    100% { background-color: var(--bg-card); }
}

/* Ajuste para o texto do status durante a verificação */
.status.checking {
    color: #e67e22;
    font-weight: bold;
}