/* Estilos principales para el videomarcador */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e88e5;
    --secondary-color: #43a047;
    --danger-color: #e53935;
    --warning-color: #fb8c00;
    --dark-bg: #121212;
    --darker-bg: #0a0a0a;
    --light-text: #ffffff;
    --card-bg: #1e1e1e;
    --border-color: #333;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--light-text);
    background: var(--dark-bg);
}

/* ===== PANTALLA PÚBLICA DEL MARCADOR ===== */
.scoreboard-body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    overflow: hidden;
}

.scoreboard-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /*padding: 2rem;*/
    position: relative;
}

/* Logo del club como fondo */
.logo-club-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.30;
    z-index: 1;
    pointer-events: none;
}

/* Contenedor de anuncios */
.anuncios-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 1000;
}

.anuncios-container #anuncio-imagen {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    display: block;
    object-position: center;
    transition: none; /* Se aplicará dinámicamente según el efecto */
}

/* Transiciones entre anuncios */
.anuncios-container.transicion-fade #anuncio-imagen,
#anuncio-imagen.transicion-fade {
    transition: opacity 0.8s ease-in-out;
}

.anuncios-container.transicion-slide #anuncio-imagen,
#anuncio-imagen.transicion-slide {
    transition: transform 0.8s ease-in-out, opacity 0.5s ease-in-out;
}

.anuncios-container.transicion-zoom #anuncio-imagen,
#anuncio-imagen.transicion-zoom {
    transition: transform 0.8s ease-in-out, opacity 0.5s ease-in-out;
}

.anuncios-container.transicion-flip #anuncio-imagen,
#anuncio-imagen.transicion-flip {
    transition: transform 0.8s ease-in-out;
    transform-style: preserve-3d;
}

.anuncios-container.transicion-rotate #anuncio-imagen,
#anuncio-imagen.transicion-rotate {
    transition: transform 0.8s ease-in-out, opacity 0.5s ease-in-out;
}

.anuncios-container.transicion-blur #anuncio-imagen,
#anuncio-imagen.transicion-blur {
    transition: filter 0.8s ease-in-out, opacity 0.5s ease-in-out;
}

/* Efectos específicos - solo aplicar cuando la clase está presente */
.anuncios-container.transicion-fade #anuncio-imagen.transicion-fade {
    animation: fadeIn 0.8s ease-in-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.anuncios-container.transicion-slide #anuncio-imagen.transicion-slide {
    animation: slideIn 0.8s ease-in-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.anuncios-container.transicion-zoom #anuncio-imagen.transicion-zoom {
    animation: zoomIn 0.8s ease-in-out forwards;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.anuncios-container.transicion-flip #anuncio-imagen.transicion-flip {
    animation: flipIn 0.8s ease-in-out forwards;
}

@keyframes flipIn {
    from {
        transform: rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

.anuncios-container.transicion-rotate #anuncio-imagen.transicion-rotate {
    animation: rotateIn 0.8s ease-in-out forwards;
}

@keyframes rotateIn {
    from {
        transform: rotate(180deg) scale(0.8);
        opacity: 0;
    }
    to {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

.anuncios-container.transicion-blur #anuncio-imagen.transicion-blur {
    animation: blurIn 0.8s ease-in-out forwards;
}

@keyframes blurIn {
    from {
        filter: blur(10px);
        opacity: 0;
    }
    to {
        filter: blur(0);
        opacity: 1;
    }
}

/* Animación de GOL */
.gol-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 25vw;
    font-weight: bold;
    color: #ffd700;
    z-index: 100;
    text-shadow: 
        0 0 30px rgba(255, 215, 0, 0.9),
        0 0 60px rgba(255, 215, 0, 0.7),
        0 0 90px rgba(255, 215, 0, 0.5),
        0 0 120px rgba(255, 215, 0, 0.3),
        8px 8px 0px #ff6b00,
        -8px -8px 0px #ff6b00,
        8px -8px 0px #ff6b00,
        -8px 8px 0px #ff6b00;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-family: 'Arial Black', Arial, sans-serif;
    letter-spacing: 0.15em;
    white-space: nowrap;
}

.gol-animation.show {
    opacity: 1;
    animation: golAnimation 5s ease-out forwards;
}

@keyframes golAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-15deg);
        opacity: 0;
    }
    10% {
        transform: translate(-50%, -50%) scale(1.3) rotate(8deg);
        opacity: 1;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.1) rotate(-5deg);
        opacity: 1;
    }
    30% {
        transform: translate(-50%, -50%) scale(1.15) rotate(3deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1) rotate(0deg);
        opacity: 1;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.1) rotate(0deg);
        opacity: 1;
    }
    85% {
        transform: translate(-50%, -50%) scale(1.05) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.9) rotate(15deg);
        opacity: 0;
    }
}

/* Animación de tarjeta */
.tarjeta-animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.tarjeta-animation-container.show {
    opacity: 1;
}

.tarjeta-animation-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 4rem;
    padding: 2rem;
}

.tarjeta-animation-imagen {
    flex: 0 0 auto;
    max-width: 40%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tarjeta-animation-imagen img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tarjeta-animation-texto {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tarjeta-animation-texto h1 {
    font-size: 8vw;
    font-weight: bold;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-align: center;
    margin: 0;
    text-shadow: 
        0 0 20px rgba(255, 255, 255, 0.5),
        0 0 40px rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .tarjeta-animation-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    .tarjeta-animation-imagen {
        max-width: 60%;
        max-height: 40vh;
    }
    
    .tarjeta-animation-texto h1 {
        font-size: 12vw;
    }
}

/* ===== ANIMACIÓN DE CAMBIO ===== */
.cambio-animation-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.cambio-animation-container.show {
    display: flex;
}

.cambio-texto-equipo {
    color: #ffffff;
    font-size: 7rem;
    margin-bottom: 4rem;
    text-align: center;
    text-transform: uppercase;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.cambio-numeros-container {
    display: flex;
    gap: 6rem;
    align-items: center;
    justify-content: center;
}

.cambio-numero-columna {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.cambio-flecha {
    width: 200px;
    height: 200px;
}

.cambio-flecha-verde {
    color: #4caf50;
    filter: drop-shadow(0 0 20px rgba(76, 175, 80, 0.6));
}

.cambio-flecha-roja {
    color: #f44336;
    filter: drop-shadow(0 0 20px rgba(244, 67, 54, 0.6));
}

.cambio-numero-entra {
    font-size: 18rem;
    color: #4caf50;
    font-weight: 900;
    text-shadow: 0 0 40px rgba(76, 175, 80, 0.6);
}

.cambio-numero-sale {
    font-size: 18rem;
    color: #f44336;
    font-weight: 900;
    text-shadow: 0 0 40px rgba(244, 67, 54, 0.6);
}

@media (max-width: 768px) {
    .cambio-texto-equipo {
        font-size: 3rem;
        margin-bottom: 2rem;
    }
    
    .cambio-numeros-container {
        gap: 3rem;
    }
    
    .cambio-flecha {
        width: 120px;
        height: 120px;
    }
    
    .cambio-numero-entra,
    .cambio-numero-sale {
        font-size: 8rem;
    }
}

.espera-mensaje {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
    position: relative;
    z-index: 10;
}

.espera-mensaje h1 {
    font-size: 8vw;
    font-weight: bold;
    color: var(--light-text);
    text-shadow: 
        0 0 20px rgba(255, 255, 255, 0.5),
        0 0 40px rgba(255, 255, 255, 0.3);
    letter-spacing: 0.1em;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

.scoreboard-wrapper {
    width: 100%;
    max-width: 1800px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    position: relative;
    overflow: hidden;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
    flex: 1;
}

.scoreboard-wrapper.transitioning-out {
    transform: perspective(1000px) rotateY(-90deg) translateX(-50%);
    opacity: 0;
}

.scoreboard-wrapper.transitioning-in {
    animation: foldIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.timer-section {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 2rem;
}

.scoreboard-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    align-items: stretch;
    justify-items: center;
    gap: 2rem;
    padding: 0 2rem;
    flex: 1;
    min-height: 0;
}

@keyframes foldIn {
    0% {
        transform: perspective(1000px) rotateY(90deg) translateX(50%);
        opacity: 0;
    }
    100% {
        transform: perspective(1000px) rotateY(0deg) translateX(0);
        opacity: 1;
    }
}

.team {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 100%;
}

.local-team {
    grid-column: 1;
    justify-self: center;
}

.visitor-team {
    grid-column: 2;
    justify-self: center;
}

.teams-names-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    align-items: center;
}

.team-name {
    font-size: 6rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    /*text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);*/
    width: 100%;
    text-align: center;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.2;
}

.local-team-name {
    color: #ff9800;
    text-align: center;
}

.visitor-team-name {
    color: #4caf50;
    text-align: center;
}

.team-score {
    font-size: 30rem;
    font-weight: 900;
    line-height: 0.9;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    font-variant-numeric: tabular-nums;
    width: 500px;
    min-width: 500px;
    max-width: 500px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
    height: 100%;
    min-height: 100%;
    position: relative;
    padding: 0;
}

.local-team .team-score {
    color: #ff9800;
}

.visitor-team .team-score {
    color: #4caf50;
}

.match-info {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Contenedor para campo y parte en la misma línea */
.match-info-header {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 2rem;
}

/* Cuando solo hay un campo (campo oculto), centrar solo la parte */
.match-info-header .parte-info {
    flex: 0 0 auto;
}

/* Cuando hay múltiples campos, campo y parte lado a lado centrados en su mitad */
.match-info.multiple-campos .match-info-header {
    justify-content: space-between;
    gap: 0;
}

.match-info.multiple-campos .match-info-header .campo-info {
    flex: 1;
    text-align: center;
}

.match-info.multiple-campos .match-info-header .parte-info {
    flex: 1;
    text-align: center;
}

.campo-info {
    font-size: 5.5rem;
    color: white;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    margin: 0;
}

.campo-info #campo-nombre {
    text-transform: uppercase;
}

.parte-info {
    font-size: 5.5rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #ffffff;
    margin: 0;
}

.timer {
    font-size: 12rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: #ffffff;
    /*text-shadow: 0 0 40px rgba(255, 255, 255, 0.6);*/
    margin: 0;
    transition: color 0.3s, text-shadow 0.3s;
    min-width: 400px;
    text-align: center;
    display: block;
}

.timer.tiempo-excedido {
    color: #ff4444;
    /*text-shadow: 0 0 40px rgba(255, 68, 68, 0.8);*/
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.timer-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 900;
}

.status-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s;
}

.status-dot.active {
    background: #4caf50;
    box-shadow: 0 0 20px #4caf50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Layout para móviles en vertical: marcador arriba, anuncios abajo */
@media (max-width: 932px) and (orientation: portrait) {
    .scoreboard-container {
        flex-direction: column;
        padding: 0;
        align-items: stretch;
        justify-content: flex-start;
    }
    
    /* Ordenar elementos: marcador arriba (order: 1), anuncios abajo (order: 2) */
    .scoreboard-wrapper {
        order: 1;
        height: 50vh;
        max-height: 50vh;
        min-height: 50vh;
        width: 100%;
        padding: 1rem;
        overflow: hidden;
        flex-shrink: 0;
        gap: 0rem !important;
    }
    
    .espera-mensaje {
        order: 1;
        height: 50vh;
        max-height: 50vh;
        min-height: 50vh;
        width: 100%;
        flex-shrink: 0;
    }
    
    /* Anuncios siempre en la mitad inferior en móviles verticales */
    .anuncios-container {
        order: 2;
        position: relative;
        top: auto;
        left: auto;
        width: 100vw;
        height: 50vh;
        max-height: 50vh;
        min-height: 50vh;
        flex-shrink: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
    
    .anuncios-container #anuncio-imagen {
        width: 100%;
        height: auto;
        max-height: 100%;
        object-fit: contain;
        object-position: center;
    }
    
    /* Desactivar transiciones en móviles */
    .anuncios-container.transicion-fade #anuncio-imagen,
    #anuncio-imagen.transicion-fade,
    .anuncios-container.transicion-slide #anuncio-imagen,
    #anuncio-imagen.transicion-slide,
    .anuncios-container.transicion-zoom #anuncio-imagen,
    #anuncio-imagen.transicion-zoom,
    .anuncios-container.transicion-flip #anuncio-imagen,
    #anuncio-imagen.transicion-flip,
    .anuncios-container.transicion-rotate #anuncio-imagen,
    #anuncio-imagen.transicion-rotate,
    .anuncios-container.transicion-blur #anuncio-imagen,
    #anuncio-imagen.transicion-blur {
        transition: none !important;
        animation: none !important;
    }
    
    /* Ajustar tamaño del mensaje en móviles */
    .espera-mensaje h1 {
        font-size: 6vw;
    }
    
    /* Reducir fuentes del marcador manteniendo el formato de desktop */
    .timer-section {
        padding: 0 1rem;
    }
    
    .match-info {
        gap: 0.5rem;
    }
    
    .match-info-header {
        gap: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .match-info.multiple-campos .match-info-header {
        gap: 0;
    }
    
    .campo-info {
        font-size: 1rem;
        margin: 0;
    }
    
    .parte-info {
        font-size: 1rem;
        margin: 0;
    }
    
    .timer {
        font-size: 3rem;
    }
    
    .timer-status {
        font-size: 1rem;
        gap: 0.5rem;
    }
    
    .scoreboard-header {
        gap: 1rem;
        padding: 0 1rem;
        grid-template-columns: 1fr 1fr;
    }
    
    .team-score {
        font-size: 10rem;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    /*
    .teams-names-bar {
        gap: 1rem;
        padding: 0 1rem;
    }*/
    
    .team-name {
        font-size: 1.5rem;
        padding: 0.5rem;
        line-height: 1.2;
    }
    
    /* Reducir animación de gol */
    .gol-animation {
        font-size: 15vw;
    }
}

/* ===== PANTALLA DE LOGIN ===== */
.login-body {
    background: linear-gradient(135deg, #0a0a0a 0%, #121212 100%);
    background: -webkit-linear-gradient(135deg, #0a0a0a 0%, #121212 100%);
    min-height: 100vh;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 2rem;
    box-sizing: border-box;
}

.login-box {
    background: #1e1e1e;
    background: var(--card-bg);
    border-radius: 20px;
    -webkit-border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    -webkit-box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    color: #ffffff;
    color: var(--light-text);
    width: 100%;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    min-width: 0;
    border: 1px solid #333;
    border: 1px solid var(--border-color);
}

.login-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    width: 100%;
}

.login-logo {
    width: 120px;
    height: 120px;
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    -webkit-object-fit: contain;
    display: block;
}

.login-box h1 {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 0.5rem;
    color: #1e88e5;
    color: var(--primary-color);
    white-space: nowrap;
    line-height: 1.2;
    width: 100%;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
}

.login-box h2 {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--light-text);
    font-weight: normal;
    opacity: 0.8;
}

.form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--light-text);
    opacity: 0.9;
    text-align: left;
}

.form-group input {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--light-text);
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-box form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-box .btn {
    width: auto;
    min-width: 200px;
    margin-top: 0.5rem;
}

.error-message {
    background: rgba(229, 57, 53, 0.2);
    color: var(--danger-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--danger-color);
}

.login-info {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

    .login-info p {
        margin: 0.5rem 0;
    }

/* ===== PANTALLA DE CONTROL ===== */
.control-body, .config-body {
    background: var(--dark-bg);
    min-height: 100vh;
}

.top-nav {
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
}

.nav-content h1 {
    font-size: 1.8rem;
    color: var(--light-text);
}

.nav-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Checkbox completamente oculto - nunca visible */
.menu-checkbox {
    display: none;
}

/* Botón menú hamburguesa - oculto en desktop */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 50px;
    height: 50px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    padding: 12px 10px;
    z-index: 1001;
    box-sizing: border-box;
}

.menu-toggle span {
    display: block;
    height: 4px;
    width: 100%;
    background: var(--light-text);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Animación cuando el checkbox está marcado - compatible con Safari antiguo */
.menu-checkbox:checked ~ .menu-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-checkbox:checked ~ .menu-toggle span:nth-child(2) {
    opacity: 0;
}

.menu-checkbox:checked ~ .menu-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

.control-container, .config-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.control-section, .config-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    transition: opacity 0.3s, background-color 0.3s;
}

.control-section.config-bloqueada {
    background: var(--darker-bg);
    opacity: 0.7;
    pointer-events: none;
}

.control-section.config-bloqueada * {
    cursor: not-allowed;
}

/* Permitir que el header plegable funcione incluso cuando está bloqueada */
.control-section.config-bloqueada .collapsible-header,
.control-section.config-bloqueada .collapse-toggle {
    pointer-events: auto;
    cursor: pointer;
}

.control-section h2, .config-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--light-text);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Alinear contenido inferior con título en recuadros de animaciones e integraciones (desktop) */
@media (min-width: 769px) {
    .animacion-card .form-row,
    .integracion-card .form-row {
        margin-left: 0;
        padding-left: 0;
    }
    
    .animacion-card .form-group,
    .integracion-card .form-group {
        margin-left: 0;
        padding-left: 0;
    }
}

/* Estilos para sección plegable en móviles */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: 100%;
}

.collapsible-header span:first-child {
    flex: 1;
}

.collapse-toggle {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.collapse-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.control-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: visible;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: none;
    opacity: 1;
}

.control-section.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--light-text);
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-control:disabled {
    background: var(--darker-bg);
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Botones */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

/* Estilos específicos para el botón de Tuya en desktop */
/* Asegurar que tenga exactamente los mismos estilos que los demás botones */
#btn-tuya-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    /* Usar exactamente los mismos valores que .btn */
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Estilos específicos para el botón de Suricato en desktop */
/* Asegurar que tenga exactamente los mismos estilos que los demás botones */
#btn-suricato-abrir {
    display: inline-block;
    /* Usar exactamente los mismos valores que .btn */
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* El texto dentro del botón debe tener exactamente los mismos estilos */
#btn-tuya-toggle .tuya-toggle-text {
    /* No aplicar ningún estilo adicional, heredar todo del botón */
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.4);
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #555;
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background: #2e7d32;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c62828;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Control del cronómetro */
.timer-controls {
    text-align: center;
}

.timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.timer-display #control-timer {
    font-size: 4rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: var(--light-text);
    transition: color 0.3s;
    min-width: 200px;
    text-align: center;
    display: inline-block;
}

.timer-display #control-timer.tiempo-excedido {
    color: #ff4444;
    animation: pulse-red 1s infinite;
}

.timer-display #control-parte {
    font-size: 1.5rem;
    color: #bb86fc;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.timer-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    /*margin-bottom: 1.5rem;*/
}

.parte-controls {
    margin-top: 1rem;
}

/* Control del marcador */
.score-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

.team-control {
    text-align: center;
}

.team-control h3 {
    font-size: 1.5rem;
    margin-bottom: -1rem;
    color: var(--light-text);
}

.score-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
}

.score-display {
    font-size: 5rem;
    font-weight: 900;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
    min-width: 120px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-score {
    width: 60px;
    height: 60px;
    font-size: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-plus {
    background: var(--secondary-color);
}

.btn-minus {
    background: var(--danger-color);
}

/* Controles de tarjetas */
.tarjetas-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-top: 0rem !important;
}

.btn-tarjeta {
    border-radius: 12px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: none;
}

.btn-tarjeta:hover {
    transform: scale(1.1);
}

.btn-tarjeta-amarilla:hover {
    background: rgba(255, 215, 0, 0.1);
}

.btn-tarjeta-roja:hover {
    background: rgba(255, 68, 68, 0.1);
}

.tarjeta-icon {
    font-size: 2rem;
    line-height: 1;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.btn-cambio:hover {
    background: rgba(76, 175, 80, 0.1);
}

.warning-text {
    color: var(--warning-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Configuración */
.categorias-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: bold;
    margin-left: 0.5rem;
    width: min-content;
}

.badge-warning {
    background-color: #ffc107;
    color: #000;
}

.badge-success {
    background-color: #28a745;
    color: #fff;
}

.badge-secondary {
    background-color: #6c757d;
    color: #fff;
}

.usuario-item,
.campo-item,
.partido-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.usuario-info,
.campo-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Tamaño de fuente específico para campo-info en la sección de configuración */
.config-section .campo-info,
.campos-list .campo-info {
    font-size: 1.2rem;
    color: var(--light-text);
    font-weight: normal;
    margin-bottom: 0;
    text-align: left;
    text-transform: none;
}

.usuario-fecha {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.usuario-actions,
.campo-actions,
.partido-actions {
    display: flex;
    gap: 0.5rem;
}

.partido-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.partido-info {
    flex: 1;
    min-width: 250px;
}

.partido-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.partido-header strong {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.partido-equipos {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.partido-equipos .equipo-local {
    color: #ff9800;
    font-weight: bold;
}

.partido-equipos .equipo-visitante {
    color: #4caf50;
    font-weight: bold;
}

.partido-equipos .marcador {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--light-text);
    min-width: 60px;
    text-align: center;
}

.partido-usuario {
    margin-top: 0.5rem;
    color: #999;
    font-size: 0.9rem;
}

.partidos-list {
    margin-top: 1rem;
}

.categoria-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--darker-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.categoria-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.categoria-info strong {
    font-size: 1.2rem;
    color: var(--light-text);
}

.categoria-tipo {
    color: #999;
    font-size: 0.9rem;
}

.categoria-actions {
    display: flex;
    gap: 0.5rem;
}

.categoria-form {
    margin-top: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.alert-success {
    background: rgba(67, 160, 71, 0.2);
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
}

.alert-error {
    background: rgba(229, 57, 53, 0.2);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    overflow: auto;
}

.modal-content {
    background: var(--card-bg);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    border: 1px solid var(--border-color);
    position: relative;
}

.close-modal {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: var(--light-text);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 1400px) {
    .scoreboard-header {
        grid-template-columns: 1fr 300px 1fr;
        padding: 0 1.5rem;
        gap: 1.5rem;
    }
    
    .team-name {
        font-size: 3rem;
    }
    
    .team-score {
        font-size: 22rem;
        width: 350px;
        min-width: 350px;
        max-width: 350px;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
    
    .timer {
        font-size: 6rem;
        min-width: 300px;
    }
    
}

@media (max-width: 992px) {
    .login-box {
        padding: 2rem 1.5rem;
        min-width: 0;
        max-width: 90%;
        margin: 0 auto;
    }
    
    .login-box h1 {
        font-size: 1.8rem;
        white-space: nowrap;
        padding: 0;
    }
    
    .login-container {
        padding: 1rem;
        max-width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .form-group {
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
    
    .form-group input {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .scoreboard-header {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        padding: 0 1rem;
    }
    
    .local-team {
        grid-column: 1;
        justify-self: center;
    }
    
    .visitor-team {
        grid-column: 2;
        justify-self: center;
    }
    
    .timer-section {
        padding: 0 1rem;
    }
    
    .teams-names-bar {
        grid-template-columns: 1fr 1fr;
        /*gap: 1rem;*/
        /*padding: 0 0.5rem;*/
    }
    
    .team-name {
        font-size: 1rem;
        text-align: center !important;
    }
    
    .team-score {
        font-size: 9rem;
        width: 250px;
        min-width: 250px;
        max-width: 250px;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
    
    .timer {
        font-size: 3rem;
        min-width: 200px;
    }
    
    .score-controls {
        grid-template-columns: 1fr;
    }
    
    .vs-divider {
        display: none;
    }
    
    .nav-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .nav-content h1 {
        font-size: 1.2rem;
    }
    
    /* En móviles, hacer la sección de configuración plegable */
    #seccion-configuracion .collapsible-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    #seccion-configuracion .collapse-toggle {
        display: flex;
        margin-left: auto;
        flex-shrink: 0;
        padding-left: 1rem;
    }
    
    /* Por defecto, colapsada en móviles */
    #seccion-configuracion.collapsed .collapsible-content {
        display: none;
    }
    
    .top-nav {
        padding: 1rem;
    }
    
    /* Mostrar botón hamburguesa en móviles */
    .menu-toggle {
        display: flex !important;
    }
    
    /* Ocultar nav-links por defecto en móviles */
    .nav-links {
        display: none !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.95);
        flex-direction: column;
        padding: 2rem;
        gap: 1rem;
        z-index: 1000;
        justify-content: center;
        align-items: center;
    }
    
    /* Mostrar nav-links cuando el checkbox está marcado - compatible con Safari antiguo */
    .menu-checkbox:checked ~ .nav-links {
        display: flex !important;
    }
    
    .nav-links .btn {
        width: 100%;
        max-width: 300px;
        text-align: center;
        padding: 1rem;
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    /* Asegurar que el botón de Tuya tenga exactamente el mismo estilo en móvil */
    .nav-links #btn-tuya-toggle {
        display: flex !important;
    }
    
    /* Asegurar que el botón de Suricato tenga exactamente el mismo estilo en móvil */
    .nav-links #btn-suricato-abrir {
        display: flex !important;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 1.2rem !important;
        font-weight: 600 !important;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 1.2rem !important;
        font-weight: 600;
        width: 100%;
        max-width: 300px;
        padding: 1rem;
    }
    
    .nav-links #btn-tuya-toggle .tuya-toggle-text {
        text-align: center;
        font-size: 1.2rem !important;
        font-weight: 600;
        font-family: inherit;
        line-height: inherit;
        letter-spacing: inherit;
    }
    
    .nav-links #btn-tuya-toggle .tuya-status-dot {
        flex-shrink: 0;
        margin-right: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .form-group:last-child {
        margin-bottom: 0;
    }
    
    #seccion-configuracion .form-group label {
        margin-bottom: 0.5rem;
    }
    
    #seccion-configuracion .form-control {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ajustar elementos de gestión en móviles */
    .usuario-item,
    .campo-item,
    .categoria-item,
    .partido-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .usuario-info,
    .campo-info,
    .categoria-info,
    .partido-info {
        width: 100%;
    }
    
    .usuario-actions,
    .campo-actions,
    .categoria-actions,
    .partido-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .usuario-actions .btn,
    .campo-actions .btn,
    .categoria-actions .btn,
    .partido-actions .btn {
        flex: 1;
        min-width: 120px;
        max-width: calc(50% - 0.25rem);
    }
    
    /* Ajustes adicionales para login en móviles pequeños */
    .login-box h1 {
        font-size: 1.5rem;
        white-space: nowrap;
    }
    
    .login-box {
        padding: 1.5rem 1rem;
        max-width: 85%;
    }
    
    .login-container {
        padding: 0.5rem;
    }
    
    .form-group {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
    
    .form-group input {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .partido-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .partido-equipos {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Ajustar tamaño de animación GOL en móviles */
    .gol-animation {
        font-size: 30vw;
    }
    
    /* Ajustar tamaño del mensaje de espera en móviles */
    .espera-mensaje h1 {
        font-size: 12vw;
    }
}

