/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f1f5f9;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    padding-top: 80px;
}

/* ===== NAVBAR ===== */
.custom-navbar {
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.custom-navbar .nav-link {
    color: #cbd5e1;
    font-weight: 500;
    margin-right: 10px;
    transition: 0.3s;
}

.custom-navbar .nav-link:hover {
    color: #38bdf8;
}

.user-badge {
    background: #1e293b;
    padding: 6px 12px;
    border-radius: 20px;
    color: #e2e8f0;
    font-size: 14px;
}

.btn-logout {
    background: #ef4444;
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    transition: 0.3s;
}

.btn-logout:hover {
    background: #dc2626;
}

/* ===== DASHBOARD ===== */
.dashboard-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== MODULOS ===== */
.module-box {
    width: 80%;
    max-width: 1200px;
    margin: 20px auto;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: 0.3s;
}

/* HEADER */
.module-header {
    background: #0f172a !important; /* MISMO COLOR DEL NAVBAR */
    color: #ffffff;
    padding: 15px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 2px solid #38bdf8;
}


.module-header span {
    color: #f8fafc;
    /* blanco más limpio */
    font-weight: 600;
}

/* BOTONES HEADER */
.module-header .actions button {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    margin-left: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.module-header .actions button:hover {
    color: #38bdf8;
}

/* CONTENIDO */
.module-content {
    padding: 20px;
    max-height: 75vh;
    overflow-y: auto;
}

/* cuando está cerrado */
.module-box.collapsed .module-content {
    max-height: 0;
    padding: 0 20px;
    overflow: hidden;
}

/* ===== FORMULARIOS ===== */
input,
select {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    margin-top: 5px;
}

input:focus {
    outline: none;
    border-color: #38bdf8;
}

.button_A {
    display: inline-block;
    padding: 10px 18px;
    margin: 6px 4px;
    background-color: #007BFF; /* azul */
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.button_A:hover {
    background-color: #0056b3; /* azul más oscuro al pasar el mouse */
}


/* ===== BOTONES ===== */
button {
    background: #0ea5e9;
    border: none;
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

button:hover {
    background: #0284c7;
}

/* ===== TABLAS ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    background: #0f172a;
    color: white;
    font-weight: 500;
}

th,
td {
    padding: 12px;
    text-align: left;
}

tr {
    border-bottom: 1px solid #e2e8f0;
}

tr:hover {
    background: #f1f5f9;
}

/* FONDO GENERAL */
#contenedor-unidades {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: 12px;
}

/* TARJETA */
.unidad {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 12px;
    padding: 14px;
    font-size: 13px;
    color: #2c3e50;
    border: 1px solid #e6e9ef; /* 👈 clave para look serio */
    box-shadow: none; /* quitamos sombra pesada */
    transition: all 0.2s ease;
}



/* CONTENIDO */
.unidad-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

/* BOTONES */
.unidad-botones {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

/* CONSUMO */
.unidad .consumo {
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
}


.unidad-botones > * {
    flex: 0 0 auto; /* 👈 ya no se estiran */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* BOTONES ICONO */
.unidad-botones button {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: #f1f3f7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

/* ICONOS */
.unidad-botones i {
    font-size: 14px;
    color: #6b778c;
}

/* HOVER BOTONES */
.unidad-botones button:hover {
    background: #e4e8f0;
}

.unidad-botones button:hover i {
    color: #2c3e50;
}

.unidad.activa {
    border-color: #4c84ff;
    background: #f7faff;
}

.unidad.activa::before {
    background: #4c84ff;
}

.unidad-botones form {
    margin: 0;
    display: flex;
}

.unidad:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

/* TEXTO SECUNDARIO */
.unidad p {
    margin: 0;
    color: #7b8794;
    font-size: 12px;
}

/* HEADER (TÍTULO) */
.unidad strong {
    font-size: 14px;
    font-weight: 600;
    color: #1f2d3d;
    margin-bottom: 6px;
}

/* TEXTO */
.unidad .dato {
    font-size: 12px;
    margin: 2px 0;
}

/* BARRA */
.barra-contenedor {
    width: 100%;
    height: 6px;
    background: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 1px;
}

.barra {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

/* SIN DATOS */
.sin-datos {
    font-size: 11px;
    color: #e67e22;
}


/* ===== ALERT ===== */
.alert {
    background: #e0f2fe;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .module-box {
        width: 95%;
    }
}

/* ===== LOGIN (AISLADO) ===== */

body.login-page {
    display: flex;
    justify-content: center;  /* centra horizontal */
    align-items: center;      /* centra vertical */
    height: 100vh;            /* ocupa toda la pantalla */
    padding-top: 0 !important; /* quita espacio del navbar */
    background: #f1f5f9;
}

/* Contenedor login */
.login-container {
    background: white;
    padding: 35px;
    width: 100%;
    max-width: 380px;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    text-align: center;
}

/* Título */
.login-container h2 {
    margin-bottom: 20px;
    font-weight: 600;
    color: #0f172a;
}

/* Inputs SOLO login */
.login-container input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

/* Botón login */
.login-container button {
    width: 100%;
    padding: 12px;
    background: #0ea5e9;
    border: none;
    color: white;
    border-radius: 8px;
    margin-top: 10px;
    cursor: pointer;
}

.login-container button:hover {
    background: #0284c7;
}

/* Error */
.login-container .error {
    color: #ef4444;
    margin-bottom: 10px;
}

/* Link */
.login-container a {
    display: block;
    margin-top: 15px;
    color: #0ea5e9;
    text-decoration: none;
}

.parpadeo {
    animation: blinkRed 1s infinite;
}

@keyframes blinkRed {
    0% { opacity: 1; }
    50% { opacity: 0.2; }
    100% { opacity: 1; }
}

.parpadeo2 {
    animation: glowGreen 1s infinite;
}

@keyframes glowGreen {
    0% {
        text-shadow: 0 0 5px rgba(40,167,69,0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(40,167,69,1);
    }
    100% {
        text-shadow: 0 0 5px rgba(40,167,69,0.5);
    }
}

.button {
    text-decoration: none !important;
    border: none;
    background: transparent;
    cursor: pointer;
}

.button:hover {
    text-decoration: none !important;
}

