/* ==========================================================================
   1. RESET, VARIABLES Y CONFIGURACIÓN GLOBAL (EFECTO APP)
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body { 
    background: #f8fafc; 
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    min-height: 100vh;
    color: #1e293b;
    overflow-x: hidden;
}

/* Contenedor flexible nativo para separar Sidebar de Contenido */
.wrapper-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: 100vh;
}

/* ==========================================================================
   2. BARRA SUPERIOR (NAVBAR FIJA)
   ========================================================================== */
.top-navbar {
    height: 60px;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-toggle-menu {
    background: none;
    border: none;
    font-size: 24px;
    color: #1e293b;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.navbar-right {
    position: relative;
}

.user-dropdown-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.user-dropdown-btn:hover {
    background: #e2e8f0;
}

.dropdown-menu-content {
    display: none;
    position: absolute;
    right: 0;
    top: 45px;
    background: white;
    min-width: 180px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    z-index: 1001;
}

.dropdown-menu-content.active {
    display: block;
}

.dropdown-menu-content a {
    display: block;
    padding: 10px 15px;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.dropdown-menu-content a:hover {
    background: #f8fafc;
    color: #ef4444;
}

/* ==========================================================================
   3. MENÚ DE NAVEGACIÓN (SIDEBAR ESTABLE)
   ========================================================================== */
.sidebar {
    background: #1e293b !important; 
    color: #cbd5e1 !important; 
    display: flex; 
    flex-direction: column;
    padding: 20px 15px;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
}

/* --- ELEMENTOS DEL MENÚ Y NUEVOS COLORES --- */
.menu-link {
    color: #cbd5e1 !important; /* Gris claro de alta legibilidad */
    text-decoration: none; 
    padding: 10px 12px; 
    border-radius: 6px; 
    font-weight: 600; 
    font-size: 14px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    transition: 0.2s;
    cursor: pointer;
}

/* Forzar que mantengan el color y no hereden colores oscuros de links visitados */
.menu-link:visited,
.menu-link:link {
    color: #cbd5e1 !important;
}

.menu-link:hover { 
    background: #334155 !important; 
    color: #ffffff !important; /* Blanco brillante al pasar el mouse */
}

/* Estilo especial para los textos de los submenús */
.submenu-items .menu-link {
    color: #94a3b8 !important; /* Un gris un poco más sutil para jerarquía */
    font-size: 13px;
}

.submenu-items .menu-link:hover {
    color: #38bdf8 !important; /* Azul celeste al pasar el mouse en submenús */
}

.menu-category {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 700;
}

.role-text {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #334155;
}

/* Submenús en Móvil y comportamiento general */
.submenu-items {
    display: none; 
    background: #151e2e; 
    padding-left: 10px;
    border-left: 3px solid #f97316; /* Detalle naranja premium */
    margin-top: 4px;
    gap: 4px;
    border-radius: 0 4px 4px 0;
}

.submenu-wrapper.open .submenu-items {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   4. VISTAS CLÁSICAS DEL PANEL DE CONTROL
   ========================================================================== */
.main-panel {
    margin-left: 0; 
    padding: 20px;
    width: 100%;
    margin-top: 60px; /* Deja espacio para la navbar fija */
    transition: margin-left 0.3s ease, width 0.3s ease;
    box-sizing: border-box;
}

.container { 
    max-width: 1100px; 
    margin: 0 auto; 
    width: 100%;
}

.header-container { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 25px; 
    width: 100%;
}

.header h1 { font-size: 24px; color: #0f172a; }
.header p { color: #64748b; font-size: 14px; margin-top: 4px; }

.card { 
    background: white; 
    border: 1px solid #e2e8f0; 
    border-radius: 10px; 
    padding: 20px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.02); 
    margin-bottom: 20px;
}

/* Formulario Clásico en Grid (PC de 2 Columnas) */
.form-grid, .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.full-width, .form-group.full { grid-column: span 2; }

label { font-size: 12px; font-weight: 600; color: #475569; }
input, select, textarea { 
    padding: 10px; 
    border: 1px solid #cbd5e1; 
    border-radius: 6px; 
    font-size: 14px; 
    background: #fff; 
    width: 100%;
}

input:focus, select:focus, textarea:focus { 
    outline: none; 
    border-color: #0284c7; 
    box-shadow: 0 0 0 3px rgba(2,132,199,0.1); 
}

/* Botones del Sistema */
.btn-submit, .btn-inyectar-sistema { 
    background: #0284c7; 
    color: white; 
    border: none; 
    padding: 14px 25px; 
    border-radius: 6px; 
    font-weight: bold; 
    font-size: 14px; 
    cursor: pointer; 
    display: block; 
    width: 100%; 
    text-align: center; 
}
.btn-submit:hover { background: #0369a1; }
.btn-orange { background-color: #f97316 !important; color: white !important; }

/* ==========================================================================
   5. MODAL / RENDICIÓN DE GASTOS COMPACTA (MÓVIL)
   ========================================================================== */
.card-mobile-rendicion {
    max-width: 500px;
    margin: 0 auto 30px auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.banner-azul-header {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #ffffff;
    padding: 15px;
    position: relative;
}

.usuario-top { font-size: 0.85rem; opacity: 0.9; font-weight: 500; margin-bottom: 4px; }
.cuerpo-rendicion { padding: 20px; }
.cuerpo-rendicion .form-group { margin-bottom: 15px; }

.box-adjuntar {
    margin-bottom: 20px;
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px dashed #cbd5e1;
}

.tarjeta-trato-operativo {
    border: 1px solid #fef08a;
    background: #fffdf5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.tarjeta-trato-operativo h4 { margin: 0 0 12px 0; color: #854d0e; display: flex; align-items: center; gap: 6px; }

.fila-doble-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.input-firma-clave {
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #1e293b;
    border: 2px solid #cbd5e1;
    background-color: #f8fafc;
}

/* ==========================================================================
   6. AISLAMIENTO EXCLUSIVO: PANTALLA DE LOGIN
   ========================================================================== */
.login-body-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f4f7f6; /* Fondo gris claro limpio */
    width: 100vw;
    position: relative;
}

.login-body-wrapper .sidebar,
.login-body-wrapper .top-navbar {
    display: none !important;
}

.login-box { 
    background: white; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    width: 350px; 
    z-index: 10; 
}

.login-box h2 { 
    text-align: center; 
    color: #2c3e50; 
    margin-bottom: 20px; 
    font-size: 60px; 
}

.login-box input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.login-box button { 
    width: 100%;
    padding: 12px;
    background: #27ae60; 
    color: white; 
    border: none; 
    border-radius: 4px;
    font-weight: bold; 
    margin-top: 10px; 
    cursor: pointer; 
}

.login-box button:hover { 
    background: #1e8449; 
}

/* ==========================================================================
   7. AISLAMIENTO EXCLUSIVO: NUEVO COTIZADOR AZUL PROFESIONAL
   ========================================================================== */
.nuevo-cotizador-body { 
    --primary: #1e40af;       
    --primary-hover: #1d4ed8; 
    --dark: #0f172a;          
    --gray-bg: #f8fafc;       
    --border: #cbd5e1;        
}

.nuevo-cotizador-body .main-panel { 
    padding: 20px 30px 30px 30px !important; 
    max-width: 100% !important; 
    margin-top: 100px !important; 
    box-sizing: border-box;
}

.nuevo-cotizador-body .workspace-layout { 
    display: grid; 
    grid-template-columns: 1fr 380px; 
    gap: 25px; 
    align-items: start; 
}

.nuevo-cotizador-body .panel-title { 
    font-size: 1.25rem; 
    font-weight: 600; 
    color: var(--dark); 
    margin-bottom: 20px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    border-bottom: 2px solid #bfdbfe; 
    padding-bottom: 8px; 
}

.nuevo-cotizador-body .grid-form { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px; 
    margin-bottom: 20px; 
}

.nuevo-cotizador-body .dynamic-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 15px; 
}

.nuevo-cotizador-body .dynamic-table th { 
    background: #f1f5f9; 
    color: #334155; 
    text-align: left; 
    padding: 12px; 
    font-size: 0.85rem; 
    border-bottom: 2px solid #cbd5e1; 
}

.nuevo-cotizador-body .dynamic-table td { 
    padding: 10px 6px; 
    border-bottom: 1px solid var(--border); 
}

.nuevo-cotizador-body .sticky-summary { 
    position: sticky; 
    top: 120px; 
    background: var(--dark); 
    color: white; 
    border-radius: 8px; 
    padding: 20px; 
}

.nuevo-cotizador-body .summary-total { 
    font-size: 1.4rem; 
    font-weight: 700; 
    color: #38bdf8; 
    display: flex; 
    justify-content: space-between; 
}


/*7.2. AISLAMIENTO EXCLUSIVO: NUEVO INFORME TÉCNICO AZUL PROFESIONAL
   ========================================================================== */
.nuevo-informe-body { 
    --primary: #1e40af;       
    --primary-hover: #1d4ed8; 
    --dark: #0f172a;          
    --gray-bg: #f8fafc;       
    --border: #cbd5e1;        
}

.nuevo-informe-body .main-panel { 
    padding: 20px 30px 50px 30px !important; 
    max-width: 100% !important; 
    margin-top: 100px !important; 
    box-sizing: border-box;
}

.nuevo-informe-body .panel-title { 
    font-size: 1.25rem; 
    font-weight: 600; 
    color: var(--dark); 
    margin-bottom: 20px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    border-bottom: 2px solid #bfdbfe; 
    padding-bottom: 8px; 
}

/* Forzar que los elementos fluyan hacia abajo en orden y no se oculten */
.nuevo-informe-body form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nuevo-informe-body .form-control, 
.nuevo-informe-body .form-select {
    border-radius: 6px;
    border: 1px solid var(--border);
    padding: 10px;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
}

.nuevo-informe-body .form-control:focus, 
.nuevo-informe-body .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
    outline: none;
}

.nuevo-informe-body .btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    padding: 12px 25px;
    font-weight: 600;
    border-radius: 6px;
    transition: background-color 0.2s;
    display: inline-block;
    margin-top: 20px;
}

.nuevo-informe-body .btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}
/* Forzar que cualquier botón o sección final ocupe todo el ancho y baje correctamente */
.nuevo-informe-body .form-group-submit, 
.nuevo-informe-body button[type="submit"] {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    clear: both !important;
    margin-top: 30px !important;
    display: block !important;
}
/* ==========================================================================
   8. MEDIA QUERIES RESPONSIVAS UNIFICADAS (MENÚ HÍBRIDO: PC HORIZONTAL VS MÓVIL APP)
   ========================================================================== */

/* 🖥️ PANTALLAS GRANDES (PC / Desktop): Barra Horizontal Fija */
@media (min-width: 992px) {
    .sidebar {
        position: fixed !important;
        top: 60px !important; /* Justo debajo de la navbar superior */
        left: 0 !important;
        right: 0 !important;
        height: 50px !important; /* Altura compacta para navegar horizontalmente */
        width: 100vw !important;
        flex-direction: row !important; /* Elementos uno al lado del otro */
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 0 40px !important;
        gap: 20px !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
        overflow: visible !important; /* Permite que los submenús caigan hacia abajo */
        bottom: auto !important;
    }

    .role-text, .menu-category {
        display: none !important; /* Ocultamos etiquetas administrativas en PC para ganar espacio */
    }

    .menu-link {
        color: #cbd5e1 !important;
        padding: 8px 16px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
    }

    /* Submenús flotantes en PC (Dropdown clásico que cae al pasar el mouse) */
    .submenu-wrapper {
        position: relative !important;
    }

    .submenu-items {
        display: none !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        background: #1e293b !important;
        min-width: 200px !important;
        border-radius: 0 0 6px 6px !important;
        box-shadow: 0 8px 16px rgba(0,0,0,0.15) !important;
        padding: 5px 0 !important;
        border-left: none !important;
        flex-direction: column !important;
    }

    .submenu-wrapper:hover .submenu-items {
        display: flex !important;
    }

    .main-panel {
        margin-left: 0 !important;
        margin-top: 110px !important; /* Baja el contenido para no taparlo con la barra horizontal */
        width: 100% !important;
    }

    .btn-toggle-menu {
        display: none !important; /* No se necesita botón de menú en PC */
    }
}

/* 📱 PANTALLAS MEDIANAS Y CHICAS (Tablets y Celulares): Tu App Lateral de 700px */
@media (max-width: 991px) {
    .sidebar {
        position: fixed !important;
        width: 700px !important;    /* Tu medida ideal de 700px */
        left: -700px !important;    /* Se oculta exactamente a esa misma distancia */
        top: 60px !important;
        bottom: 0 !important;
        height: calc(100vh - 60px) !important;
        flex-direction: column !important; /* En celular van en lista hacia abajo */
        overflow-y: auto !important;
    }
    
    .sidebar.active {
        left: 0 !important;         /* Desliza limpio al frente */
    }

    /* --- TUS AJUSTES DE TAMAÑO PERSONALIZADOS PARA EL CELULAR --- */
    
    /* Categorías en mayúscula (OPERACIONES, etc.) */
    .menu-category {
        font-size: 15px !important;
        margin-top: 25px !important;
        margin-bottom: 10px !important;
        padding-left: 16px !important;
        letter-spacing: 1px !important;
        display: block !important;
    }

    /* Enlaces Principales */
    .menu-link {
        font-size: 22px !important;       /* Texto cómodo y legible */
        padding: 22px 16px !important;    /* Botones gruesos para el dedo */
    }

    /* Iconos de los Enlaces Principales */
    .menu-link i, 
    .menu-link span:first-child { 
        font-size: 26px !important;       /* Iconos levemente más grandes que el texto */
    }

    /* Enlaces de Submenús (dentro del acordeón) */
    .submenu-items .menu-link {
        font-size: 19px !important;       /* Un poco más pequeño para dar jerarquía */
        padding: 16px 14px !important;
    }

    /* Iconos de Submenús */
    .submenu-items .menu-link span:first-child {
        font-size: 22px !important;       
    }

    .main-panel,
    .nuevo-cotizador-body .main-panel {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 12px !important;
        margin-top: 75px !important; 
    }

    .form-grid, .form-row, .nuevo-cotizador-body .grid-form, .nuevo-cotizador-body .workspace-layout {
        grid-template-columns: 1fr !important; 
    }

    .full-width, .form-group.full, .nuevo-cotizador-body .form-group.full-width {
        grid-column: span 1 !important;
    }

    input, select, textarea {
        font-size: 16px !important; 
    }

    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}