/* Constantes */
:root {
    --altura-footer: 70px;
    --altura-botones-fijos: 80px;
    --espacio-botones-footer: 10px;
    --altura-titulo: 120px;
    --espacio-consistente: 20px;
    --margen-gif-centrado: 40px;
}

/* Asegura que el html ocupe toda la altura */
html {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: var(--altura-footer);
}

.titulo {
    text-align: center;
    padding-top: 30px;
    font-size: 2.5em;
    color: #333;
    flex-shrink: 0;
    margin-bottom: calc(var(--espacio-consistente) * 0.4);
}

.fecha-container {
    text-align: center;
    font-size: 1.5em;
    color: #555;
    width: 80%;
    max-width: 800px;
    margin: 0 auto var(--espacio-consistente);
    display: none;
}

/* CONTENEDOR PRINCIPAL */
.contenedor-principal {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: calc(var(--altura-botones-fijos) + 20px);
    box-sizing: border-box;
    min-height: calc(100vh - var(--altura-titulo) - var(--altura-footer));
}

/* ESTADO INICIAL: centrado */
.estado-inicial {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    height: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

/* GIF */
.gif-container {
    width: 80%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #e8f5e9;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    max-height: 400px;
    overflow: hidden;
}

.gif-container img {
    max-width: 100%;
    max-height: 375px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transform: scale(0.85);
    transform-origin: center;
}

.gif-texto {
    width: 100%;
    text-align: center;
    font-size: 0.95em;
    color: #2c3e50;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 15px 20px;
    font-weight: 600;
    line-height: 1.6;
    border-radius: 8px;
    border-top: 3px solid #4CAF50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.gif-texto-separador {
    display: block;
    font-size: 0.85em;
    font-weight: normal;
    color: #555;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(76, 175, 80, 0.2);
}

/* BOTÓN COMENZAR */
.boton-comenzar-container {
    width: 100%;
    max-width: 300px;
    display: flex;
    justify-content: center;
}

.boton-comenzar {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 1.4em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    width: 100%;
}

.boton-comenzar:hover {
    background-color: #45a049;
    transform: scale(1.03);
}

.boton-comenzar:active {
    transform: scale(0.98);
}

/* ESTADO ENTRENAMIENTO */
.estado-entrenamiento {
    display: none;
    flex-direction: column;
    width: 100%;
}

.contenedor-principal.con-registros .estado-inicial {
    display: none;
}

.contenedor-principal.con-registros .estado-entrenamiento {
    display: flex;
}

/* Tabla */
.tabla-container {
    width: 80%;
    max-width: 800px;
    margin: var(--espacio-consistente) auto;
    max-height: 0;
    overflow-y: hidden;
    transition: max-height 0.3s ease;
}

.tabla-container.con-registros {
    max-height: 35vh;
    overflow-y: auto;
    display: block;
}

/* Cronómetro */
.cronometro-container {
    display: none;
    width: 80%;
    max-width: 800px;
    margin: var(--espacio-consistente) auto;
    font-size: 1.8em;
    color: #333;
    text-align: center;
    padding: 15px;
    background-color: #e8f5e9;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.cronometro-container.mostrar {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

/* BOTONES FIJOS - SOLUCIÓN PRINCIPAL */
.botones-fijos {
    position: fixed;
    bottom: calc(var(--altura-footer) + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(5px);
    z-index: 1000;
}

.botones-fijos.visible {
    display: flex;
}

.boton {
    width: 120px;
    height: 60px;
    border-radius: 12px;
    border: none;
    color: white;
    font-size: 1em;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.2s ease;
}

.boton-registrar { background-color: #4CAF50; }
.boton-borrar { background-color: #f44336; }

.boton-registrar:hover { background-color: #45a049; transform: scale(1.05); }
.boton-borrar:hover { background-color: #d32f2f; transform: scale(1.05); }
.boton:active { transform: scale(0.95); }

/* Tabla estilos */
table {
    width: 100%;
    border-collapse: collapse;
}

td {
    padding: 10px;
    text-align: center;
    font-size: 1.5em;
    color: #444;
}

.contenido-celda {
    display: flex;
    align-items: center;
    justify-content: center;
}

.boton-eliminar {
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
}

.boton-eliminar:hover {
    background-color: #ff5252;
}

/* Scroll personalizado (solo en tabla) */
.tabla-container::-webkit-scrollbar {
    width: 8px;
}
.tabla-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.tabla-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}
.tabla-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* FOOTER */
footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    font-size: 0.85em;
    color: #777;
    padding: 8px 20px;
    box-sizing: border-box;
    background-color: #f0f0f0;
    border-top: 1px solid #ddd;
    height: var(--altura-footer);
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
    z-index: 999;
}

footer a {
    color: #444;
    text-decoration: underline;
}
footer a:last-child {
    color: #FF5F5F;
    text-decoration: none;
    font-weight: bold;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    :root {
        --altura-footer: 65px;
        --altura-botones-fijos: 70px;
        --espacio-consistente: 15px;
    }

    .botones-fijos {
        gap: 15px;
        padding: 8px 15px;
        bottom: calc(var(--altura-footer) + 8px);
    }

    .boton {
        width: 110px;
        height: 55px;
        font-size: 0.95em;
    }

    .boton-comenzar {
        font-size: 1.2em;
        padding: 14px 24px;
    }

    .tabla-container.con-registros {
        max-height: 30vh;
    }
}

/* Ocultar scroll global */
* {
    scrollbar-width: none;
}
*::-webkit-scrollbar {
    display: none;
}
