/* Estilos para el layout 70/30 */
body {
    margin: 0px;
    padding: 0px;
    height: 100vh; /* Ocupa toda la altura de la pantalla */
    overflow: hidden; /* Evita scrolls innecesarios */
    position: relative; /* Para posicionar el botón de fullscreen */
    background-color: black; /* Mantener fondo negro del scoreboard */
    color: white;
    font-family: sans-serif, Arial;
    -webkit-text-size-adjust: 100%;
}

.container {
    display: flex; /* División flexible */
    height: 100%; /* Llena la pantalla */
}

.scoreboard-section {
    flex: 7; /* 70% del ancho */
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-section {
    flex: 3; /* 30% del ancho */
    height: 100%;
    background-color: black; /* Fondo oscuro para los videos, coherente con el tema */
    display: flex;
    align-items: center; /* Centra verticalmente el video */
    justify-content: center; /* Centra horizontalmente */
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%; /* Asegura que no exceda el 30% */
}

.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Mantiene el aspect ratio sin distorsión */
    aspect-ratio: 9 / 16; /* Fuerza 9:16 (portrait, como reels de TikTok) */
}

#fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    z-index: 1000; /* Asegura que el botón esté encima */
}

#fullscreen-btn:hover {
    background-color: #0056b3;
}

/* Estilos del scoreboard */
.scoreboard {
    width: 100%;
    height: 80%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 10px solid white;
    border-radius: 20px;
    padding: 10%.10%;
    box-sizing: border-box;
    overflow-y: hidden;
    margin-left: 50px;
    margin-right: 50px;
    background-color: black;
}

.team-names {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.5%;
}

.team-names input {
    background: transparent;
    border: none;
    color: white;
    font-size: clamp(1.5rem, 5vw, 3rem);
    text-align: center;
    width: 45%;
    -webkit-user-modify: read-write-plaintext-only;
}

.points {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 0.5%;
}

.controls {
    display: flex;
    flex-direction: column;
}

.controls button {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    width: clamp(3rem, 8vw, 5rem);
    height: clamp(3rem, 8vw, 5rem);
    margin: 0.2%;
    border-radius: 30px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.controls button:first-child {
    background-color: green;
    color: white;
    border: 0px solid red;
}

.controls button:last-child {
    background-color: red;
    color: white;
    border: 0px solid red;
}

.display {
    display: flex;
    justify-content: space-around;
    flex: 1;
    width: 100%;
}

.display span {
    font-size: clamp(12rem, 15vw, 12rem);
    border: 6px solid red;
    border-radius: 30px;
    padding:3% 3%;
    background-color: blue;
    margin: 0.15%;
}

.serve-indicator {
    display: flex;
    align-items: top;
    font-size: clamp(1.2rem, 4vw, 2rem);
    margin-bottom: 10%;
    margin-top: -10.9%;
    width: 100%;
    justify-content: center;
}

.arrow {
    color: yellow;
    font-size: clamp(2rem, 6vw, 3rem);
    visibility: hidden;
}

.arrow.active {
    visibility: visible;
}

.games-sets {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: clamp(1.5rem, 4.5vw, 2.5rem);
    margin-bottom: 0.5%;
    margin-top: -2.0%;
}

.games-sets .left, .games-sets .right {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.games-sets span {
    margin-right: 0.5%;
}

.games-sets span span {
    border: 2px solid red;
    border-radius: 10px;
    padding: 0.5% 1%;
    background-color: black;
    font-size: clamp(1.5rem, 4.5vw, 2.5rem);
}

.tiebreak {
    font-size: clamp(3rem, 8vw, 5rem);
    color: red;
    display: none;
    margin-bottom: 0.1%;
    text-align: center;
    width: 100%;
}

.blinking {
    animation: blink 1s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

.controls-bottom {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    margin-top: -2%;
}

.mode-btn:hover {
    background: #0056b3;
}

.buttons-row {
    display: flex;
    justify-content: center;
    gap: 0.9%;
    width: 100%;
    flex-wrap: wrap;
}

.reset-score, .reset-match {
    font-size: 16px;
    width: clamp(8rem, 8vw,8rem);
    height: clamp(3rem, 8vw, 5rem);
    margin: 0.2%;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid white;
    min-width: 5vw;
}

.reset-score {
    background: red;
    color: white;
}

.reset-match {
    background: red;
    color: white;
}

/* New styles for mode switch and liga mode */
.mode-switch {
    display: flex;
    justify-content: center;
    margin-bottom: 1%;
}

.mode-switch button {
    padding: 10px 20px;
    margin: 0 10px;
    background-color: #f9e109;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(1rem, 3vw, 1.5rem);
}

.mode-switch button.active {
    background-color: #2bdb13;
}

#liga-mode {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.liga-points {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 1%;
}

.liga-points span {
    font-size: clamp(4rem, 15vw, 8rem);
    border: 6px solid red;
    border-radius: 30px;
    padding: 1% 1%;
    background-color: black;
    margin: 0.15%;
}

.liga-controls {
    display: flex;
    justify-content: center;
    gap: 1%;
    margin-bottom: 1%;
}

.liga-selects {
    display: flex;
    justify-content: center;
    gap: 1%;
    margin-bottom: 1%;
}

.liga-selects label {
    display: flex;
    align-items: center;
    font-size: clamp(1rem, 3vw, 1.5rem);
}

.liga-selects select {
    margin-left: 0.5%;
    font-size: clamp(1rem, 3vw, 1.5rem);
}

.liga-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1%;
}

.liga-timer span {
    font-size: clamp(2rem, 6vw, 3rem);
}

.liga-timer-controls button {
    padding: 10px 20px;
    margin: 0 5px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(1rem, 3vw, 1.5rem);
}

.liga-timer-controls button:hover {
    background-color: #0056b3;
}

/* Responsive Adjustments */
@media (min-width: 2160px) and (max-width: 3840px){ /* Large TVs 1920x1080+ */
    .scoreboard { padding: 0.3%; }
    .team-names { font-size: 2.5vw; }
    .display span { font-size: 10vw; }
    .controls button { font-size: 3vw; width: 6vw; height: 6vw; }
    .serve-indicator { font-size: 2vw; }
    .arrow { font-size: 3vw; }
    .games-sets { font-size: 2.5vw; }
    .games-sets span span { font-size: 2.5vw; }
    .tiebreak { font-size: 4vw; }
    .timer { font-size: 2vw; }
    .timer button { font-size: 1.2vw; }
    .mode-btn { font-size: 1.5vw; min-width: 5vw; }
    .buttons-row button { font-size: 1.5vw; min-width: 5vw; }
}

@media (min-width: 720px) and (max-width: 1280px) { /* Tablets and smaller laptops */
    .scoreboard { padding: 0.3%; }
    .team-names { font-size: 3vw; }
    .display span { font-size: 12vw; }
    .controls button { font-size: 3.5vw; width: 7vw; height: 7vw; }
    .serve-indicator { font-size: 2.5vw; }
    .arrow { font-size: 3.5vw; }
    .games-sets {
        flex-direction: row;
        justify-content: space-between;
    }
    .games-sets { font-size: 3vw; }
    .games-sets span span { font-size: 3vw; }
    .games-sets .left {
        align-items: flex-start;
        margin-right: auto;
    }
    .games-sets .right {
        align-items: flex-end;
        margin-left: auto;
    }
    .tiebreak { font-size: 5vw; }
    .timer { font-size: 1.5vw; }
    .timer button { font-size: 1.2vw; }
    .mode-btn { font-size: 1.2vw; min-width: 4vw; }
    .controls-bottom { margin-top: -2.5%; }
    .buttons-row {
        gap: 0.2%;
        flex-wrap: wrap;
    }
    .buttons-row button {
        font-size: 1.6vw;
        min-width: 4vw;
        padding: 0.2% 0.4%;
    }
}

@media (max-width: 1080px) (max-width: 1920px){ /* Phones */
    .container {
        flex-direction: column; /* Stack vertical en móviles para mejor visibilidad */
    }
    .scoreboard-section, .video-section {
        flex: 1;
        height: 50%; /* Divide la pantalla verticalmente */
    }
    .scoreboard {
        padding: 1%;
        height: 100%;
        overflow-y: hidden;
    }
    .team-names {
        font-size: 5vw;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .team-names input {
        width: 80%;
        margin-bottom: 0.5%;
    }
    .points {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .controls {
        flex-direction: row;
        margin: 0.5% 0;
    }
    .display {
        width: 100%;
        justify-content: center;
        gap: 2%;
    }
    .serve-indicator {
        font-size: 4vw;
    }
    .arrow {
        font-size: 5vw;
    }
    .games-sets {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .games-sets {
        font-size: 3.5vw;
    }
    .games-sets span span {
        font-size: 3.5vw;
    }
    .games-sets .left {
        align-items: flex-start;
        margin-right: auto;
    }
    .games-sets .right {
        align-items: flex-end;
        margin-left: auto;
    }
    .tiebreak {
        font-size: 6vw;
    }
    .timer {
        font-size: 2.5vw;
    }
    .timer button {
        font-size: 2vw;
    }
    .mode-btn {
        font-size: 3vw;
        min-width: auto;
    }
    .buttons-row {
        flex-direction: column;
        gap: 0.3%;
        width: 100%;
    }
    .buttons-row button {
        font-size: 4vw;
        min-width: auto;
        padding: 1% 2%;
    }
}