/* 7vidas - Style */

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --border-color: #334155;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.4);
    --warning: #eab308;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --pitch-green: #15803d;
    --pitch-line: rgba(255, 255, 255, 0.5);
}

/* Override body styles of indexRanking to maintain dark theme */
body, html {
    background-color: var(--bg-dark) !important;
    background-image: none !important;
    color: var(--text-main) !important;
}

/* Guarantee footer always stays on top of interactive pitch elements */
footer, .footer, #footer {
    position: relative !important;
    z-index: 100 !important;
}

#ranking-container, #ranking {
    background: none !important;
    border: none !important;
    color: var(--text-main) !important;
}

.game-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 25px;
    background-color: var(--bg-card);
    color: var(--text-main);
    font-family: 'Outfit', 'Inter', sans-serif;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
}

/* Header & Controls */
.game-header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.alert-not-logged {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 10px;
    padding: 12px 16px;
    margin: -10px auto 25px auto;
    max-width: 600px;
    font-size: 0.9rem;
    color: #f87171;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.game-title {
    font-size: 2.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.setup-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 25px;
    background: var(--bg-dark);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.control-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.game-input {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
    width: 200px;
}

.game-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.game-select {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    min-width: 180px;
    transition: all 0.2s;
}

.game-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.btn-start {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px var(--success-glow);
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px var(--success-glow);
}

/* Layout split */
.game-grid {
    display: grid;
    grid-template-columns: 1fr 450px;
    gap: 30px;
}

.game-grid.setup-mode {
    display: flex;
    justify-content: center;
}

.game-grid.setup-mode .sidebar-panel {
    width: 100%;
    max-width: 700px;
}

@media (max-width: 992px) {
    .game-grid {
        grid-template-columns: 1fr;
    }
}

/* Soccer Pitch styling */
.pitch-container {
    position: relative;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    background: radial-gradient(circle, #166534 20%, #14532d 100%);
    border: 3px solid #fff;
    border-radius: 14px;
    aspect-ratio: 3.2 / 4;
    overflow: hidden;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Pitch markings */
.pitch-center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 25%;
    height: 20%;
    border: 2px solid var(--pitch-line);
    border-radius: 50%;
    pointer-events: none;
    box-sizing: border-box;
}

.pitch-center-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--pitch-line);
    pointer-events: none;
}

.pitch-penalty-area-top {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 52%;
    height: 18%;
    border-bottom: 2px solid var(--pitch-line);
    border-left: 2px solid var(--pitch-line);
    border-right: 2px solid var(--pitch-line);
    pointer-events: none;
    box-sizing: border-box;
}

.pitch-penalty-area-bottom {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 52%;
    height: 18%;
    border-top: 2px solid var(--pitch-line);
    border-left: 2px solid var(--pitch-line);
    border-right: 2px solid var(--pitch-line);
    pointer-events: none;
    box-sizing: border-box;
}

.pitch-slot {
    position: absolute;
    width: 80px;
    height: 115px;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    z-index: 3;
    transition: all 0.2s ease-in-out;
}

.pitch-slot:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.slot-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.85);
    border: 2px dashed rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
    position: relative;
}

.slot-circle.filled {
    border-style: solid;
    border-color: var(--primary);
    background: linear-gradient(135deg, #1d4ed8, #0f172a);
    box-shadow: 0 0 12px var(--primary-glow);
}

.slot-circle.highlight {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.25);
    animation: pulse 1.5s infinite;
}

.slot-label {
    margin-top: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.1);
}

.slot-player-name {
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    max-width: 85px;
    text-align: center;
    line-height: 1.1;
    margin-top: 2px;
    text-shadow: 1px 1px 2px #000;
}

.slot-rating {
    position: absolute;
    top: -6px;
    right: -4px;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 2px 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.slot-rating.penalty {
    background: var(--danger);
}

/* Sidebar drafting panel */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.roulette-container {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.roulette-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-roll {
    flex: 2;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-roll:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-skip {
    flex: 1;
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
    border: none;
    padding: 14px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-skip:hover:not(:disabled) {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn-roll:disabled, .btn-skip:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    background: #475569 !important;
}

/* Rolled team card */
.rolled-team-card {
    margin-top: 15px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 10px;
    padding: 15px;
    display: none;
    animation: slideDown 0.3s forwards;
}

.team-header-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.team-badge {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.team-meta {
    text-align: left;
}

.team-name {
    font-size: 1.2rem;
    font-weight: bold;
}

.team-country {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bandeira {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.1);
}

.players-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 5px;
}

.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-dark);
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.player-row:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.15);
}

.player-row.selected {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.15);
}

.player-info-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.player-name {
    font-size: 0.9rem;
    font-weight: bold;
}

.player-positions {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.player-rating-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Tournament Panel */
.tournament-panel {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    display: none;
}

.tournament-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-action {
    background: linear-gradient(135deg, #eab308, #ca8a04);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
}

.tournament-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
    gap: 5px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px 16px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tables & standings styles */
.styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background-color: transparent !important;
}

.styled-table tr, .styled-table td {
    background-color: transparent !important;
    background: transparent !important;
    color: var(--text-main) !important;
}

.styled-table th, .styled-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.styled-table th {
    color: var(--text-muted) !important;
    background-color: transparent !important;
    background: transparent !important;
    font-weight: bold;
}

.styled-table tr:hover {
    background: rgba(255,255,255,0.02);
}

/* Bracket styling */
.bracket-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bracket-match {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.bracket-team-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
}

.bracket-team-row.winner {
    font-weight: bold;
    color: var(--success);
}

/* Sim Console modal overlay */
.sim-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    display: none;
}

.sim-modal {
    background: var(--bg-card);
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.sim-modal-header {
    background: var(--bg-dark);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sim-modal-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sim-modal-footer {
    background: var(--bg-dark);
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Match UI in sim */
.match-score-board {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 15px;
    background: var(--bg-dark);
    border-radius: 10px;
    margin-bottom: 15px;
}

.score-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 40%;
}

.score-team-name {
    font-weight: bold;
    font-size: 1.1rem;
    text-align: center;
}

.score-display {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.score-divider {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-muted);
}

.ticker-event {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 6px;
    animation: fadeIn 0.3s forwards;
}

.ticker-time {
    color: var(--warning);
    font-weight: bold;
    min-width: 40px;
}

.ticker-desc {
    text-align: left;
}

.ticker-event.goal {
    background: rgba(34, 197, 94, 0.15);
    border-left: 4px solid var(--success);
    padding-left: 10px;
    font-weight: bold;
}

.ticker-event.card {
    background: rgba(234, 179, 8, 0.1);
    border-left: 4px solid var(--warning);
    padding-left: 10px;
}

/* Animations */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes scaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

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

.game-logo-header {
    width: 100%;
    max-width: 600px;
    height: auto;
    display: inline-block;
    object-fit: contain;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .game-container {
        padding: 15px;
        margin: 10px;
    }

    .setup-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .game-input, .game-select, .btn-start {
        width: 100%;
    }
}

@media (max-width: 480px) {

    .pitch-slot {
        width: 66px;
        height: 80px;
    }
    .slot-circle {
        width: 42px;
        height: 42px;
        font-size: 0.75rem;
    }
    .slot-label {
        font-size: 0.55rem;
        padding: 1px 4px;
        margin-top: 3px;
    }
    .slot-player-name {
        font-size: 0.6rem;
        max-width: 60px;
    }
    .slot-rating {
        font-size: 0.6rem;
        padding: 1px 4px;
        top: -4px;
        right: -3px;
    }
    .roulette-buttons {
        flex-direction: column;
    }
    .btn-roll, .btn-skip {
        width: 100%;
        flex: none;
    }
}

.help-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 4;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.help-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .help-btn {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

.gameover-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

@media (max-width: 480px) {
    .gameover-buttons {
        flex-direction: column;
        align-items: stretch;
    }
}
