* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    padding: 20px;
    margin: 0;
}

h1,
h2,
h3 {
    margin-top: 0;
}

h2 {
    margin-bottom: 10px;
}

/* Botones toggle */

#togglePunto,
#toggleCriterios {
    display: block;
    min-height: 38px;
    font-size: 1rem;
    padding: 6px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    border: none;
    font-weight: bold;
    border-radius: 6px;
}

#togglePunto {
    background: #d0e7ff;
}

#toggleCriterios {
    background: #fff8e1;
}

/* Separación de bloques */

#bloquePunto,
#bloqueCriterios {
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 6px;
}

/* Bloque punto de predicción */

#bloquePunto {
    background: #e6f2ff;
}

.location-control {
    margin-bottom: 10px;
}

.location-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.location-row label {
    min-width: 170px;
}

#locationCode {
    width: 140px;
}

#estadoPunto {
    font-size: 1.4rem;
    font-weight: bold;
}

.estado-ok {
    color: #2ecc71;
}

.estado-error {
    color: #e74c3c;
}

/* Criterios */

#bloqueCriterios {
    background: #fff8e1;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: end;
}

.controls div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.controls input,
.controls button,
.location-row input,
.location-row select,
.location-row button {
    min-height: 38px;
    font-size: 1rem;
    padding: 6px 8px;
}

/* Tabla */

#tabla-wrapper {
    overflow-x: auto;
    padding-bottom: 24px;
    width: 100%;
}

table {
    border-collapse: collapse;
    min-width: max-content;
}

th {
    position: sticky;
    left: 0;
    background: white;
    color: #222;
    z-index: 5;
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
    min-width: 150px;
}

td {
    padding: 6px;
    text-align: center;
    min-width: 70px;
    color: white;
    border: 1px solid white;
}

.verde {
    background: #2ecc71;
}

.ambar {
    background: #f39c12;
}

.rojo {
    background: #e74c3c;
}

.neutro {
    background: #f4f4f4;
    color: #222;
    border: 1px solid #ccc;
}

.inicio-dia {
    box-shadow: inset 4px 0 0 black;
}

.dia-header {
    position: static;
    color: white;
    text-align: center;
    font-weight: bold;
    border: 1px solid white;
}

.dia-par {
    background: #3d3d3d !important;
}

.dia-impar {
    background: #a6a6a6 !important;
}

/* Overlay de carga */

.overlay-carga {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 9999;
    font-weight: bold;
}

.oculto {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 6px solid #ddd;
    border-top: 6px solid #34495e;
    border-radius: 50%;
    animation: girar 0.8s linear infinite;
}

@keyframes girar {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */

@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    .controls {
        display: block;
    }

    .controls div {
        margin-bottom: 12px;
    }

    .controls input,
    .controls button,
    .location-row input,
    .location-row select,
    .location-row button {
        width: 100%;
    }

    .location-row {
        align-items: stretch;
    }

    .location-row label {
        min-width: 100%;
    }

    th {
        min-width: 125px;
        font-size: 0.75rem;
        padding: 6px;
    }

    td {
        min-width: 58px;
        font-size: 0.75rem;
        padding: 6px;
    }
}