/* =====================================================
   VARIABLES DINÁMICAS
===================================================== */
:root {
    --primary-color: <?php echo settings_get('global_primary_color', '#0d6efd'); ?>;
    --primary-rgb: <?php 
        $hex = settings_get('global_primary_color', '#0d6efd');
        list($r,$g,$b) = sscanf($hex, "#%02x%02x%02x");
        echo "$r,$g,$b";
    ?>;

    /* Sidebar exclusivo */
    --sidebar-bg: #46a696;
    --sidebar-text: #000000;
    --sidebar-hover: rgba(255,255,255,0.15);
}



/* =====================================================
   SIDEBAR BASE
===================================================== */
.app-sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,0.10);
    padding: 1.5rem 1rem;
    position: fixed;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1040;
    color: var(--sidebar-text);
}

.sidebar-link,
.sidebar-link:visited {
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-radius: 6px;
}

/* =====================================================
   ICONOS
===================================================== */
.menu-title::before {
    content: "";
    width: 18px;
    height: 18px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    margin-right: 8px;
}

/* ICONOS POR SECCIÓN */
.menu-title[data-icon="general"]::before {
    background-image: url('../icons/general.png');
}

.menu-title[data-icon="flota-y-seguridad"]::before {
    background-image: url('../icons/flota.png');
}

.menu-title[data-icon="operacion"]::before {
    background-image: url('../icons/operacion.png');
}

.menu-title[data-icon="administracion"]::before {
    background-image: url('../icons/admin.png');
}

.menu-title[data-icon="bi-y-analitica"]::before {
    background-image: url('../icons/bi.png');
}

.menu-title[data-icon="afiliados"]::before {
    background-image: url('../icons/afiliados.png');
}

.menu-title[data-icon="enturnamiento"]::before {
    background-image: url('../icons/turno.png');
}

.menu-title[data-icon="mantenimiento"]::before {
    background-image: url('../icons/mantenimiento.png');
}

.menu-title[data-icon="soporte"]::before {
    background-image: url('../icons/soporte.png');
}

.menu-title[data-icon="manual"]::before {
    background-image: url('../icons/ayuda.png');
}


/* Icono para TODOS los submenús */
.submenu .sidebar-link {
    position: relative;
    padding-left: 28px !important; /* espacio para el icono */
}

.submenu .sidebar-link::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-image: url('/public/icons/submenu.png');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.9;
}




/* =====================================================
   ACORDEÓN FUNCIONAL
===================================================== */

.menu-group {
    margin-bottom: 0.5rem;
}

.menu-title {
    background: rgba(255,255,255,0.12);
    color: var(--sidebar-text);
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.menu-title .arrow {
    margin-left: auto;
    transition: transform .25s ease;
}

/* Submenú cerrado */
.menu-group .submenu {
    display: none;
}

/* Submenú abierto */
.menu-group.open .submenu {
    display: flex;
    flex-direction: column;
    margin-top: 6px;
}

.menu-group.open .arrow {
    transform: rotate(90deg);
}

/* Items del submenú */
.submenu .sidebar-link {
    padding: 0.45rem 1rem 0.45rem 1.8rem;
    border-radius: 6px;
}

.submenu .sidebar-link:hover,
.submenu .sidebar-link.active {
    background: rgba(var(--primary-rgb), 0.25);
}

/* =====================================================
   CONTENIDO GENERAL
===================================================== */

body {
    background-color: #f1f1f1;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-content {
    margin-left: 250px;
    padding: 2rem;
    flex: 1;
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .3s ease;
    }
    .app-sidebar.active {
        transform: translateX(0);
    }
    .app-content {
        margin-left: 0;
    }
}
@media (max-width: 768px) {
    ...
}

/* ===================================================== */
/* FIX PARA QUE NO QUEDE BLANCO AL HACER CLICK          */
/* ===================================================== */

.submenu .sidebar-link,
.submenu .sidebar-link:visited {
    color: #000 !important;
}

.submenu .sidebar-link.active {
    background: rgba(var(--primary-rgb), 0.35) !important;
    color: #000 !important;
}

.submenu .sidebar-link:hover {
    background: rgba(var(--primary-rgb), 0.20) !important;
    color: #000 !important;
}
/* ===============================
   FIX: Sidebar móvil visible y funcional
=============================== */
@media (max-width: 768px) {

    /* Sidebar fuera de pantalla por defecto */
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .3s ease-in-out;
        z-index: 2000 !important; /* encima del header */
    }

    /* Activo */
    .app-sidebar.active {
        transform: translateX(0);
    }

    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,.35);
        z-index: 1990;
    }

    .sidebar-overlay.active {
        display: block;
    }
}


/* =====================================================
   BLOQUES PROHIBIDOS Y ELIMINADOS
===================================================== */

/* ❌ NO AGREGAR JAMÁS:
.menu-title,
.sidebar-link,
.submenu { opacity:1 !important; visibility:visible !important; background:transparent !important; }
*/

/* ======================
   LOGIN – PANTALLA DIVIDIDA
========================= */
/* ==========================================
   FONDO GENERAL – CORPORATIVO PREMIUM
========================================== */

body.auth-body {
    background: #eef0f4 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh !important;
    padding: 40px 20px;
    font-family: 'Inter', sans-serif;
}

/* ==========================================
   WRAPPER PRINCIPAL (tarjeta principal)
========================================== */

.auth-wrapper {
    width: 100%;
    max-width: 1150px;                     /* Tamaño corporativo premium */
    background: #ffffff;
    border-radius: 28px;
    overflow: hidden;
    display: flex;
    padding: 0 !important;

    /* SOMBRA CORPORATIVA PREMIUM */
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.10),
        0 4px 12px rgba(0, 0, 0, 0.05);

    margin: auto;
    height: auto !important;
}

/* ==========================================
   FILA FLEXIBLE – IGUAL ALTURA
========================================== */

.auth-wrapper .row {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: stretch !important;
    height: auto !important;
}

/* ==========================================
   FORMULARIO – COLUMNA IZQUIERDA PREMIUM
========================================== */

.auth-wrapper .col-lg-5 {
    max-width: 45% !important;
    flex: 0 0 45% !important;
    padding: 55px 60px !important;
    display: flex !important;
    justify-content: center;
    align-items: center !important;
    background: #ffffff;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: transparent !important;
    padding: 0 !important;
    margin: auto 0;
}

/* --- TITULOS ELEGANTES --- */
.auth-card h1,
.auth-card h4 {
    font-weight: 700;
    color: #2c2f36;
}

/* Inputs premium */
.auth-card input.form-control {
    height: 48px;
    border-radius: 10px;
    border: 1px solid #d9dce3;
    background: #f7f9fc !important;
    font-size: 15px;
    transition: 0.2s ease;
}

.auth-card input.form-control:focus {
    border-color: #0f7c66 !important;
    box-shadow: 0 0 0 3px rgba(0, 128, 102, 0.15) !important;
}

/* Enlace */
.auth-card a {
    color: #0f7c66 !important;
    font-weight: 500;
}

/* Botón premium */
.auth-card button.btn-primary {
    height: 50px;
    border-radius: 12px;
    background: #0f7c66 !important;
    border: none !important;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: 0.3px;
    transition: 0.2s;
}

.auth-card button.btn-primary:hover {
    background: #0d6b57 !important;
    transform: translateY(-1px);
}

/* ==========================================
   IMAGEN – COLUMNA DERECHA PREMIUM
========================================== */

.auth-wrapper .col-md-6 {
    max-width: 55% !important;
    flex: 0 0 55% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: stretch !important;       /* IGUAL ALTURA */
    height: 100% !important;              /* FIX */
}

/* Contenedor imagen */
.login-image-card {
    width: 100%;
    height: 100% !important;               /* FIX */
    min-height: 100% !important;           /* FIX */
    display: flex;
    overflow: hidden;
    border-left: 1px solid #ececee;        /* Corporate divider */
}

/* Imagen */
.login-side-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center top !important; /* ⭐ FIX: IMAGEN PEGADA ARRIBA */
    display: block;
    transition: 0.3s ease;
}

/* Hover premium */
.login-side-image:hover {
    transform: scale(1.012);
}

/* ==========================================
   RESPONSIVE — MÓVIL PREMIUM
========================================== */

@media (max-width: 992px) {

    .auth-wrapper {
        border-radius: 0;
        max-width: 100%;
        height: auto !important;
    }

    .auth-wrapper .col-md-6 {
        display: none !important;
    }

    .auth-wrapper .col-lg-5 {
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 40px 30px !important;
        background: #ffffff !important;
    }

    .auth-card {
        max-width: 380px;
        margin: 0 auto !important;
    }
}
