/* =========================================
   IMPORTAR FUENTE
========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');


/* =========================================
   VARIABLES GLOBALES
========================================= */

:root {

   /* ==============================
       COLORES
    ============================== */

   --color-primario: #004aad;

   --color-secundario: #64748b;

   --color-fondo: #f8fafc;

   --color-texto: #0f172a;

   --color-blanco: #ffffff;

   --color-borde: #e2e8f0;


   /* ==============================
       FUENTE
    ============================== */

   --fuente-principal: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;


   /* ==============================
       TAMAÑOS
    ============================== */

   --titulo-principal: 28px;

   --texto-normal: 14px;

   --radius-general: 12px;
}


html, body {
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {

   font-family: var(--fuente-principal);

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

   color: var(--color-texto);
}


/* ==========================================
   FLASH FLOAT
========================================== */

.flash-container {

   position: fixed;

   top: 20px;

   right: 20px;

   z-index: 9999;

   display: flex;

   flex-direction: column;

   gap: 10px;
}

/* ==========================================
   MENSAJE
========================================== */

.flash-message {

   min-width: 280px;

   padding: 14px 18px;

   border-radius: 10px;

   color: white;

   font-weight: 500;

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

   animation:
      fadeIn 0.3s ease,
      fadeOut 0.5s ease 4s forwards;

   opacity: 1;
}

/* ==========================================
   SUCCESS
========================================== */

.flash-success {

   background: #198754;
}

/* ==========================================
   DANGER
========================================== */

.flash-danger {

   background: #dc3545;
}

/* ==========================================
   WARNING
========================================== */

.flash-warning {

   background: #ffc107;

   color: #212529;
}

/* ==========================================
   ANIMACIONES
========================================== */

@keyframes fadeIn {

   from {

      opacity: 0;

      transform: translateY(-10px);
   }

   to {

      opacity: 1;

      transform: translateY(0);
   }
}

@keyframes fadeOut {

   to {

      opacity: 0;

      transform: translateX(30px);

      visibility: hidden;
   }
}

/* ==========================================
       SELECT2 ESTILO ERP
    ========================================== */

.select2-container {

   width: 100% !important;

}

.select2-container--default .select2-selection--single {

   height: 38px;

   border: 1px solid #ced4da;

   border-radius: 0.375rem;

   padding: 4px 12px;

   display: flex;

   align-items: center;

   background-color: #fff;

}

.select2-container--default .select2-selection--single .select2-selection__rendered {

   line-height: 28px;

   padding-left: 0;

   color: #212529;

}

.select2-container--default .select2-selection--single .select2-selection__arrow {

   height: 36px;

   right: 10px;

}

.select2-dropdown {

   border-radius: 0.5rem;

   border: 1px solid #ced4da;

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

}

.select2-search__field {

   border-radius: 0.375rem !important;

   padding: 8px !important;

}

.select2-results__option--highlighted {

   background-color: #0d6efd !important;

}


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

/* ==========================================================================
   LAYOUT: SIDEBAR APEX DARK
   ========================================================================== */

/* BOTÓN HAMBURGUESA FLOTANTE */
.hamburger-trigger-btn {
    display: none !important;
}

#app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
    background-color: var(--color-bg-app);
}

#sidebar {
    width: 64px;
    height: 100vh;
    background: linear-gradient(180deg, #0c0d12 0%, #08090d 100%);
    color: var(--color-text-main);
    display: flex;
    flex-direction: column;
    z-index: 1080;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateX(0); /* SIEMPRE VISIBLE COMO CARRIL DE ÍCONOS */
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
    overflow: hidden;
    white-space: nowrap;
}

/* AL PASAR EL MOUSE POR EL SIDEBAR O AL ABRIRLO SE EXPANDE A ANCHO COMPLETO */
#sidebar:hover,
#sidebar.is-open {
    width: 265px;
    box-shadow: 16px 0 45px rgba(0, 0, 0, 0.75);
}

.sidebar__header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.01);
}

.sidebar__logo-badge {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, #00e676 0%, #00c853 100%);
    color: #090a0f;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 0 18px rgba(0, 230, 118, 0.35);
    flex-shrink: 0;
}

.sidebar__toggle-btn {
    background: transparent;
    border: none;
    color: #71717a;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

#sidebar:hover .sidebar__toggle-btn,
#sidebar.is-open .sidebar__toggle-btn {
    opacity: 1;
    visibility: visible;
}

.sidebar__toggle-btn:hover {
    color: var(--color-primary);
    transform: scale(1.1);
}

.sidebar__nav {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 10px;
}

/* Custom Scrollbar para sidebar */
.sidebar__nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar__nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar__nav::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 4px;
    transition: background-color 0.25s ease;
}
.sidebar__nav:hover::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.18);
}

.sidebar__menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 11px;
    color: #a1a1aa;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__icon {
    font-size: 1.25rem;
    min-width: 22px;
    text-align: center;
    color: #a1a1aa;
    flex-shrink: 0;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar__text {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    white-space: nowrap;
}

#sidebar:hover .sidebar__text,
#sidebar.is-open .sidebar__text {
    opacity: 1;
    visibility: visible;
}

.sidebar__link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar__link:hover .sidebar__icon {
    color: var(--color-primary);
    transform: scale(1.15);
}

.sidebar__link--active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

.sidebar__link--active .sidebar__icon {
    color: #00e676 !important;
    transform: scale(1.15) !important;
    filter: drop-shadow(0 0 6px rgba(0, 230, 118, 0.6)) !important;
}

/* FOOTER PERFIL DE USUARIO EN EL CARRIL DE ÍCONOS */
.sidebar__user-profile {
    margin-top: auto;
    padding: 14px 11px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
}

.sidebar__user-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00e676 0%, #00b0ff 100%);
    color: #090a0f;
    font-weight: 800;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.25);
    border: 2px solid rgba(0, 230, 118, 0.4);
}

.sidebar__user-info {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    flex-grow: 1;
}

#sidebar:hover .sidebar__user-info,
#sidebar.is-open .sidebar__user-info {
    opacity: 1;
    visibility: visible;
}

.sidebar__user-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__user-role {
    color: var(--color-primary);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar__logout-btn {
    color: #71717a;
    font-size: 1.25rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

#sidebar:hover .sidebar__logout-btn,
#sidebar.is-open .sidebar__logout-btn {
    opacity: 1;
    visibility: visible;
}

.sidebar__logout-btn:hover {
    color: #ff5252;
    background-color: rgba(255, 82, 82, 0.12);
}

#main-content {
    margin-left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background-color: var(--color-fondo) !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    box-sizing: border-box !important;
    padding: 16px 28px 32px 84px !important;
}

/* ==========================================
   TABLAS Y BOTONES (Lienzo en blanco)
   ========================================== */