/* =====================================================================
   ESTILOS GENERALES Y CONFIGURACIÓN DE PANTALLA
   ===================================================================== */
:root {
    --bg-sistema: #f4f6f9;
    --color-sidebar: #11101d;         /* Azul noche oscuro del login */
    --color-sidebar-hover: #1d1b31;   /* Tono interactivo del menú */
    --color-header-azul: #2b50aa;     /* El azul cobalto vibrante del login */
    --color-texto-sidebar: #ffffff;
    --color-primario: #2b50aa;         /* Azul para botones principales */
    --color-primario-hover: #1d3b80;
    --color-exito: #10b981;
    --color-peligro: #ef4444;
    --color-alerta: #f59e0b;
    --shadow-suave: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-sistema);
    min-height: 100vh;
    overflow-x: hidden;
}

/* =====================================================================
   BARRA SUPERIOR (TOPBAR)
   ===================================================================== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: var(--color-header-azul); /* Aplicamos el azul cobalto vivo */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    z-index: 100;
    transition: all 0.4s ease;
}

.toggle-menu {
    font-size: 26px;
    cursor: pointer;
    color: #ffffff; /* Blanco para resaltar sobre el fondo azul */
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}
.toggle-menu:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15); /* Fondo sutil semi-transparente */
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
}
.topbar-user i {
    font-size: 20px;
    color: #ffffff;
}

/* =====================================================================
   BARRA LATERAL (SIDEBAR) - DISEÑO CONTRACTIL
   ===================================================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 65px;
    height: calc(100% - 65px);
    width: 78px;
    background: var(--color-sidebar);
    padding: 8px 14px;
    z-index: 99;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.open {
    width: 260px;
}

.sidebar .logo-details {
    height: 50px;
    display: flex;
    align-items: center;
    position: relative;
    color: var(--color-texto-sidebar);
    border-bottom: 1px solid var(--color-sidebar); /* Removido el borde gris molesto */
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* Nuevo contenedor adaptativo para el logo real en imagen */
.sidebar .logo-details .logo-img-container {
    min-width: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar .logo-details .sidebar-logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    filter: drop-shadow(0px 2px 4px rgba(255,255,255,0.1));
}

.sidebar .logo-details .logo_name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 5px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    color: #ffffff;
}
.sidebar.open .logo-details .logo_name {
    opacity: 1;
    pointer-events: auto;
}

.sidebar .nav-list {
    margin-top: 10px;
    height: calc(100% - 80px);
    display: flex;
    flex-direction: column;
}
.sidebar li {
    position: relative;
    margin: 4px 0;
    list-style: none;
}
.sidebar li a {
    display: flex;
    height: 46px;
    width: 100%;
    border-radius: 8px;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s ease;
    background: var(--color-sidebar);
}
.sidebar li a:hover {
    background: var(--color-sidebar-hover);
}
.sidebar li a i {
    height: 46px;
    min-width: 50px;
    border-radius: 8px;
    line-height: 46px;
    text-align: center;
    font-size: 20px;
    color: #94a3b8;
    transition: color 0.2s;
}
.sidebar li a:hover i {
    color: #fff;
}
.sidebar li a .links_name {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sidebar.open li a .links_name {
    opacity: 1;
    pointer-events: auto;
}
.sidebar.open li a:hover .links_name {
    color: #fff;
}

.sidebar li .tooltip {
    position: absolute;
    top: 0;
    left: calc(100% + 15px);
    z-index: 3;
    background: var(--color-sidebar);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: var(--shadow-card);
}
.sidebar li:hover .tooltip {
    opacity: 1;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}
.sidebar.open li .tooltip {
    display: none;
}

.sidebar li.profile {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    padding: 0 14px;
    border-top: 1px solid #1e293b;
    padding-top: 10px;
}
.sidebar li.profile a i {
    color: var(--color-peligro);
}
/* =====================================================================
   CONTENIDO PRINCIPAL (ADAPTATIVO)
   ===================================================================== */
.main-content {
    position: relative;
    min-height: calc(100vh - 65px);
    top: 65px;
    left: 78px;
    width: calc(100% - 78px);
    padding: 30px 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.open ~ .main-content {
    left: 260px;
    width: calc(100% - 260px);
}

/* =====================================================================
   RESPONSIVE (COMPORTAMIENTO CELULARES Y TABLETS)
   ===================================================================== */
@media (max-width: 768px) {
    .sidebar {
        left: -78px;
    }
    
    .sidebar.open {
        left: 0;
        width: 250px;
    }
    
    .main-content {
        left: 0;
        width: 100%;
    }
    
    .sidebar.open ~ .main-content {
        left: 0;
        width: 100%;
    }
}

/* Clases auxiliares para paneles */
.container { width: 100%; max-width: 1200px; margin: 0 auto; }
.card { background: #fff; padding: 20px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.table th, .table td { padding: 12px; border-bottom: 1px solid #ddd; text-align: left; }

@media (max-width: 600px) { 
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; } 
    .table thead { display: none; } 
    .table tr { margin-bottom: 15px; border: 1px solid #ddd; padding: 8px; background: #fff; } 
    .table td { text-align: right; padding-left: 50%; position: relative; } 
}

/* =====================================================================
   ESTILOS ESPECÍFICOS PARA LA PANTALLA DE LOGIN
   ===================================================================== */
.login-body {
    background: linear-gradient(135deg, #11101d 0%, #2b50aa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    transition: transform 0.3s ease;
}

.login-card h2 {
    color: #11101d;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 25px;
    text-align: center;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: block;
    color: #444;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-card .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5ee;
    border-radius: 8px;
    font-size: 16px;
    color: #11101d;
    outline: none;
    transition: border-color 0.3s ease;
}

.login-card .form-group input:focus {
    border-color: var(--color-primario);
}

.btn-login {
    width: 100%;
    background-color: var(--color-primario);
    color: #ffffff;
    border: none;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.btn-login:hover {
    background-color: #1d3b80;
}

.alert-danger {
    background-color: #f8d7da;
    color: var(--color-peligro);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}

.login-logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* CORREGIDO: Sintaxis limpia para el !important */
.login-logo {
    width: 120px !important;
    height: 120px !important;
    max-width: 100% !important;
    object-fit: contain;
    filter: drop-shadow(0px 4px 6px rgba(0, 0, 0, 0.15)); 
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    .login-card h2 {
        font-size: 21px;
    }
}

/* =====================================================================
   COMPONENTES ESPECÍFICOS DEL DASHBOARD PRINCIPAL
   ===================================================================== */
.dashboard-header {
    margin-bottom: 25px;
}
.dashboard-header h2 {
    font-size: 26px;
    color: #0f172a;
    font-weight: 700;
}
.dashboard-header p {
    color: #64748b;
    font-size: 14px;
    margin-top: 4px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-suave);
    border: 1px solid #e2e8f0;
    border-left: 5px solid var(--color-primario);
    transition: transform 0.2s, box-shadow 0.2s;
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}
.metric-card.success { border-left-color: var(--color-exito); }
.metric-card.warning { border-left-color: var(--color-alerta); }
.metric-card.danger { border-left-color: var(--color-peligro); }

.metric-data h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 6px;
}
.metric-data .number {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

.metric-icon {
    font-size: 32px;
    color: #94a3b8;
    background: #f8fafc;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.metric-card:hover .metric-icon { background: #eff6ff; color: var(--color-primario); }
.metric-card.success:hover .metric-icon { background: #ecfdf5; color: var(--color-exito); }
.metric-card.warning:hover .metric-icon { background: #fffbeb; color: var(--color-alerta); }
.metric-card.danger:hover .metric-icon { background: #fef2f2; color: var(--color-peligro); }

/* =====================================================================
   ESTILOS GENERALES PARA ELEMENTOS DE FORMULARIOS ERPS
   ===================================================================== */
.btn-primary { background: var(--color-primario); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-primary:hover { background: #1d3b80; }
.btn-save { background: var(--color-exito); color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.btn-save:hover { background: #1e7e34; }
.input-table { width: 100%; padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
.form-inline { display: flex; gap: 15px; align-items: flex-end; flex-wrap: wrap; }
.badge { background: #e1e5ee; color: #333; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.btn-status { padding: 4px 10px; border-radius: 20px; text-decoration: none; font-size: 13px; font-weight: 600; display: inline-block; }
.btn-active { background: #d4edda; color: #155724; }
.btn-inactive { background: #f8d7da; color: #721c24; }