/* ============================================
   MATCH SIMULATION POPUP STYLES
   ============================================ */

.sim-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: simFadeIn 0.3s ease forwards;
}

@keyframes simFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sim-container {
    background: linear-gradient(135deg, #001a33 0%, #002b5c 50%, #001a33 100%);
    border: 2px solid #FFD700;
    border-radius: 16px;
    width: 95vw;
    max-width: 1100px;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.15), 0 0 120px rgba(0, 0, 0, 0.5);
    animation: simSlideIn 0.4s cubic-bezier(0.68, -0.3, 0.27, 1.2);
}

@keyframes simSlideIn {
    from { transform: translateY(40px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* --- HEADER / SCOREBOARD --- */
.sim-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 18px 24px 10px;
    background: linear-gradient(180deg, rgba(0,0,0,0.5), transparent);
    border-bottom: 1px solid rgba(255,215,0,0.15);
    flex-wrap: wrap;
}

.sim-team-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    min-width: 120px;
    text-align: center;
}

.sim-team-name.home { text-align: right; }
.sim-team-name.away { text-align: left; }

.sim-score-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 12px;
    padding: 8px 20px;
}

.sim-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: #FFD700;
    min-width: 40px;
    text-align: center;
}

.sim-score-divider {
    font-size: 1.8rem;
    color: #666;
}

.sim-timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: #4ecdc4;
    background: rgba(0,0,0,0.4);
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(78,205,196,0.3);
    letter-spacing: 1px;
}

/* --- CONTROLS --- */
.sim-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255,215,0,0.1);
}

.sim-controls button {
    font-size: 0.75rem;
    padding: 6px 14px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 2px;
}

.sim-controls button.sim-speed-btn {
    background: #1a4371;
    color: #ccc;
    border: 1px solid #4a678f;
}

.sim-controls button.sim-speed-btn.active {
    background: #FFD700;
    color: #001a33;
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255,215,0,0.3);
}

.sim-controls button.sim-mode-btn {
    background: transparent;
    border: 1px solid #4a678f;
    color: #aaa;
    font-size: 0.7rem;
}

.sim-controls button.sim-mode-btn.active {
    border-color: #4ecdc4;
    color: #4ecdc4;
    background: rgba(78,205,196,0.1);
}

.sim-controls button.sim-finish-btn {
    background: #d62828;
    color: white;
    border: none;
    font-weight: 700;
}

.sim-controls button.sim-finish-btn:hover {
    background: #e63946;
}

.sim-controls button.sim-pause-btn {
    background: #2d6a4f;
    color: white;
    border: none;
}

.sim-controls button.sim-pause-btn.paused {
    background: #f77f00;
}

/* --- PITCH CANVAS --- */
.sim-pitch-wrapper {
    display: flex;
    justify-content: center;
    padding: 10px 15px;
    position: relative;
}

.sim-pitch-wrapper canvas {
    border-radius: 8px;
    border: 2px solid #2a5a2a;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    max-width: 100%;
    height: auto;
}

/* --- EVENT LOG --- */
.sim-events {
    max-height: 100px;
    overflow-y: auto;
    padding: 8px 20px;
    border-top: 1px solid rgba(255,215,0,0.1);
    border-bottom: 1px solid rgba(255,215,0,0.1);
    background: rgba(0,0,0,0.3);
}

.sim-events::-webkit-scrollbar { width: 4px; }
.sim-events::-webkit-scrollbar-track { background: transparent; }
.sim-events::-webkit-scrollbar-thumb { background: #4a678f; border-radius: 4px; }

.sim-event-item {
    font-size: 0.8rem;
    padding: 3px 0;
    color: #bbb;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    animation: eventSlide 0.3s ease;
}

.sim-event-item.goal {
    color: #FFD700;
    font-weight: 700;
    font-size: 0.9rem;
}

.sim-event-item.card {
    color: #ff6b6b;
}

.sim-event-item.halftime {
    color: #4ecdc4;
    text-align: center;
    font-weight: 700;
}

@keyframes eventSlide {
    from { transform: translateX(-10px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- LINEUPS --- */
.sim-lineups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 12px 20px 16px;
}

.sim-lineup-team {
    background: rgba(0,0,0,0.25);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.sim-lineup-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sim-lineup-player {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px;
    font-size: 0.75rem;
    border-radius: 4px;
    margin-bottom: 2px;
}

.sim-lineup-player:hover {
    background: rgba(255,255,255,0.05);
}

.sim-lineup-pos {
    font-weight: 700;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 3px;
    min-width: 28px;
    text-align: center;
    color: #000;
}

.sim-lineup-pos.gk { background: #fbc531; }
.sim-lineup-pos.def { background: #4cd137; }
.sim-lineup-pos.mid { background: #00d2d3; }
.sim-lineup-pos.fwd { background: #e84118; }

.sim-lineup-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sim-lineup-rating {
    font-weight: 700;
    font-size: 0.7rem;
    min-width: 22px;
    text-align: right;
}

/* Special player glow classes */
.sim-lineup-player.vip-99 .sim-lineup-name {
    color: #ff4d4d;
    text-shadow: 0 0 6px rgba(255,0,0,0.4);
    font-weight: 700;
}
.sim-lineup-player.vip-99 .sim-lineup-rating { color: #ff4d4d; }

.sim-lineup-player.vip-97 .sim-lineup-name {
    color: #00ffea;
    text-shadow: 0 0 6px rgba(0,255,234,0.4);
    font-weight: 700;
}
.sim-lineup-player.vip-97 .sim-lineup-rating { color: #00ffea; }

.sim-lineup-player.vip-95 .sim-lineup-name {
    color: #ff00ea;
    text-shadow: 0 0 6px rgba(255,0,234,0.4);
    font-weight: 700;
}
.sim-lineup-player.vip-95 .sim-lineup-rating { color: #ff00ea; }

.sim-lineup-player.icon .sim-lineup-name {
    color: #F6E3BA;
    text-shadow: 0 0 6px rgba(246,227,186,0.5);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.sim-lineup-player.icon .sim-lineup-rating { color: #F6E3BA; }

.sim-lineup-player.icon-vip .sim-lineup-name {
    color: #E0FFFF;
    text-shadow: 0 0 8px rgba(224,255,255,0.7);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.sim-lineup-player.icon-vip .sim-lineup-rating { color: #E0FFFF; }

/* --- MATCH RESULT OVERLAY --- */
.sim-result-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: simFadeIn 0.5s ease;
    border-radius: 14px;
}

.sim-result-card {
    text-align: center;
    padding: 40px;
    animation: simSlideIn 0.5s ease;
}

.sim-result-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    color: #FFD700;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255,215,0,0.3);
}

.sim-result-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    color: white;
    margin: 15px 0;
    letter-spacing: 5px;
}

.sim-result-scorers {
    font-size: 0.9rem;
    color: #bbb;
    margin: 15px 0;
    max-height: 150px;
    overflow-y: auto;
}

.sim-result-btn {
    margin-top: 20px;
}

/* --- PENALTY SHOOTOUT --- */
.penalty-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: simFadeIn 0.4s ease forwards;
}

.penalty-container {
    background: linear-gradient(135deg, #0a1628 0%, #001a33 50%, #0a1628 100%);
    border: 2px solid #FFD700;
    border-radius: 16px;
    width: 90vw;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 80px rgba(255, 215, 0, 0.2);
    padding: 30px;
    animation: simSlideIn 0.5s cubic-bezier(0.68, -0.3, 0.27, 1.2);
}

.penalty-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: #FFD700;
    text-align: center;
    margin-bottom: 5px;
    text-shadow: 0 0 20px rgba(255,215,0,0.4);
}

.penalty-subtitle {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.penalty-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

.penalty-team-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}

.penalty-vs {
    font-size: 0.9rem;
    color: #555;
}

.penalty-score-display {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: center;
    margin-bottom: 25px;
}

.penalty-score-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    color: #FFD700;
    text-align: center;
}

.penalty-score-sep {
    font-size: 1.5rem;
    color: #555;
}

.penalty-kicks-grid {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    gap: 5px 10px;
    margin-bottom: 20px;
}

.penalty-kick-row {
    display: contents;
}

.penalty-kick-cell {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    min-height: 32px;
    transition: all 0.3s ease;
}

.penalty-kick-cell.home {
    justify-content: flex-end;
    text-align: right;
}

.penalty-kick-cell.away {
    justify-content: flex-start;
    text-align: left;
}

.penalty-kick-cell.scored {
    background: rgba(78, 205, 196, 0.15);
    color: #4ecdc4;
}

.penalty-kick-cell.missed {
    background: rgba(214, 40, 40, 0.15);
    color: #d62828;
}

.penalty-kick-cell.waiting {
    background: rgba(255,255,255,0.03);
    color: #444;
}

.penalty-kick-cell.current {
    background: rgba(255,215,0,0.15);
    color: #FFD700;
    animation: penaltyPulse 1s ease infinite;
}

.penalty-kick-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #555;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.penalty-kick-icon {
    font-size: 1.1rem;
    margin: 0 4px;
}

.penalty-kick-name {
    font-size: 0.75rem;
    opacity: 0.8;
}

.penalty-status {
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    margin: 15px 0;
    min-height: 30px;
    color: #aaa;
}

.penalty-status.winner {
    color: #FFD700;
    font-size: 1.2rem;
    text-shadow: 0 0 15px rgba(255,215,0,0.5);
}

@keyframes penaltyPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- RESPONSIVE (base sim overrides for mobile) --- */
@media (max-width: 767px) {
    .sim-container {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
        max-height: 100vh;
    }

    .sim-header {
        padding: 10px 10px 8px;
        gap: 8px;
    }

    .sim-team-name {
        font-size: 0.85rem;
        min-width: 70px;
    }

    .sim-score {
        font-size: 1.6rem;
    }

    .sim-score-box {
        padding: 6px 14px;
        gap: 8px;
    }

    .sim-timer {
        font-size: 0.8rem;
    }

    .sim-lineups {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .sim-controls {
        gap: 4px;
        padding: 8px 10px;
    }

    .sim-controls button {
        font-size: 0.6rem;
        padding: 5px 8px;
    }

    .sim-events {
        max-height: 70px;
    }

    .sim-result-card { padding: 24px; }
    .sim-result-title { font-size: 1.3rem; }
    .sim-result-score { font-size: 2.2rem; }
}
