/* ============================================
   SIMULADOR MUNDIAL 2026 – CSS
   ============================================ */

/* --- HERO --- */
.sim-hero {
    padding: 80px 0 40px;
    text-align: center;
    background: linear-gradient(135deg, #050a18 0%, #0f172a 50%, #1a0a2e 100%);
    position: relative;
    overflow: hidden;
}

.sim-hero::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(252, 163, 17, 0.08) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.sim-hero-tag {
    display: inline-block;
    background: rgba(252, 163, 17, 0.15);
    color: #fca311;
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.sim-hero h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 900;
    color: #fff;
    margin-bottom: 15px;
}

.sim-hero h1 .gold {
    color: #fca311;
}

.sim-hero-desc {
    color: #94a3b8;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 25px;
    line-height: 1.6;
}

.sim-hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

/* --- LEGEND --- */
.sim-legend {
    background: rgba(10, 16, 31, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.sim-legend-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #fca311;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sim-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.sim-legend-item {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sim-legend-item .badge {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-family: monospace;
    min-width: 28px;
    text-align: center;
}

.sim-legend-item .badge-gold {
    background: rgba(252, 163, 17, 0.2);
    color: #fca311;
}

.sim-legend-note {
    font-size: 11px;
    color: #64748b;
    margin-top: 12px;
    font-style: italic;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

/* --- BUTTONS --- */
.sim-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

.sim-btn-outline {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #94a3b8;
}

.sim-btn-outline:hover {
    border-color: #fca311;
    color: #fca311;
}

.sim-btn-gold {
    background: #fca311;
    color: #000;
}

.sim-btn-gold:hover {
    background: #fdd85d;
    transform: scale(1.05);
}

/* --- PHASE NAVIGATION --- */
.sim-phase-nav {
    background: #0a101f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0;
}

.sim-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.sim-tabs::-webkit-scrollbar {
    display: none;
}

.sim-tab {
    flex-shrink: 0;
    padding: 16px 20px;
    background: none;
    border: none;
    color: #64748b;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.sim-tab:hover {
    color: #94a3b8;
}

.sim-tab.active {
    color: #fca311;
    border-bottom-color: #fca311;
}

.sim-tab.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- PHASES --- */
.sim-phase {
    display: none;
    padding: 40px 0 60px;
}

.sim-phase.active {
    display: block;
}

.sim-section-title {
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    text-align: center;
    margin-bottom: 8px;
}

.sim-section-sub {
    text-align: center;
    color: #64748b;
    margin-bottom: 40px;
    font-size: 1rem;
}

/* --- GROUPS GRID --- */
.sim-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 25px;
}

/* --- GROUP CARD --- */
.sim-group-card {
    background: #121a2e;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    transition: border-color 0.3s;
}

.sim-group-card:hover {
    border-color: rgba(252, 163, 17, 0.3);
}

.sim-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: rgba(252, 163, 17, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sim-group-name {
    font-weight: 900;
    color: #fca311;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sim-group-status {
    font-size: 0.7rem;
    color: #64748b;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 10px;
    border-radius: 20px;
}

/* --- STANDINGS TABLE --- */
.sim-standings {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.sim-standings th {
    color: #64748b;
    font-weight: 600;
    padding: 10px 6px;
    text-align: center;
    font-size: 0.7rem;
    text-transform: uppercase;
    border-bottom: 2px solid rgba(255, 255, 255, 0.04);
}

/* --- FLAG IMAGES --- */
.sim-flag-img {
    width: 22px;
    height: auto;
    display: inline-block;
    vertical-align: middle;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sim-team-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    margin-right: 8px;
    line-height: 1;
}

/* Big Champion Flag */
.sim-champion-flag .sim-flag-img {
    width: 60px;
    margin: 15px 0;
    border-radius: 6px;
}

@media (max-width: 480px) {
    .sim-flag-img {
        width: 18px;
    }

    .sim-team-flag {
        min-width: 20px;
        margin-right: 5px;
    }
}


.sim-standings th:first-child {
    text-align: left;
    padding-left: 18px;
}

.sim-standings td {
    padding: 10px 6px;
    text-align: center;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.sim-standings td:first-child {
    text-align: left;
    padding-left: 18px;
}

.sim-standings tr.qualified-1st td:first-child {
    border-left: 3px solid #22c55e;
}

.sim-standings tr.qualified-2nd td:first-child {
    border-left: 3px solid #3b82f6;
}

.sim-standings tr.qualified-3rd td:first-child {
    border-left: 3px solid #f59e0b;
}

.sim-standings tr.eliminated td {
    opacity: 0.4;
}

.sim-team-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sim-team-flag {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.sim-team-name {
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
    font-size: 0.8rem;
}

/* --- MATCHES LIST --- */
.sim-matches {
    padding: 12px 18px 18px;
}

.sim-matches-title {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.sim-match-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    transition: background 0.2s;
}

.sim-match-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sim-match-team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #cbd5e1;
    font-weight: 600;
}

.sim-match-team.right {
    justify-content: flex-end;
    text-align: right;
}

.sim-match-team .sim-team-flag {
    font-size: 1rem;
}

.sim-match-team .sim-team-name {
    max-width: 90px;
    font-size: 0.78rem;
}

.sim-match-vs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sim-score-input {
    width: 32px;
    height: 32px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
    -moz-appearance: textfield;
    appearance: textfield;
}

.sim-score-input::-webkit-outer-spin-button,
.sim-score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sim-score-input:focus {
    border-color: #fca311;
    box-shadow: 0 0 0 2px rgba(252, 163, 17, 0.2);
}

.sim-score-sep {
    color: #475569;
    font-weight: 700;
    font-size: 0.9rem;
}

/* --- KNOCKOUT GRID --- */
.sim-knockout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.sim-ko-match {
    background: #121a2e;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    transition: border-color 0.3s;
}

.sim-ko-match:hover {
    border-color: rgba(252, 163, 17, 0.3);
}

.sim-ko-header {
    padding: 10px 16px;
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    background: rgba(252, 163, 17, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.sim-ko-teams {
    padding: 6px 0;
}

.sim-ko-team-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 10px;
    transition: background 0.2s;
}

.sim-ko-team-row:first-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sim-ko-team-row.winner {
    background: rgba(34, 197, 94, 0.08);
}

.sim-ko-team-flag {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sim-ko-team-name {
    flex: 1;
    font-weight: 700;
    color: #cbd5e1;
    font-size: 0.85rem;
}

.sim-ko-team-name.tbd {
    color: #475569;
    font-style: italic;
    font-weight: 500;
}

.sim-ko-score-input {
    width: 36px;
    height: 36px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
    -moz-appearance: textfield;
    appearance: textfield;
}

.sim-ko-score-input::-webkit-outer-spin-button,
.sim-ko-score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sim-ko-score-input:focus {
    border-color: #fca311;
    box-shadow: 0 0 0 2px rgba(252, 163, 17, 0.2);
}

.sim-ko-score-input:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Penalty row */
.sim-ko-penalty {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.06);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.75rem;
    color: #94a3b8;
}

.sim-ko-penalty-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sim-ko-pen-input {
    width: 28px;
    height: 28px;
    background: #1e293b;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    font-weight: 800;
    font-size: 0.85rem;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.sim-ko-pen-input::-webkit-outer-spin-button,
.sim-ko-pen-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- CHAMPION --- */
.sim-champion {
    text-align: center;
    margin-top: 50px;
    padding: 60px 20px;
    background: linear-gradient(135deg, rgba(252, 163, 17, 0.05) 0%, rgba(255, 215, 0, 0.08) 100%);
    border-radius: 30px;
    border: 2px solid rgba(252, 163, 17, 0.3);
    animation: celebrationPulse 2s ease-in-out infinite;
}

@keyframes celebrationPulse {

    0%,
    100% {
        box-shadow: 0 0 40px rgba(252, 163, 17, 0.1);
    }

    50% {
        box-shadow: 0 0 80px rgba(252, 163, 17, 0.2);
    }
}

.sim-champion-trophy {
    font-size: 5rem;
    margin-bottom: 15px;
    animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.sim-champion-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fca311;
    margin-bottom: 20px;
}

.sim-champion-flag {
    font-size: 6rem;
    margin-bottom: 10px;
}

.sim-champion-name {
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.sim-champion-sub {
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 30px;
}

.sim-champion-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- CONFETTI --- */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .sim-hero {
        padding: 50px 0 25px;
    }

    .sim-hero h1 {
        font-size: 1.8rem;
    }

    .sim-hero-desc {
        font-size: 0.95rem;
    }

    .sim-groups-grid {
        grid-template-columns: 1fr;
    }

    .sim-knockout-grid {
        grid-template-columns: 1fr;
    }

    .sim-tab {
        padding: 12px 14px;
        font-size: 0.75rem;
    }

    .sim-champion-title {
        font-size: 1.5rem;
    }

    .sim-champion-flag {
        font-size: 4rem;
    }

    .sim-champion-name {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }

    .sim-ko-match {
        border-radius: 12px;
    }

    .sim-match-team .sim-team-name {
        max-width: 70px;
        font-size: 0.72rem;
    }
}

/* --- LOGIN MODAL & AUTH --- */
.sim-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    /* JS toggles this */
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(8px);
    padding: 20px;
}

.sim-modal-content {
    background: #1e293b;
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    border-radius: 20px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: simModalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes simModalSlide {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.sim-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.sim-modal-close:hover {
    color: #fff;
}

.sim-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.sim-modal-header h3 {
    color: #fff;
    font-size: 1.6rem;
    margin-bottom: 10px;
    margin-top: 0;
}

.sim-modal-header p {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.sim-auth-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sim-auth-sep {
    text-align: center;
    margin: 5px 0;
    position: relative;
    color: #64748b;
    font-size: 0.85rem;
}

.sim-auth-sep::before,
.sim-auth-sep::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.sim-auth-sep::before {
    left: 0;
}

.sim-auth-sep::after {
    right: 0;
}

.sim-auth-email {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sim-auth-email input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    text-align: center;
    transition: border-color 0.2s;
}

.sim-auth-email input:focus {
    border-color: #fca311;
    outline: none;
}