/* ============================================================
   VARIABLES GENERALES
   IDENTIDAD SUPERGAS
   ============================================================ */

:root {
    --azul-supergas: #075fa5;
    --azul-supergas-oscuro: #054b82;
    --azul-supergas-claro: #eaf4fb;

    --naranja-supergas: #ff6600;
    --naranja-supergas-oscuro: #e85b00;
    --naranja-supergas-claro: #fff2e8;

    --verde-supergas: #2f8f46;
    --verde-supergas-claro: #edf7ef;

    --blanco: #ffffff;

    --gris-fondo: #f4f7fa;
    --gris-claro: #eef2f6;
    --gris-borde: #dfe6ec;

    --texto-principal: #1f2937;
    --texto-secundario: #6b7280;

    --sidebar-ancho: 270px;
    --navbar-alto: 72px;

    --radio-sm: 8px;
    --radio-md: 12px;
    --radio-lg: 18px;

    --sombra-suave:
        0 6px 20px rgba(15, 23, 42, 0.06);

    --sombra-media:
        0 10px 30px rgba(15, 23, 42, 0.10);
}


/* ============================================================
   RESET
   ============================================================ */

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


html,
body {
    min-height: 100%;
}


body {
    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background-color: var(--gris-fondo);
    color: var(--texto-principal);
}


/* ============================================================
   ESTRUCTURA GENERAL
   ============================================================ */

.app-layout {
    display: flex;

    min-height: 100vh;

    background-color: var(--gris-fondo);
}


.app-content {
    flex: 1;

    min-width: 0;

    margin-left: var(--sidebar-ancho);
}


.main-content {
    width: 100%;

    max-width: 1600px;

    margin: 0 auto;

    padding: 30px;
}


/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    position: fixed;

    top: 0;
    left: 0;

    width: var(--sidebar-ancho);
    height: 100vh;

    overflow-y: auto;

    background:
        linear-gradient(
            180deg,
            var(--azul-supergas) 0%,
            var(--azul-supergas-oscuro) 100%
        );

    box-shadow:
        4px 0 18px rgba(0, 0, 0, 0.08);

    z-index: 1000;
}


.sidebar-contenido {
    display: flex;
    flex-direction: column;

    min-height: 100%;
}


/* ============================================================
   MARCA
   ============================================================ */

.sidebar-marca {
    display: flex;
    align-items: center;

    gap: 12px;

    min-height: var(--navbar-alto);

    padding:
        14px
        20px;

    border-bottom:
        1px solid
        rgba(255, 255, 255, 0.18);
}


.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    flex-shrink: 0;

    border-radius: 12px;

    background-color: var(--blanco);

    color: var(--azul-supergas);

    font-size: 15px;
    font-weight: 800;

    box-shadow:
        0 4px 12px
        rgba(0, 0, 0, 0.12);
}


.sidebar-titulo {
    display: flex;
    flex-direction: column;

    min-width: 0;

    line-height: 1.05;
}


.sidebar-titulo-principal {
    color: var(--blanco);

    font-size: 17px;
    font-weight: 800;

    letter-spacing: 0.5px;
}


.sidebar-titulo-secundario {
    margin-top: 5px;

    color:
        rgba(255, 255, 255, 0.70);

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 1.4px;
}


/* ============================================================
   MENÚ LATERAL
   ============================================================ */

.sidebar-menu {
    padding:
        18px
        12px
        28px;
}


.sidebar-seccion {
    margin:
        24px
        12px
        8px;

    color:
        rgba(255, 255, 255, 0.50);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 1.4px;
}


.sidebar-item {
    display: flex;
    align-items: center;

    gap: 12px;

    min-height: 46px;

    margin-bottom: 5px;

    padding:
        10px
        12px;

    border-radius: 10px;

    color:
        rgba(255, 255, 255, 0.88);

    text-decoration: none;

    font-size: 14px;
    font-weight: 500;

    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}


.sidebar-item:hover {
    background-color:
        rgba(255, 255, 255, 0.12);

    color: var(--blanco);

    transform: translateX(2px);
}


.sidebar-item.activo {
    background-color: var(--blanco);

    color: var(--azul-supergas);

    font-weight: 700;

    box-shadow:
        0 5px 15px
        rgba(0, 0, 0, 0.10);
}


.sidebar-icono {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 26px;
    height: 26px;

    flex-shrink: 0;

    font-size: 17px;
}


/* ============================================================
   DETALLE NARANJA LATERAL
   ============================================================ */

.sidebar::after {
    content: "";

    position: absolute;

    top: 0;
    right: 0;

    width: 4px;
    height: 100%;

    background-color:
        var(--naranja-supergas);
}


/* ============================================================
   NAVBAR
   ============================================================ */

.navbar {
    position: sticky;

    top: 0;

    min-height: var(--navbar-alto);

    background-color:
        rgba(255, 255, 255, 0.98);

    border-bottom:
        1px solid
        var(--gris-borde);

    box-shadow:
        0 2px 10px
        rgba(15, 23, 42, 0.04);

    z-index: 900;
}


.navbar-contenido {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: var(--navbar-alto);

    padding:
        0
        30px;
}


.navbar-izquierda {
    display: flex;
    align-items: center;

    gap: 14px;

    min-width: 0;
}


.navbar-titulo {
    overflow: hidden;

    color: var(--azul-supergas-oscuro);

    font-size: 17px;
    font-weight: 700;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.boton-menu {
    display: none;

    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border:
        1px solid
        var(--gris-borde);

    border-radius: 10px;

    background-color: var(--blanco);

    color: var(--azul-supergas);

    cursor: pointer;

    font-size: 20px;
}


/* ============================================================
   USUARIO
   ============================================================ */

.navbar-derecha {
    display: flex;
    align-items: center;
}


.usuario-info {
    display: flex;
    align-items: center;

    gap: 12px;
}


.usuario-datos {
    display: flex;
    flex-direction: column;

    text-align: right;
}


.usuario-nombre {
    color: var(--texto-principal);

    font-size: 13px;
    font-weight: 700;
}


.usuario-rol {
    margin-top: 3px;

    color: var(--azul-supergas);

    font-size: 10px;
    font-weight: 700;

    text-transform: uppercase;
}


.usuario-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border-radius: 50%;

    background-color:
        var(--azul-supergas-claro);

    color:
        var(--azul-supergas);

    border:
        2px solid
        var(--blanco);

    box-shadow:
        0 0 0 1px
        var(--gris-borde);

    font-size: 15px;
    font-weight: 800;
}


/* ============================================================
   ENCABEZADO DE PÁGINA
   ============================================================ */

.pagina-encabezado {
    position: relative;

    margin-bottom: 26px;

    padding-left: 16px;
}


.pagina-encabezado::before {
    content: "";

    position: absolute;

    top: 2px;
    bottom: 2px;
    left: 0;

    width: 4px;

    border-radius: 10px;

    background-color:
        var(--naranja-supergas);
}


.pagina-titulo {
    margin-bottom: 6px;

    color:
        var(--azul-supergas-oscuro);

    font-size: 27px;
    font-weight: 800;
}


.pagina-descripcion {
    max-width: 800px;

    color:
        var(--texto-secundario);

    font-size: 14px;
    line-height: 1.5;
}


/* ============================================================
   TARJETAS
   ============================================================ */

.tarjeta {
    position: relative;

    padding: 22px;

    border:
        1px solid
        var(--gris-borde);

    border-radius:
        var(--radio-md);

    background-color:
        var(--blanco);

    box-shadow:
        var(--sombra-suave);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease;
}


.tarjeta:hover {
    transform:
        translateY(-2px);

    box-shadow:
        var(--sombra-media);

    border-color:
        #cbd8e3;
}


.tarjeta-titulo {
    margin-bottom: 7px;

    color:
        var(--azul-supergas-oscuro);

    font-size: 16px;
    font-weight: 700;
}


.tarjeta-descripcion {
    color:
        var(--texto-secundario);

    font-size: 13px;
    line-height: 1.45;
}


/* ============================================================
   BOTONES GENERALES
   ============================================================ */

.boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    min-height: 42px;

    padding:
        10px
        16px;

    border: 0;

    border-radius:
        var(--radio-sm);

    cursor: pointer;

    font-size: 13px;
    font-weight: 700;

    text-decoration: none;

    transition:
        transform 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease;
}


.boton:hover {
    transform:
        translateY(-1px);
}


.boton-principal {
    background-color:
        var(--naranja-supergas);

    color:
        var(--blanco);

    box-shadow:
        0 5px 15px
        rgba(255, 102, 0, 0.20);
}


.boton-principal:hover {
    background-color:
        var(--naranja-supergas-oscuro);
}


.boton-secundario {
    background-color:
        var(--azul-supergas);

    color:
        var(--blanco);
}


.boton-secundario:hover {
    background-color:
        var(--azul-supergas-oscuro);
}


/* ============================================================
   ESTADOS
   ============================================================ */

.estado {
    display: inline-flex;
    align-items: center;

    min-height: 26px;

    padding:
        4px
        10px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
}


.estado-ok {
    background-color:
        var(--verde-supergas-claro);

    color:
        var(--verde-supergas);
}


.estado-alerta {
    background-color:
        var(--naranja-supergas-claro);

    color:
        var(--naranja-supergas-oscuro);
}


.estado-info {
    background-color:
        var(--azul-supergas-claro);

    color:
        var(--azul-supergas);
}


/* ============================================================
   FONDOS AUXILIARES
   ============================================================ */

.fondo-azul-claro {
    background-color:
        var(--azul-supergas-claro);
}


.fondo-naranja-claro {
    background-color:
        var(--naranja-supergas-claro);
}


.fondo-verde-claro {
    background-color:
        var(--verde-supergas-claro);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {

    .sidebar {
        transform:
            translateX(-100%);

        transition:
            transform 0.25s ease;
    }


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


    .app-content {
        margin-left: 0;
    }


    .boton-menu {
        display: flex;
    }


    .navbar-contenido {
        padding:
            0
            18px;
    }


    .main-content {
        padding: 20px;
    }


    .navbar-titulo {
        font-size: 14px;
    }


    .usuario-datos {
        display: none;
    }
}


@media (max-width: 520px) {

    .sidebar {
        width: 85%;
        max-width: 300px;
    }


    .navbar-titulo {
        max-width: 175px;
    }


    .main-content {
        padding: 15px;
    }


    .pagina-titulo {
        font-size: 22px;
    }
}

/* ============================================================
   LOGO CORPORATIVO
   ============================================================ */

.sidebar-logo-img {
    width: 50px;
    height: 50px;

    object-fit: contain;

    padding: 4px;

    border-radius: 10px;

    background-color: var(--blanco);
}


/* ============================================================
   ICONOS SVG DEL MENÚ
   ============================================================ */

.sidebar-icono svg {
    width: 20px;
    height: 20px;

    fill: none;

    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ============================================================
   NAVBAR - IDENTIDAD SUPERGAS
   ============================================================ */

.navbar-identidad {
    display: flex;
    flex-direction: column;

    min-width: 0;
}


.navbar-subtitulo {
    margin-top: 3px;

    color: var(--texto-secundario);

    font-size: 11px;
    font-weight: 500;
}


.navbar-estado {
    display: inline-flex;
    align-items: center;

    min-height: 30px;

    margin-right: 18px;

    padding:
        5px
        12px;

    border-radius: 999px;

    background-color:
        var(--verde-supergas-claro);

    color:
        var(--verde-supergas);

    font-size: 11px;
    font-weight: 700;
}


.navbar-estado::before {
    content: "";

    width: 7px;
    height: 7px;

    margin-right: 7px;

    border-radius: 50%;

    background-color:
        var(--verde-supergas);
}


/* ============================================================
   DETALLE NARANJA NAVBAR
   ============================================================ */

.navbar {
    position: sticky;
}


.navbar::after {
    content: "";

    position: absolute;

    left: 0;
    bottom: -1px;

    width: 90px;
    height: 3px;

    background-color:
        var(--naranja-supergas);
}


/* ============================================================
   RESPONSIVE NAVBAR
   ============================================================ */

@media (max-width: 900px) {

    .navbar-estado {
        display: none;
    }


    .navbar-subtitulo {
        display: none;
    }
}

/* ============================================================
   AJUSTES NAVBAR - ACCIONES GLOBALES
   ============================================================ */

/* Se oculta el indicador "Sistema activo" porque no aporta una acción útil. */
.navbar-estado {
    display: none !important;
}

.navbar {
    display: flex;
    align-items: center;
}

.navbar-contenido-principal {
    flex: 1;
    min-width: 0;
}

.navbar-acciones-globales {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 18px;
}

.boton-actualizar-sistema {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
    background-color: var(--blanco);
    color: var(--azul-supergas);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.boton-actualizar-sistema:hover {
    background-color: var(--azul-supergas-claro);
    border-color: #bdd5e6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(7, 95, 165, 0.10);
}

.boton-actualizar-sistema:active {
    transform: translateY(0);
}

.boton-actualizar-icono {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.boton-actualizar-icono svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ============================================================
   SIDEBAR - PIE CON CERRAR SESIÓN
   ============================================================ */

.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-area-principal {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.sidebar-pie-sesion {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 12px;
    background:
        linear-gradient(
            180deg,
            rgba(5, 75, 130, 0.90) 0%,
            var(--azul-supergas-oscuro) 45%,
            var(--azul-supergas-oscuro) 100%
        );
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-boton-cerrar-sesion {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.sidebar-boton-cerrar-sesion:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateX(2px);
}

.sidebar-boton-cerrar-icono {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.sidebar-boton-cerrar-icono svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ============================================================
   CARGADOR GLOBAL SUPERPUESTO
   Mantiene visible el sistema detrás del cargador.
   ============================================================ */

.cargador-global {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.16s ease,
        visibility 0.16s ease;
}

.cargador-global.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cargador-global-fondo {
    position: absolute;
    inset: 0;
    background-color: rgba(244, 247, 250, 0.72);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.cargador-global-tarjeta {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    width: min(430px, 100%);
    padding: 20px 22px;
    border: 1px solid var(--gris-borde);
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.cargador-global-spinner {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 4px solid var(--azul-supergas-claro);
    border-top-color: var(--azul-supergas);
    border-right-color: var(--naranja-supergas);
    border-radius: 50%;
    animation: supergas-girar 0.8s linear infinite;
}

.cargador-global-textos {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 5px;
}

.cargador-global-textos strong {
    color: var(--azul-supergas-oscuro);
    font-size: 16px;
    line-height: 1.25;
}

.cargador-global-textos span {
    color: var(--texto-secundario);
    font-size: 12px;
    line-height: 1.45;
}

body.sistema-cargando {
    cursor: wait;
}

@keyframes supergas-girar {
    to {
        transform: rotate(360deg);
    }
}


/* ============================================================
   RESPONSIVE - ACCIONES Y CARGADOR
   ============================================================ */

@media (max-width: 900px) {
    .navbar-acciones-globales {
        margin-right: 12px;
    }

    .boton-actualizar-sistema span:last-child {
        display: none;
    }

    .boton-actualizar-sistema {
        width: 40px;
        padding: 0;
    }

    .cargador-global {
        padding: 18px;
    }
}

@media (max-width: 520px) {
    .cargador-global-tarjeta {
        align-items: flex-start;
        padding: 18px;
    }

    .cargador-global-spinner {
        width: 36px;
        height: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cargador-global,
    .boton-actualizar-sistema,
    .sidebar-boton-cerrar-sesion {
        transition: none;
    }

    .cargador-global-spinner {
        animation-duration: 1.5s;
    }
}
