/* ======================================================
   RESET GLOBAL
====================================================== */
* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}

body {
    margin: 0;
    display: flex;
    min-height: 100vh;
    background: #f5f7fb;
    color: #0f172a;
}

/* ======================================================
   SIDEBAR (DESKTOP)
====================================================== */
.sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 2002;
    transition: transform 0.3s ease;
}

.sidebar .logo {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 30px;
}

.sidebar a {
    display: block;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    font-weight: 500;
    transition: 0.2s;
}

.sidebar a:hover,
.sidebar a.active {
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 600;
}

/* ======================================================
   MAIN
====================================================== */
.main {
    flex: 1;
    margin-left: 240px;
    padding: 25px;
    overflow-y: auto;
}

/* ======================================================
   OVERLAY (MÓVIL)
====================================================== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    z-index: 2000;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ======================================================
   FilTERS
====================================================== */

.filters {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    gap: 20px;
    display: flex;
    align-items: flex-start;
}
.filter_home {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 280px 1fr 1fr 220px;
    gap: 20px;
    align-items: start;
}

.filters input,
.filters button {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #cbd5f5;
}
.filter_home input,
.filter_home button {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #cbd5f5;
}

/* Panel completo */
.variables-panel {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 25px;
    margin-bottom: 30px;
    align-items: start;
}


.variables-selector {
    background: #ffffff;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.variables-selector h4 {
    margin-bottom: 12px;
    font-size: 15px;
}

.variables-selector label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
}

.valores-actuales {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.valor-box {
    background: #f8fafc;
            border-radius: 12px;
            padding: 14px;
            text-align: center;
            border-left: 5px solid #2563eb;
            box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.valor-box span {
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
}

.valor-box strong {
    display: block;
    font-size: 26px;
    font-weight: bold;
    color: #1e40af;
}

.grupo-selector {
    margin-bottom: 8px;
}

.grupo-header {
    background: #f1f5f9;
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.grupo-lista {
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.grupo-lista label {
    font-size: 13px;
}

.grupo-lista.oculto {
    display: none;
}

.equipo-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.equipo-selector label {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.equipo-selector select {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: white;
    font-size: 14px;
    cursor: pointer;
    min-width: 80px;
    transition: all 0.2s ease;
}

.equipo-selector select:hover {
    border-color: #6a5cff;
}

.equipo-selector select:focus {
    outline: none;
    border-color: #6a5cff;
    box-shadow: 0 0 0 2px rgba(106, 92, 255, 0.15);
}

.titulo-seccion {
    width: 100%;
    text-align: center;
    margin: 20px 0 30px 0;
    position: relative;
}

.titulo-seccion h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    display: inline-block;
    padding: 0 20px;
    background: #f6f7fb; /* mismo fondo del dashboard */
    position: relative;
    z-index: 2;
}

/* ======================================================
   HEADER
====================================================== */
.header {
    margin-bottom: 25px;
}

.header-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.header-left { text-align: left; }
.header-center { text-align: center; }
.header-right { text-align: right; }

.logout {
    color: #ef4444;
    text-decoration: none;
    font-weight: 600;
}

.plant-selector-form {
    margin-bottom: 10px;
}

.plant-selector {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    font-weight: 600;
}

.plant-icon {
    font-size: 18px;
}

.plant-select {
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    padding-right: 10px;
}

.select-equipo {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 220px;
    outline: none;
    transition: all 0.2s ease;
}

.select-equipo:hover {
    border-color: #6366f1;
}

.select-equipo:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}

/* ======================================================
   KPIs
====================================================== */
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi {
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.kpi h4 { font-size: 13px; }
.kpi span { font-size: 30px; font-weight: bold; }
.kpi p { font-size: 12px; }

.warning { background: #fef9c3; border-left: 5px solid #eab308; }
.info    { background: #eff6ff; border-left: 5px solid #3b82f6; }
.success { background: #ecfdf5; border-left: 5px solid #22c55e; }
.danger  { background: #fee2e2; border-left: 5px solid #ef4444; }

/* ======================================================
   PANEL EQUIPO
====================================================== */
.equipo-panel {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    margin-top: 20px;
    overflow: hidden;
}

.equipo-panel-header {
    background: linear-gradient(90deg, #1e3a8a, #2563eb);
    color: white;
    font-weight: bold;
    padding: 12px 18px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 1px;
}

.equipo-panel-body {
    padding: 18px;
}

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.kpi-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    border-left: 5px solid #2563eb;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.kpi-title {
    font-size: 13px;
    color: #555;
}

.kpi-value {
    font-size: 26px;
    font-weight: bold;
    color: #1e40af;
}

/* ======================================================
   CHARTS
====================================================== */
.efficiency-chart-container,
.efficiency-chart-container2 {
    margin-top: 20px;
    background: #ffffff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    width: 100%;
    height: 510px;
}

.efficiency-chart-container canvas,
.efficiency-chart-container2 canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ======================================================
   LOGIN
====================================================== */
.login-body {
    height: 100vh;
    background: linear-gradient(270deg, #1e3a8a, #172644, #0f172a, #312e81);
    background-size: 800% 800%;
    animation: gradientMove 20s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}

@keyframes gradientMove {
    0% {background-position:0% 50%;}
    50% {background-position:100% 50%;}
    100% {background-position:0% 50%;}
}

.login-container {
    background: #fff;
    width: 100%;
    max-width: 420px;
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    position: relative;
    padding-top: 70px;
    z-index: 2;
}
.login-logo {
position: absolute;
top: -70px;
left: 50%;
transform: translateX(-50%);
background: white;
border-radius: 50%;
padding: 12px;
box-shadow: 0 8px 25px rgba(0,0,0,0.25);
width: 120px;
height: 120px;
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-6px); }
}

.login-logo img {
    max-width: 85%;
    max-width: 85%;
    object-fit: contain;
} 

.login-container h1 {
text-align: center;
color: #0a0c0f;
font-size: 26px;
margin-bottom: 5px;
}

.subtitle {
text-align: center;
color: #64748b;
margin-bottom: 30px;
}

label {
font-size: 14px;
font-weight: 600;
color: #090d13;
display: block;
margin-bottom: 6px;
}

.input-group {
display: flex;
align-items: center;
border: 1px solid #e5e7eb;
border-radius: 10px;
padding: 12px;
margin-bottom: 18px;
}

.input-group input {
border: none;
outline: none;
width: 100%;
font-size: 14px;
padding-left: 8px;
}

.icon {
font-size: 16px;
opacity: 0.6;
}

.toggle {
cursor: pointer;
opacity: 0.5;
}

.options {
margin-bottom: 20px;
font-size: 13px;
}

button {
width: 100%;
padding: 14px;
background: #1f2933;
color: #fff;
border: none;
border-radius: 12px;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: background 0.3s;
}

button:hover {
background: #111827;
}

.error-msg {
margin-top: 15px;
background: #fdecea;
color: #b91c1c;
padding: 10px;
border-radius: 8px;
font-size: 13px;
text-align: center;
}

footer {
margin-top: 25px;
text-align: center;
font-size: 12px;
color: #94a3b8;
}

.error-msg {
margin-top: 15px;
padding: 12px 15px;
background: rgba(255,255,255,0.9);
color: #030101;
border-left: 4px solid #d32f2f;
border-radius: 7px;
font-size: 14px;
font-weight: 600;
display: flex;
align-items: center;
gap: 8px;
animation: fadeIn 0.4s ease-in-out;
}

.btn-login {
width: 100%;
max-width: 260px;
margin: 20px auto 10px auto;
display: block;
padding: 14px;
background: linear-gradient(135deg, #2563eb, #1e3a8a);
color: #fff;
border: none;
border-radius: 12px;
font-size: 15px;
font-weight: 600;
cursor: pointer;
box-shadow: 0 10px 20px rgba(37,99,235,0.35);
transition: all 0.3s ease;
}

.btn-login:hover {
background: linear-gradient(135deg, #1e3a8a, #2563eb);
box-shadow: 0 12px 25px rgba(37,99,235,0.45);
transform: translateY(-2px);
}
.bg-waves {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.bg-waves span {
    position: absolute;
    width: 150%;
    height: 160%;
    background: rgba(255,255,255,0.04);
    border-radius: 60%;
    animation: waveMove 20s infinite linear;
}

.bg-waves span:nth-child(1) {
    left: -50%;
    top: -60%;
    animation-duration: 28s;
}

.bg-waves span:nth-child(2) {
    left: -60%;
    top: -55%;
    animation-duration: 35s;
    background: rgba(255,255,255,0.03);
}

.bg-waves span:nth-child(3) {
    left: -55%;
    top: -65%;
    animation-duration: 45s;
    background: rgba(255,255,255,0.02);
}

@keyframes waveMove {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.equipo-panel,
.user-card,
.user-list-card {
width: 100%;
overflow-x: auto;
}

/* Tablas */
.user-table {
font-size: 14px;
}

.user-table td,
.user-table th {
padding: 6px;
}

/* Formularios */
.user-form input,
.user-form select {
width: 100%;
}

/* Botones */
.btn-save,
.btn-reset,
.btn-delete {
display: block;
width: 100%;
margin-bottom: 6px;
}


/* ======================================================
   ADMIN USUARIOS
====================================================== */
.user-admin-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    margin-top: 20px;
}

.user-card, .user-list-card {
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.user-card-header .icon {
    font-size: 28px;
}

.user-card-header h2 {
    margin: 0;
}

.user-card-header p {
    margin: 0;
    color: #777;
    font-size: 14px;
}

/* FORM */
.user-form .form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.user-form label {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.user-form input,
.user-form select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 14px;
    outline: none;
}

.user-form input:focus,
.user-form select:focus {
    border-color: #4f46e5;
}

.btn-create {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
}

/* MENSAJES */
.form-msg {
    background: #eef2ff;
    color: #1e3a8a;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.user-card, .user-list-card {
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
}

/* TABLA */
.user-list-card h3 {
    margin-bottom: 14px;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
}

.user-table th {
    text-align: left;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.user-table td {
    padding: 10px 6px;
    border-bottom: 1px solid #f1f1f1;
}

.user-table input,
.user-table select {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* BOTONES ACCIONES */
.user-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-save {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}

/* BOTÓN RESET */
.btn-reset {
    background: #f59e0b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    background: #d97706;
}

/* BOTÓN ELIMINAR */
.btn-delete {
    background: #dc2626;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #b91c1c;
}

.action-link {
    font-size: 13px;
    text-decoration: none;
}

.action-reset {
    color: #2563eb;
}

.action-delete {
    color: #dc2626;
}
/* ======================================================
   MOBILE RESPONSIVE
====================================================== */
.mobile-topbar {
    display: none;
}

@media (max-width: 768px) {

    body { overflow-x: hidden; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 20px 40px rgba(0,0,0,0.25);
        border-radius: 0 20px 20px 0;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .overlay {
        backdrop-filter: blur(4px);
        background: rgba(0,0,0,0.35);
        transition: opacity 0.3s ease;
    }

    .main {
        margin-left: 0;
        padding: 18px;
        margin-top: 80px;
    }

    .header { display: none; }

    .mobile-topbar {
        display: flex;
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        height: 54px;
        background: linear-gradient(135deg, #2563eb, #1e3a8a);
        color: white;
        z-index: 3000;
        align-items: center;
        justify-content: space-between;
        padding: 0 12px;
        border-radius: 16px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    }
    .mobile-topbar select {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    }

    .mobile-topbar select option {
        color: black;
    }


    .mobile-menu-btn {
    background: rgba(255,255,255,0.15);
    position: relative;
    z-index: 2001;   /* MÁS alto que el overlay */
    cursor: pointer;
    border: none;
    color: white;
    font-size: 20px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    }

    .mobile-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    }

    .mobile-logout {
        background: rgba(255,255,255,0.18);
        color: white;
        text-decoration: none;
        font-size: 18px;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0,0,0,0.25);
        transition: all 0.2s ease;
    }

    .mobile-logout:hover {
        background: rgba(255,255,255,0.3);
        transform: translateY(-1px);
    }

    .kpis {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .equipo-panel,
    .kpi,
    .user-card,
    .user-list-card {
        box-shadow: 0 12px 30px rgba(0,0,0,0.08);
        border-radius: 18px;
    }

    .kpi-card {
        box-shadow: 0 6px 20px rgba(0,0,0,0.06);
        border-radius: 16px;
    }
}
/* =========================
   AJUSTE SOLO PARA MÓVIL HOME
========================= */
@media (max-width: 768px) {

    .filter_home {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .equipo-panel {
        width: 100%;
    }

    .kpi-strip {
        grid-template-columns: 1fr;
    }

    .efficiency-chart-container,
    .efficiency-chart-container2 {
        height: 320px; /* más compacto en móvil */
    }

    .kpis {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .main {
        padding: 18px;
    }

    .kpis {
        gap: 16px;
        margin-bottom: 25px;
    }

    .equipo-panel {
        margin-top: 25px;
    }

    .equipo-panel-header {
        font-size: 15px;
        padding: 14px;
        letter-spacing: 0.5px;
    }
}