@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 20px;
}

.container {
    background-color: #ffffff;
    padding: 20px 40px 40px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    box-sizing: border-box;
}

header {
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 25px;
    padding-bottom: 15px;
}

h1 {
    text-align: center;
    color: #1a237e;
    font-weight: 700;
    margin: 0 0 15px 0;
}

h2 {
    color: #3f51b5;
    font-weight: 500;
    border-bottom: 2px solid #e8eaf6;
    padding-bottom: 8px;
    margin-top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === Indicador de estado === */
.status-indicator {
    font-size: 0.9rem;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 1rem;
    color: #fff;
}
.status-indicator.online {
    background-color: #22c55e; /* Verde */
}
.status-indicator.offline {
    background-color: #ef4444; /* Rojo */
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    color: #5c6bc0;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-link:hover {
    background-color: #e8eaf6;
}

.tab-link.active {
    background-color: #3f51b5;
    color: white;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

#current-config pre {
    background-color: #e8eaf6;
    color: #1a237e;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid #c5cae9;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #3f51b5;
    font-weight: 500;
}

.form-group input[type="time"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
    border-color: #3f51b5;
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.2);
    outline: none;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 0.85em;
    line-height: 1.4;
}

/* === Botones === */
button {
    background-color: #3f51b5;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    width: 100%;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    margin-top: 10px;
}

button:hover {
    background-color: #303f9f;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

button:disabled {
    background-color: #c5cae9;
    cursor: not-allowed;
}

/* Botones especiales */
.button-small {
    background-color: #007bff;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    width: auto;
}
.button-small:hover { background-color: #0056b3; }

.button-danger {
    background-color: #dc3545;
}
.button-danger:hover {
    background-color: #c82333;
}

.button-warning {
    background-color: #ffc107;
    color: #212529;
}
.button-warning:hover {
    background-color: #e0a800;
}

.button-primary {
    background-color: #0d6efd;
}
.button-primary:hover {
    background-color: #0b5ed7;
}

.button-info {
    background-color: #0dcaf0;
}
.button-info:hover {
    background-color: #31d2f2;
}

/* === Mensajes === */
.message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.5s;
}
.message.show { opacity: 1; }
.message.success {
    background-color: #dcedc8;
    color: #33691e;
    border: 1px solid #a5d6a7;
}
.message.error {
    background-color: #ffcdd2;
    color: #b71c1c;
    border: 1px solid #ef9a9a;
}

/* === Diagnóstico / Logs / Alertas === */
#diagnostic-output, #alerts-container {
    margin-top: 20px;
    background-color: #e8eaf6;
    color: #1a237e;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    min-height: 100px;
    white-space: pre-wrap;
    word-break: break-all;
}

.logs-container {
    background-color: #2b2b2b;
    color: #f1f1f1;
    font-family: 'Courier New', Courier, monospace;
    padding: 15px;
    border-radius: 5px;
    height: 400px;
    overflow-y: scroll;
    border: 1px solid #444;
}

/* === Banner de reinicio === */
.reboot-banner {
    background-color: #ffc107;
    color: #333;
    padding: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    display: none;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* === Estado en tiempo real === */
.estado-tiempo-real {
    margin-bottom: 2rem;
    background: #f8fafc;
    border: 2px solid #e0e7ef;
    border-radius: 1rem;
    padding: 1.5rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.estado-tiempo-real h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: #1a365d;
}
.estado-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: stretch;
}
.estado-item {
    flex: 1 1 120px;
    min-width: 120px;
    max-width: 160px;
    background: #fff;
    border-radius: 0.7rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 1rem 0.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.estado-item .label {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 0.2rem;
}
.estado-item .unidad {
    font-size: 0.9rem;
    color: #64748b;
    margin-left: 0.2rem;
}
#modo-valor.day { color: #22c55e; font-weight: bold; }
#modo-valor.night { color: #2563eb; font-weight: bold; }
#bateria-valor.low { color: #ef4444; font-weight: bold; }
#rssi-valor.weak { color: #ef4444; }
#rssi-valor.good { color: #22c55e; }
#rssi-valor.medium { color: #f59e42; }

/* === Notificaciones de Problemas === */
.problem-notification {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.problem-notification.alta {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.problem-notification.media {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.problem-notification.baja {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.problem-icon {
    font-size: 1.2rem;
    margin-right: 10px;
}

.problem-text {
    flex: 1;
    font-size: 0.95rem;
}

.problem-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    padding: 0;
    margin-left: 10px;
    width: auto;
    opacity: 0.7;
}

.problem-close:hover {
    opacity: 1;
    background: none;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 900px) {
    .estado-grid { flex-direction: column; gap: 0.7rem; }
    .estado-item { max-width: 100%; }
    .problem-notification {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}
