:root {
    --color-primary: #0a3d62; /* Azul corporativo genérico */
    --color-secondary: #05c46b; /* Verde éxito/deporte */
    --color-background: #f5f6fa;
    --color-surface: #ffffff;
    --color-text: #2f3640;
    --color-accent: #ffd32a;
    --font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: var(--color-primary);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* BRACKET LAYOUT */
.bracket-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 50px;
}

.round {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.round-title {
    text-align: center;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 10px;
}

.matchup {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #e1e4ea;
    padding: 15px;
    border-radius: 8px;
}

.team {
    background-color: var(--color-surface);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.team:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.team.selected {
    border-color: var(--color-secondary);
    background-color: #eafaf1;
}

.team.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.team .flag {
    width: 30px;
    height: 20px;
    border-radius: 2px;
    margin-right: 15px;
    background-size: cover;
    background-position: center;
    border: 1px solid #ddd;
}

.team .name {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Desktop layout */
@media (min-width: 992px) {
    .main-layout {
        display: flex;
        gap: 30px;
        align-items: flex-start;
    }
    .pool-section {
        flex: 0 0 450px;
    }
    .bracket-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .round {
        flex: 1;
        justify-content: space-around;
        min-height: 400px;
    }
    .matchup {
        background: transparent;
        padding: 0;
    }
    .team {
        position: relative;
    }
}

/* COUNTRIES POOL */
.pool-section {
    background: var(--color-surface);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Estilo barra de scroll para el pool */
.countries-grid::-webkit-scrollbar {
    width: 6px;
}
.countries-grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.country-pill {
    background: var(--color-background);
    border: 2px solid transparent;
    padding: 8px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.country-pill::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 14px;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    margin-right: 8px;
    background-image: attr(data-flag url); /* Se sobreescribe en js o via html attr, pero usaremos dataset en js/html */
}

/* Helper para pintar banderas usando CSS Variables o estilos en línea.
   En este caso, usaremos JS o estilos en línea, pero para simplificar, el HTML ya tiene data-flag que leerá el JS o CSS...
   Mejor lo manejamos sin pseudo-elemento o con etiqueta `img` en el futuro. 
   Para el pill actual, no pusimos div flag dentro, vamos a modificar .country-pill en app.js para insertar la bandera visual.
*/
.country-pill.selected {
    background: #eafaf1;
    border-color: var(--color-secondary);
    color: var(--color-primary);
}

/* FORMS */
.b2b-form-container {
    background: var(--color-surface);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto;
    display: none; /* Se muestra al terminar el bracket */
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input[type="checkbox"] {
    margin-right: 10px;
}

.btn {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #082d49;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* SUCCESS MODAL */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--color-surface);
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    color: var(--color-secondary);
    margin-bottom: 20px;
}

.access-key {
    font-size: 3rem;
    font-weight: bold;
    color: var(--color-primary);
    letter-spacing: 5px;
    margin: 20px 0;
    padding: 20px;
    background: var(--color-background);
    border-radius: 8px;
    border: 2px dashed var(--color-primary);
}

.check-form {
    background: var(--color-surface);
    padding: 30px;
    border-radius: 8px;
    max-width: 400px;
    margin: 40px auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.bet-results {
    background: var(--color-surface);
    padding: 30px;
    border-radius: 8px;
    margin-top: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.prize-badge {
    display: inline-block;
    background: var(--color-accent);
    color: #000;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 15px;
}
