/* v0.0.1 – estilos base mínimos (Bootstrap irá local en /assets/vendor/bootstrap/) */
:root{
  --kardex-header:#1E497E;
}

*, *::before, *::after{ box-sizing: border-box; }
html, body { height: 100%; }
body {
  background:#f6f7f9;
  min-height: 100vh;
  display:flex;
  flex-direction: column;
}
.kardex-header, .kardex-footer { background: var(--kardex-header); color:#fff; }
.kardex-header{
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  /* Debe quedar por encima del offcanvas/backdrop para que en móvil no “parezca” que el header se encoge */
  z-index: 1060;
}
.kardex-hamburger{ text-decoration:none; }
.kardex-hamburger-icon{ font-size: 22px; line-height: 1; display:inline-block; }
.kardex-header-mobile-title{ font-size: 14px; line-height: 1.1; }
.kardex-header-mobile-sub{ font-size: 12px; line-height: 1.1; }
.kardex-container { width: 100%; max-width: var(--kardex-max-width, 1920px); margin: 0 auto; }
.kardex-main {
  flex: 1 0 auto;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  box-shadow: 0 4px 22px rgba(0,0,0,.06);
  margin: 14px auto;
}
.kardex-title { font-size:16px; font-weight:600; text-transform:none; }
.kardex-text { font-size:15px; }

/* v0.1.0 – layout con sidebar */
.kardex-shell{
  display:flex;
  gap:16px;
  align-items:flex-start;
}
.kardex-sidebar{
  --bs-offcanvas-width: 300px;
  --bs-offcanvas-bg: var(--kardex-sidebar-bg, #212121);
  width: 300px;
  max-width: 300px;
  background-color: var(--kardex-sidebar-bg, #212121);
  background: var(--kardex-sidebar-bg, #212121);
  color: var(--kardex-sidebar-text, #ffffff);
  border-radius: 12px;
  padding: 0;
  flex: 0 0 auto;
  overflow: hidden;
}

/* Desktop: sidebar fijo (sticky) */
@media (min-width: 992px){
  /* En escritorio el sidebar debe ser visible y comportarse como columna, no como offcanvas oculto */
  .kardex-sidebar{
    position: sticky;
    top: 14px;
    height: calc(100vh - 28px);
    max-height: calc(100vh - 28px);
  }

  /* Bootstrap Offcanvas (si la clase .offcanvas está presente) oculta con visibility/transform.
     En desktop lo forzamos visible y sin transform para que no “desaparezca”. */
  .kardex-sidebar.offcanvas{
    visibility: visible !important;
    transform: none !important;
    transition: none !important;
    position: sticky !important;
    inset: auto !important;
    z-index: auto !important;
  }

  /* Bootstrap fuerza offcanvas-lg a background transparent!important en desktop.
     Aquí lo anulamos para respetar el color configurado del sidebar. */
  .kardex-sidebar.offcanvas-lg{
    background-color: var(--kardex-sidebar-bg, #212121) !important;
    background: var(--kardex-sidebar-bg, #212121) !important;
  }

  /* Bootstrap también pone .offcanvas-body en flex/overflow visible; asegurar scroll y layout */
  .kardex-sidebar.offcanvas-lg .kardex-sidebar-inner{
    display: block !important;
    overflow-y: auto !important;
  }
}

/* Mobile: offcanvas desde la izquierda */
@media (max-width: 991.98px){
  .kardex-sidebar{
    /* En móvil el offcanvas debe ocupar ~75% del ancho de pantalla */
    --bs-offcanvas-width: 75vw;
    width: var(--bs-offcanvas-width, 300px);
    max-width: 75vw;
    border-radius: 0;
    --bs-offcanvas-bg: var(--kardex-sidebar-bg-alpha, var(--kardex-sidebar-bg, #212121));
    background-color: var(--kardex-sidebar-bg-alpha, var(--kardex-sidebar-bg, #212121));
    background: var(--kardex-sidebar-bg-alpha, var(--kardex-sidebar-bg, #212121));
  }
  .kardex-sidebar-inner{ max-height: none; }
}

/* Dashboard: compactar espacios y grid de tarjetas en móvil */
@media (max-width: 991.98px){
  .kardex-dashboard .kardex-dashboard-pad{ padding-top: 30px !important; }
  .kardex-dashboard .kardex-dashboard-wrap{ padding-top: 0 !important; }

  .kardex-dashboard .kardex-dashboard-title{ font-size: 22px !important; }

  .kardex-dashboard .kardex-dashboard-logo{
    margin-top: 8px !important;
    margin-bottom: 14px !important;
  }
  .kardex-dashboard .kardex-dashboard-logo img{
    max-height: 110px !important;
  }

  .kardex-dashboard .kardex-dash-card{ padding: 14px !important; white-space: normal !important; display: block !important; }
  .kardex-dashboard .kardex-dash-card .kardex-dash-title{ font-size: 14px !important; }
  .kardex-dashboard .kardex-dash-card .kardex-dash-count{ font-size: 30px !important; line-height: 1.05 !important; }
  .kardex-dashboard .kardex-dash-card .kardex-dash-sub{ font-size: 12px !important; }
}

/* Offcanvas: quitar padding Bootstrap y mantener el padding propio */
.kardex-sidebar .offcanvas-body{ padding: 0 !important; }
.kardex-sidebar .offcanvas-header{ border-bottom: 1px solid rgba(255,255,255,.12); }

.kardex-sidebar-inner{
  position: relative;
  padding: 14px 10px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;

  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.28) rgba(255,255,255,.06);
}
.kardex-sidebar-inner::-webkit-scrollbar{ width: 8px; }
.kardex-sidebar-inner::-webkit-scrollbar-track{ background: rgba(255,255,255,.06); border-radius: 10px; }
.kardex-sidebar-inner::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.28); border-radius: 10px; }
.kardex-sidebar-inner::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,.38); }
.kardex-sidebar a{
  color: var(--kardex-sidebar-text, #ffffff);
  text-decoration:none;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  text-transform: none;
}
.kardex-sidebar a:hover{ text-decoration:none; }


/* Sidebar: marca superior (logo + TABLERO) */
.kardex-sidebar .sidebar-brand{
  padding: 8px 10px 4px;
  margin: 2px 2px 10px;
  text-align: center;
}
.kardex-sidebar .sidebar-brand-logo{
  width: 100%;
  height: auto;
  max-height: 110px;
  object-fit: contain;
  display: block;
  margin: 0 auto 6px;
  border-radius: 10px;
  background: rgba(255,255,255,.10);
  padding: 6px;
}
.kardex-sidebar .sidebar-brand-logo.placeholder{
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin: 0 auto 6px;
  border-radius: 10px;
  background: rgba(255,255,255,.10);
  font-size: 28px;
  opacity: .85;
}
.kardex-sidebar .sidebar-brand-title{
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  opacity: .95;
  margin-bottom: 6px;
}

/* Sidebar: iconografía consistente */
.kardex-sidebar .kardex-menu-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;       /* reserva el espacio para alinear textos */
  min-width: 24px;
  margin-right: 10px;
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
}
.kardex-sidebar .kardex-menu-icon-main{
  font-size: 16px;
}

.kardex-sidebar .section-title{
  font-size: 16px;
  font-weight: 600;
  opacity: .95;
  margin: 14px 10px 6px;
  text-transform: none;
}

.kardex-sidebar .section-title.section-toggle{
  margin: 14px 6px 6px;
}
.kardex-sidebar .section-toggle-btn{
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  opacity: .95;
}
.kardex-sidebar .section-toggle-btn:hover{
  background: rgba(255,255,255,.08);
}
.kardex-sidebar .section-title.section-toggle.active .section-toggle-btn{
  background: rgba(255,255,255,.12);
  font-weight: 700;
}
.kardex-sidebar .section-chev{
  display: inline-block;
  transition: transform .15s ease;
}
.kardex-sidebar .section-toggle-btn[aria-expanded="true"] .section-chev{
  transform: rotate(180deg);
}

.kardex-sidebar .section-title.section-link{
  padding: 0;
}
.kardex-sidebar .section-title.section-link a{
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  opacity: .95;
}

/* Secciones colapsables: mismas reglas que section-link, pero con chevron a la derecha */
.kardex-sidebar .section-title.section-link.section-toggle a.section-toggle-btn{
  justify-content: space-between;
}

/* Cuando la sección tiene link + botón separado para colapsar */
.kardex-sidebar .section-title.section-link.section-toggle .section-collapse-toggle{
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.kardex-sidebar .section-title.section-link.section-toggle .nav-link-row > a{
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  opacity: .95;
}
.kardex-sidebar .section-title.section-link a:hover{
  background: rgba(255,255,255,.08);
}
.kardex-sidebar .section-title.section-link.active a{
  background: rgba(255,255,255,.12);
}

.kardex-sidebar .sub-item{
  margin-left: 10px;
  opacity: .95;
  padding: 4px 10px;
}
.kardex-sidebar .sub-item a{
  font-size: 13.5px;
  line-height: 16px;
}

/* Submenús: hacer íconos un poco más grandes y bien visibles */
.kardex-sidebar .sub-item .kardex-menu-icon{
  font-size: 14px;
  color: #fff;
}

.kardex-sidebar .nav-item{
  padding: 8px 10px;
  border-radius: 10px;
  transition: background .15s ease, transform .12s ease;
}
.kardex-sidebar .nav-item:hover{ background: rgba(255,255,255,.07); }
.kardex-sidebar .nav-item.active{ background: rgba(255,255,255,.12); }
.kardex-sidebar .nav-item.active a{ font-weight: 700; }
.kardex-sidebar .sub-item.active a{ font-weight: 700; }
.kardex-sidebar .section-title.section-link.active a{ font-weight: 700; }
.kardex-sidebar .sub-item{ margin-left: 10px; opacity: .95; }

.kardex-sidebar .nav-link-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.kardex-sidebar .nav-link-row a{ flex: 1 1 auto; min-width:0; }

/* Secciones con link + toggle: que el chevron quede pegado al texto (no a la derecha) */
.kardex-sidebar .section-title.section-link.section-toggle .nav-link-row.section-link-row{
  justify-content: flex-start;
  gap: 6px;
}
.kardex-sidebar .section-title.section-link.section-toggle .nav-link-row.section-link-row > a{
  flex: 0 1 auto;
}

.kardex-sidebar .submenu-toggle{
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display:flex;
  align-items:center;
  justify-content:center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  opacity: .9;
  transition: background .15s ease, transform .15s ease;
}
.kardex-sidebar .submenu-toggle:hover{ background: rgba(255,255,255,.10); }
.kardex-sidebar .submenu-chev{ display:inline-block; transition: transform .15s ease; }
.kardex-sidebar .submenu-toggle[aria-expanded="true"] .submenu-chev{ transform: rotate(180deg); }

/* --- Sidebar: diferenciar el toggle de secciones principales ---
   Solo las secciones principales usan + / − (más grande y con color).
   Los sub-menús mantienen el chevron estándar.
*/
:root{
  --kardex-section-toggle-plus: #ffffff;
  --kardex-section-toggle-minus: #ffffff;
}

/* Caso 1: sección con link + botón separado (section-collapse-toggle) */
.kardex-sidebar .section-title.section-link.section-toggle .section-collapse-toggle .submenu-chev{ display:none; }
.kardex-sidebar .section-title.section-link.section-toggle .section-collapse-toggle{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  opacity: 1;
}
.kardex-sidebar .section-title.section-link.section-toggle .section-collapse-toggle::before{
  content: "+";
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  color: var(--kardex-section-toggle-plus);
}
.kardex-sidebar .section-title.section-link.section-toggle .section-collapse-toggle[aria-expanded="true"]::before{
  content: "−";
  color: var(--kardex-section-toggle-minus);
}

/* Caso 2: sección sin link (section-toggle-btn) */
.kardex-sidebar .section-title.section-toggle .section-toggle-btn .section-chev{ display:none; }
.kardex-sidebar .section-title.section-toggle .section-toggle-btn::after{
  content: "+";
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  color: var(--kardex-section-toggle-plus);
}
.kardex-sidebar .section-title.section-toggle .section-toggle-btn[aria-expanded="true"]::after{
  content: "−";
  color: var(--kardex-section-toggle-minus);
}

/* Suavizar chevrons de submenús (para que no se confundan con los +/− principales) */
.kardex-sidebar .nav-item .submenu-toggle{ opacity: .75; }
.kardex-sidebar .nav-item .submenu-chev{ font-size: 14px; color: #fff; }

.kardex-content{ flex:1; min-width:0; }

.kardex-card{
  border: 1px solid #e8e8ee;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}


/* Mobile: el sidebar es offcanvas overlay; no debe alterar el layout del contenido */
@media (max-width: 991.98px){
  .kardex-shell{ display:block; }
  .kardex-content{ width:100%; }
}

.kardex-card { box-shadow: 0 2px 10px rgba(0,0,0,.04); }


.kardex-toplink{color:#fff;text-decoration:none;padding:.25rem .5rem;border-radius:.5rem;}
.kardex-toplink:hover{background:rgba(255,255,255,.12);text-decoration:none;}

/* Evitar que Bootstrap agregue padding-right y "mueva" el header al abrir el offcanvas */
body.kardex-offcanvas-open{ padding-right: 0 !important; }
body.kardex-offcanvas-open .kardex-header{ padding-right: 0 !important; }


/* -------------------- */
/* Login (sin chrome)   */
/* -------------------- */
body.kardex-login-body{
  background: radial-gradient(1200px 700px at 20% 10%, rgba(255,255,255,.10), transparent 55%),
              radial-gradient(900px 600px at 80% 20%, rgba(255,255,255,.08), transparent 60%),
              #0c0f14;
}
.kardex-login-wrap{
  min-height: 100vh;
  /* iOS/Android: usar unidades "dinámicas" cuando estén disponibles */
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 12px;
}
.kardex-login-card{
  width: 100%;
  max-width: 520px;
  border-radius: 18px;
  /* Card semitransparente (más transparente) */
  padding: 50px 30px;
  background: rgba(0,0,0,.35);
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  backdrop-filter: blur(7px);
}

/* Ajuste móvil: evita overflow por padding grande */
@media (max-width: 480px){
  .kardex-login-card{ padding: 32px 18px; }
}

/* Tablet horizontal: compactar el cuadro para una mejor "primera impresión" */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape){
  .kardex-login-wrap{ align-items: flex-start; padding: 8px 12px; }
  .kardex-login-card{
    padding: 18px 18px;
    max-height: calc(100vh - 16px);
    max-height: calc(100svh - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
  }
  .kardex-login-brand{ padding: 4px 4px 10px; }
  .kardex-login-logo{ max-width: 240px; padding: 8px; margin-bottom: 6px; }
  .kardex-login-title{ font-size: 24px; }
  .kardex-login-formbox{ padding: 12px; }
  .kardex-login-subtitle{ margin-bottom: 8px; }
  .kardex-login-formbox .input-group.mb-3{ margin-bottom: .75rem !important; }
}


/* Tablet horizontal (baja altura): hacer el login más compacto aún (ej: 10.1" 1280x800) */
@media (orientation: landscape) and (min-width: 1024px) and (max-width: 1400px) and (max-height: 900px){
  .kardex-login-wrap{
    align-items: flex-start;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    overflow-y: auto;
    padding: 6px 10px;
  }
  .kardex-login-card{
    max-width: 480px;
    padding: 12px 14px;
    max-height: calc(100dvh - 12px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .kardex-login-brand{ padding: 2px 2px 8px; }
  .kardex-login-logo{ max-width: 190px; padding: 6px; margin-bottom: 4px; }
  .kardex-login-title{ font-size: 20px; }
  .kardex-login-formbox{ padding: 10px; }
  .kardex-login-subtitle{ display: none; }
  .kardex-login-formbox .input-group.mb-3{ margin-bottom: .5rem !important; }
  .kardex-login-formbox .form-check{ margin-bottom: .5rem !important; }
  .kardex-login-formbox .btn{ padding: .45rem .75rem; font-size: .95rem; }
}
.kardex-login-brand{
  text-align: center;
  padding: 6px 6px 14px;
}
.kardex-login-logo{
  width: 100%;
  max-width: 320px;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  padding: 10px;
  display: inline-block;
  margin-bottom: 10px;
}
.kardex-login-title{
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #fff;
  line-height: 1.1;
}
.kardex-login-formbox{
  background: rgba(255,255,255,.96);
  border-radius: 14px;
  padding: 16px;
}
.kardex-login-subtitle{
  font-size: 14px;
  font-weight: 600;
  color: rgba(0,0,0,.70);
  margin-bottom: 12px;
  text-align: center;
}
.kardex-login-formbox .input-group-text{
  background: #f3f5f7;
}

.kardex-sidebar .section-toggle-btn span.d-inline-flex{ gap: 8px; }
