:root {
    --primary-bg: #0a0f1f; /* Azul oscuro casi negro */
    --secondary-bg: #141a2e;
    --accent-color: #00ffff; /* Cyan */
    --accent-glow: rgba(0, 255, 255, 0.5);
    --text-color: #e0e0e0;
    --highlight-text: #ffffff;
    --border-color: #2a3b5f;
    --danger-color: #ff4136;
    --danger-glow: rgba(255, 65, 54, 0.5);
}

body {
    font-family: 'Rajdhani', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Alinea al inicio para scroll si es necesario */
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 95%;
    max-width: 1400px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 25px var(--accent-glow);
    border-radius: 10px;
    overflow: hidden; /* Para contener los glows internos */
}

.main-header {
    background-color: rgba(10, 15, 31, 0.8); /* Un poco más oscuro */
    padding: 15px 25px;
    text-align: center;
    border-bottom: 2px solid var(--accent-color);
    box-shadow: 0 2px 10px var(--accent-glow);
}

.main-header h1 {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent-color);
    margin: 0;
    font-size: 2.5em;
    text-shadow: 0 0 10px var(--accent-glow);
}

.main-header .subtitle {
    font-size: 0.5em;
    color: var(--text-color);
    display: block;
    font-family: 'Rajdhani', sans-serif;
    text-shadow: none;
}

.tactical-board {
    display: flex;
    padding: 20px;
    gap: 20px;
}

.controls-panel {
    flex-basis: 300px; /* Ancho fijo para el panel */
    flex-shrink: 0;
    background-color: rgba(20, 26, 46, 0.7);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.controls-panel h2, .controls-panel h3 {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent-color);
    text-align: center;
    margin-top: 0;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--highlight-text);
}

.control-group input[type="text"],
.control-group input[type="number"] {
    width: calc(100% - 20px);
    padding: 10px;
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1em;
}

.control-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-glow);
}

.action-button, .formation-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background-color: var(--accent-color);
    color: var(--primary-bg);
    border: none;
    border-radius: 5px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 0 0 5px var(--accent-glow);
}

.action-button:hover, .formation-btn:hover {
    background-color: #00e0e0; /* Un poco más brillante */
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

.danger-button {
    background-color: var(--danger-color);
    box-shadow: 0 0 5px var(--danger-glow);
}
.danger-button:hover {
    background-color: #e03020;
    box-shadow: 0 0 15px var(--danger-glow);
}


.formation-selector {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

.roster {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

.roster h3 {
    margin-bottom: 10px;
}

#rosterList {
    list-style: none;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

#rosterList li {
    background-color: var(--primary-bg);
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: grab;
    transition: background-color 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#rosterList li:hover {
    background-color: var(--border-color); /* Un poco más claro */
}

#rosterList li .player-name {
    font-weight: 600;
}
#rosterList li .player-num {
    font-size: 0.9em;
    color: var(--accent-color);
    margin-right: 5px;
}

.remove-player-from-roster {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 5px;
}
.remove-player-from-roster:hover {
    color: #ff6961;
}


.field-section {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.football-pitch {
    width: 500px; /* Ancho fijo del campo */
    height: 700px; /* Alto fijo del campo */
    background: linear-gradient(to bottom, #0a4f0a, #083b08); /* Verde oscuro */
    border: 3px solid #ccffcc; /* Líneas blancas/verdes claras */
    position: relative; /* Para posicionar jugadores y líneas */
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3); /* Glow verde sutil */
}

/* Líneas del campo */
.goal {
    position: absolute;
    border: 2px solid #ccffcc;
    width: 100px;
    height: 40px;
    left: 50%;
    transform: translateX(-50%);
}
.goal-top { top: -2px; border-top: none; }
.goal-bottom { bottom: -2px; border-bottom: none; }

.center-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #ccffcc;
    top: 50%;
    transform: translateY(-50%);
}
.center-circle {
    position: absolute;
    width: 120px;
    height: 120px;
    border: 2px solid #ccffcc;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.penalty-area {
    position: absolute;
    border: 2px solid #ccffcc;
    width: 250px;
    height: 120px;
    left: 50%;
    transform: translateX(-50%);
}
.penalty-area-top { top: 0; border-top: none;}
.penalty-area-bottom { bottom: 0; border-bottom: none;}


.player-marker {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: var(--accent-color);
    color: var(--primary-bg);
    border-radius: 50%; /* Círculos para jugadores */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: grab;
    user-select: none; /* Evita seleccionar texto al arrastrar */
    font-size: 0.7em;
    font-weight: 600;
    border: 2px solid var(--primary-bg);
    box-shadow: 0 0 10px var(--accent-glow), inset 0 0 5px rgba(0,0,0,0.3);
    transition: transform 0.1s ease-out, box-shadow 0.2s;
}
.player-marker:active {
    cursor: grabbing;
    transform: scale(1.1);
    z-index: 1000; /* Asegura que esté por encima al arrastrar */
    box-shadow: 0 0 20px var(--accent-glow), inset 0 0 5px rgba(0,0,0,0.3);
}
.player-marker .player-number-display {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2em;
    line-height: 1;
}
.player-marker .player-name-display {
    font-size: 0.8em;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90%;
}

.player-marker .remove-player-from-field {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid white;
    opacity: 0;
    transition: opacity 0.2s;
}
.player-marker:hover .remove-player-from-field {
    opacity: 1;
}


.main-footer {
    text-align: center;
    padding: 15px;
    font-size: 0.9em;
    color: var(--border-color);
    border-top: 1px solid var(--border-color);
    margin-top: 20px; /* Si el contenido es muy alto */
}

/* Estilos para cuando un jugador está siendo arrastrado desde la plantilla */
.dragging-roster-player {
    opacity: 0.7;
    background-color: var(--accent-color) !important;
    color: var(--primary-bg);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Responsive adjustments (basic) */
@media (max-width: 900px) {
    .tactical-board {
        flex-direction: column;
        align-items: center;
    }
    .controls-panel {
        flex-basis: auto; /* Ocupa el ancho disponible */
        width: 100%;
        max-width: 500px; /* Mismo ancho que el campo */
        margin-bottom: 20px;
    }
    .football-pitch {
        width: 90%;
        max-width: 500px;
        height: calc( (90vw - 6px) * 1.4); /* Mantener proporción (700/500 = 1.4) */
        max-height: 700px;
    }
}

@media (max-width: 600px) {
    .main-header h1 {
        font-size: 1.8em;
    }
    .football-pitch {
        /* Ajustar dimensiones del campo para pantallas más pequeñas si es necesario */
        /* Podrías hacer los marcadores de jugador más pequeños también */
    }
    .player-marker {
        width: 40px;
        height: 40px;
        font-size: 0.6em;
    }
    .player-marker .player-number-display {
        font-size: 1em;
    }
}