:root {
    --ev-yellow: #FEFB01;
    --ev-cyan: #00F2FF;
    --ev-blue: #0047AB;
    --ev-dark-blue: #140049;
    --ev-pink: #FF0080;
    --font-main: 'Montserrat', sans-serif;
}

body {
    background-color: var(--ev-yellow);
    color: var(--ev-dark-blue);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
}

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

/* --- HEADER --- */
.main-header {
    background-color: var(--ev-yellow);
    padding: 20px 40px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ev-logo {
    height: 90px;
    margin-bottom: 5px;
    border: 1px solid #140049;
    border-radius: 12px;
}

.slogan-area {
    text-align: right;
}

.slogan-text {
    font-weight: 900;
    font-size: 1.8rem;
    line-height: 1;
    margin: 0;
}

/* --- SECCIÓN PRINCIPAL --- */
.content-wrapper {
    background-color: white;
    padding: 40px;
    border-radius: 20px 20px 0 0;
    min-height: 100vh;
}

.video-frame {
    position: relative;
    padding-bottom: 56.25%; /* Ratio 16:9 perfecto */
    height: 0;
    overflow: hidden;
    background-color: black;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 4px solid var(--ev-blue);
    margin-bottom: 40px;
}

.video-frame iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* --- PLAYLIST --- */
.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-title {
    font-weight: 900;
    font-size: 1.5rem;
    margin: 0;
    border-left: 5px solid var(--ev-pink);
    padding-left: 15px;
}
.btn-secondary {
    background-color: var(--ev-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    font-weight: 700;
    font-size: 1rem; /* ¡AQUÍ ESTÁ LA MAGIA! */
    font-family: var(--font-main);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center; /* Añadimos esto por si acaso para centrar el texto siempre */
}

.btn-secondary:hover {
    background-color: var(--ev-pink);
}

.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    min-height: 150px;
}

/* --- TARJETAS (DRAG & DROP) --- */
.song-card {
    background-color: white;
    border: 2px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    cursor: grab;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1; /* Por encima de la marca de agua */
    width: 100%;
}

.song-card:active {
    cursor: grabbing;
}

.song-card.dragging {
    opacity: 0.5;
    border: 3px dashed var(--ev-pink);
    transform: scale(0.95);
}

.song-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,71,171,0.15);
    border-color: var(--ev-blue);
}

.card-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background-color: #140049;
    pointer-events: none;
}

.card-body {
    padding: 15px;
    pointer-events: none;
}

.card-info {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ev-dark-blue);
}

.card-song {
    margin: 5px 0 0 0;
    font-size: 0.8rem;
    color: var(--ev-pink);
    font-weight: 700;
}

/* --- SISTEMA DE VOTACIÓN --- */
.voting-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.points-board {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* ESTO es lo que centra a los 4 de abajo */
    gap: 20px;
    margin-top: 20px;
    max-width: 1200px; /* Limita el ancho para que la fila se corte en 6 */
    margin-left: auto;
    margin-right: auto;
}

.point-slot {
    box-sizing: border-box;
    position: relative;
    flex: 0 0 calc(16.66% - 20px); /* Obliga a que cada tarjeta ocupe exactamente 1/6 del espacio */
    min-width: 140px; /* Evita que se aplasten si la pantalla es un poco más pequeña */
    min-height: 220px;
    border: 3px dashed var(--ev-blue);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background-color: #f8fafc;
    transition: all 0.3s ease;
    overflow: hidden;
}

.point-slot.highlight-12 {
    border: 4px dashed var(--ev-pink);
    background-color: #fff0f7;
}

.point-slot.highlight-10 {
    border: 4px dashed var(--ev-yellow);
    background-color: #ffffe6;
}

.point-slot.drag-over {
    background-color: var(--ev-cyan);
    border-color: var(--ev-dark-blue);
    transform: scale(1.05);
}

/* --- MARCA DE AGUA AJUSTADA --- */
.points-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--ev-dark-blue);
    font-weight: 900;
    font-size: 2rem; /* Tamaño reducido para que sea visible pero no moleste */
    opacity: 0.1;
    pointer-events: none;
    margin: 0;
    z-index: 0;
    line-height: 1;
}

.highlight-12 .points-label {
    color: var(--ev-pink);
    font-size: 2rem; /* Un poco más grande para el 12 */
    opacity: 0.15;
}

/* --- AJUSTE DE LA TARJETA EN EL HUECO --- */
.point-slot .song-card {
    transform: scale(0.9); /* Un poco más pequeña cuando está "encajada" */
    margin: 0;
}

/* --- BOTÓN FINAL --- */
.action-bar {
    text-align: center;
    margin-top: 50px;
}

.btn-primary {
    background-color: var(--ev-pink);
    color: white;
    font-family: var(--font-main);
    font-weight: 900;
    border: none;
    padding: 20px 50px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255,0,128,0.3);
    transition: background-color 0.2s, transform 0.2s;
}

.btn-primary:hover {
    background-color: var(--ev-dark-blue);
    transform: scale(1.05);
}

/* --- MODAL PERSONALIZADO --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(20, 0, 73, 0.85); /* Azul oscuro transparente */
    backdrop-filter: blur(5px); /* Efecto cristal borroso */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: translateY(30px) scale(0.90);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Efecto de rebote al abrir */
    border: 5px solid var(--ev-pink);
}

.modal-overlay.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-title {
    color: var(--ev-pink);
    font-weight: 900;
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.modal-body {
    color: var(--ev-dark-blue);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* --- MODAL SCORECARD REFINADO --- */
.modal-scorecard {
    text-align: left;
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    border: 2px dashed var(--ev-blue);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 50vh; 
    overflow-y: auto;
}

.modal-score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 12px 15px;
    border-radius: 10px;
    border-left: 6px solid var(--ev-blue);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.modal-score-row[data-points="12"] { border-left-color: var(--ev-pink); background: #fff0f7; }
.modal-score-row[data-points="10"] { border-left-color: var(--ev-yellow); background: #ffffe6; }
.modal-score-row[data-points="8"] { border-left-color: var(--ev-cyan); background: #f0ffff; }

.modal-score-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.modal-score-country {
    font-weight: 900;
    color: var(--ev-dark-blue);
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-score-song {
    font-size: 0.8rem;
    color: var(--ev-pink);
    margin: 2px 0 0 0;
    font-weight: 700;
}

.modal-score-points {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--ev-dark-blue);
    min-width: 35px;
    text-align: right;
}

/* --- CONTENEDOR DE BOTONES IGUALADOS --- */
.modal-footer-buttons {
    margin-top: 25px;
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: stretch; /* Hace que ambos tengan la misma altura */
}

.modal-footer-buttons .btn-primary, 
.modal-footer-buttons .btn-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    font-size: 0.9rem;
    border-radius: 12px;
    text-decoration: none;
    margin: 0;
    height: auto;
    line-height: 1.2;
}

/* --- ESTILOS DEL MODO CAPITÁN Y WHATSAPP --- */

/* Botón especial de WhatsApp */
.btn-whatsapp {
    display: block;
    width: 100%;
    margin-top: 15px;
    padding: 15px;
    background-color: #25D366; /* Color oficial de WhatsApp */
    color: white;
    text-align: center;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 5px;
    box-sizing: border-box;
    transition: background-color 0.2s;
}
.btn-whatsapp:hover {
    background-color: #1ebe57;
}

/* Modal del capitán */
.capitan-bar {
    text-align: center; 
    margin-top: 40px; 
    padding-top: 20px; 
    border-top: 1px solid #ddd;
}
.btn-capitan-open {
    background: transparent; 
    border: 1px solid #ccc; 
    color: #777; 
}
.btn-capitan-open:hover {
    background: #f0f0f0;
}
.capitan-title {
    color: #ff9f43 !important; /* Usamos tu color secundario */
}
.capitan-textarea {
    width: 100%; 
    height: 120px; 
    margin-bottom: 15px; 
    padding: 10px; 
    border-radius: 5px; 
    border: 1px solid #ccc; 
    font-family: monospace; 
    resize: none;
    box-sizing: border-box;
}
.btn-capitan-calc {
    background-color: #ff9f43; /* Color secundario para destacarlo */
    color: white;
}

#capitan-textarea {
    width: 100%;
    min-height: 100px;
    max-height: 250px; /* Límite máximo para que no se coma toda la pantalla */
    resize: vertical; /* Solo permite estirarlo arriba/abajo, no a los lados */
    box-sizing: border-box;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-family: monospace;
}

/* --- NOTIFICACIÓN FLOTANTE (TOAST) --- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px); /* Empieza escondido abajo */
    background-color: var(--ev-pink, #ff007f); /* Tu color fucsia */
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0, 0.3);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Efecto rebote */
    z-index: 3000;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0); /* Sube a su posición */
    opacity: 1;
}

/* --- AJUSTES RESPONSIVE (Móviles y Tablets) --- */

@media (max-width: 1024px) {
    .point-slot { flex: 0 0 calc(25% - 20px); } /* 4 por fila en pantallas medianas */
}

@media (max-width: 768px) {
    .point-slot { flex: 0 0 calc(33.33% - 20px); } /* 3 por fila en tablets */
    
    /* Centrar mejor la cabecera en tablets */
    .header-content { flex-direction: column; text-align: center; gap: 10px; }
}

@media (max-width: 600px) {
    .point-slot { 
        flex: 0 0 calc(50% - 15px); /* 2 por fila en móviles */
        min-width: 120px; /* Lo bajamos un pelín para que entren 2 en móviles muy estrechos */
    }

    /* Convierte las filas de botones de los modales en columnas */
    .modal-content .action-bar,
    .modal-footer-buttons {
        flex-direction: column;
        display: flex;
    }
    
    /* Obliga a que los botones ocupen el 100% del ancho y tengan margen debajo */
    .modal-content .action-bar button,
    .modal-content .action-bar a.btn-primary,
    .modal-footer-buttons .btn-primary, 
    .modal-footer-buttons .btn-secondary {
        width: 100% !important;
        margin: 0 0 15px 0 !important;
    }

    /* Le quitamos el margen al último botón para que no quede un hueco feo abajo */
    .modal-content .action-bar > *:last-child,
    .modal-footer-buttons > *:last-child {
        margin-bottom: 0 !important;
    }
}