/* Variables para facilitar la personalización */
:root {
    --bg-color: #0b0c10;
    --card-bg-color: #0b0c10;
    --text-color: #80bfff;
    --secondary-text-color: #c5c6c7;
    --btn-bg-color: #45a29e;
    --btn-text-color: #0b0c10;
    --border-color: #80bfff;
    --active-color: #80bfff;
    --off-color: #f77f00;
    --slider-blue: rgb(21, 54, 232); /* Nuevo color azul especifico */
}

/* Estilos generales */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--secondary-text-color);
}

body {
    display: block; 
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 400px;
    background-color: var(--card-bg-color);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

/* Encabezado */
.header {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 20px;
    color: var(--secondary-text-color);
    flex-shrink: 0;
}

/* Títulos de sección */
.section-title {
    font-weight: bold;
    color: var(--text-color);
    margin: 20px 0 10px;
    font-size: 16px;
}

/* Pestañas */
.tab-content {
    display: none;
    flex: 1;
}
.tab-content.active {
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* AHORA SÍ: Permite el scroll vertical */
}

/* Botones de modo (COOL, HEAT, DRY) */
.mode-buttons {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: var(--secondary-text-color);
    cursor: pointer;
    font-size: 12px;
    padding: 10px;
    border-radius: 10px;
}
.mode-btn:hover, .mode-btn.active {
    background-color: #2c3a4a;
    color: var(--active-color);
}
.mode-btn .icon {
    font-size: 24px;
    margin-bottom: 5px;
}

/* Información de sensores */
.sensor-info {
    margin-bottom: 20px;
    flex-shrink: 0;
}
.sensor-data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.data-item {
    text-align: center;
    flex: 1;
    padding: 10px 0;
}
.data-item .label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
}
.data-item .value {
    font-size: 40px;
    font-weight: bold;
    color: var(--text-color);
}
.data-item .unit {
    font-size: 16px;
    color: var(--secondary-text-color);
}
.humidity-min-item {
    margin-top: 15px;
    padding: 10px;
    //border-top: 1px solid #4a596b;
}

/* Control de temperatura del AC */
.ac-temp-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
}
.ac-temp-section .label {
    font-size: 14px;
    color: var(--secondary-text-color);
    margin-bottom: 10px;
}
.ac-temp-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.ac-value {
    font-size: 48px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 10px;
}

/* Slider */
.slider {
    width: 90%;
    -webkit-appearance: none;
    appearance: none;
    height: 2px;
    background: var(--slider-blue);
    border-radius: 5px;
    outline: none;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--slider-blue);
    cursor: pointer;
    border: 2px solid #ffffff;
}
.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--slider-blue);
    cursor: pointer;
    border: 2px solid #ffffff;
}

/* Botones de pie de página */
.footer-buttons {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 20px;
    flex-shrink: 0;
}

/* Estilo generalizado para TODOS los botones de acción */
.action-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    transition: background-color 0.3s;
    background: none;
    border: 2px solid var(--border-color);
    color: var(--text-color);
}

.action-btn:hover {
    background-color: var(--border-color);
    color: var(--bg-color);
}

/* Estilo específico para el botón OFF/STOP (solo colores y texto) */
#off-btn {
    background-color: #ff0000 !important;
    border-color: #ff0000 !important;
    color: #ffffff !important;
}

/* Estilo específico para los botones Apply y Guardar (solo colores y sin borde extra) */
#apply-btn, #save-dry-auto-threshold-btn {
    background-color: #007bff !important;
    border-color: #007bff !important;
    color: #fff !important;
}


/* Tabla de registro (Log) */
.log-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 11px;
    /* table-layout: fixed; <-- Esto a veces causa problemas con colspan, lo quitamos */
}
.log-table th, .log-table td {
    padding: 4px;
    text-align: left;
    border-bottom: 1px solid #4a596b;
    word-wrap: break-word; 
}

/* Asignación de anchos porcentuales ajustados */
/* Aplicamos los anchos solo a las celdas normales, NO a la fila del total (usamos el selector :not(:last-child)) */
.log-table thead th:nth-child(1), 
.log-table tbody tr:not(:last-child) td:nth-child(1) {
    width: 28%; /* Fecha/Hora */
}
.log-table thead th:nth-child(2), 
.log-table tbody tr:not(:last-child) td:nth-child(2) {
    width: 33%; /* Mode (DRY AUTO) */
}
.log-table thead th:nth-child(3), 
.log-table tbody tr:not(:last-child) td:nth-child(3) {
    width: 11%; /* % */
}
.log-table thead th:nth-child(4), 
.log-table tbody tr:not(:last-child) td:nth-child(4) {
    width: 13%; /* Temp */
}
.log-table thead th:nth-child(5), 
.log-table tbody tr:not(:last-child) td:nth-child(5) {
    width: 15%; /* Status */
}


.log-table th {
    color: var(--text-color);
    font-weight: normal;
}
.log-table tr:last-child td {
    border-bottom: none;
}

/* Barra de navegación inferior */
.navbar {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    border-top: 1px solid #4a596b;
    padding-top: 10px;
    flex-shrink: 0;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--secondary-text-color);
    font-weight: bold;
    cursor: pointer;
    padding: 10px 15px;
    font-size: 14px;
}
.nav-btn.active {
    color: var(--active-color);
    border-bottom: 2px solid var(--active-color);
}

/* Estilo para el resumen de tiempo total en el LOG (ya no se usa este div) */
.total-time-summary {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-color);
}

/* style.css */

/* ... (Todo el código anterior) ... */

/* Clase de estilo de emergencia para la fila del total */
.total-row-emergency {
    font-weight: bold !important;
    border-top: 2px solid #80bfff !important;
    display: table-row !important; /* Forzar a mostrarse como fila de tabla */
    background-color: #1a1a2e !important; /* Un fondo oscuro para que resalte */
}

