/* ═══════════════════════════════════════════════════════
   SIDEBAR FACTURACIÓN — sidebar-facturacion.css
   El toggle lo maneja navbar.php con clase: sidebar-collapsed
═══════════════════════════════════════════════════════ */

/* ── Botón hamburger del navbar (ya existe en navbar.php) ── */
#sidebar-toggle {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  color: #8b949e;
  font-size: 17px;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
#sidebar-toggle:hover {
  background: rgba(255,255,255,.10);
  color: #e6edf3;
}
#sidebar-toggle:focus { outline: none; box-shadow: none; }

/* ── Overlay móvil (ya en navbar.php) ────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}
#sidebar-overlay.show { display: block; }

/* ── Layout principal ─────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: calc(100vh - 52px);
}

.main-area {
  flex: 1;
  min-width: 0;
  padding: 24px 28px;
  background: #f1f5f9;
  overflow-x: hidden;
  transition: margin-left .22s ease;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: 224px;
  min-width: 224px;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 200;
  transition: width .22s cubic-bezier(.4,0,.2,1),
              min-width .22s cubic-bezier(.4,0,.2,1);
}

/* ── Cabecera interna del sidebar (solo título) ────────── */
.sb-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  flex-shrink: 0;
  overflow: hidden;
}
.sb-titulo {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #38bdf8;
  white-space: nowrap;
  transition: opacity .2s ease;
  opacity: 1;
}

/* ── Etiquetas de sección ─────────────────────────────── */
.sb-section-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 13px 16px 4px;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity .2s ease, height .22s ease;
}
.sb-section-label.s-titulacion { color: #facc15; }
.sb-section-label.s-sistema    { color: #a78bfa; }
.sb-section-label.s-cuenta     { color: #fb923c; }

/* ── Línea separadora ─────────────────────────────────── */
.sb-sep-line {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 4px 12px;
  transition: opacity .2s ease;
  flex-shrink: 0;
}

/* ── Links de navegación ─────────────────────────────── */
.sidebar a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: background .13s, color .13s;
}
.sidebar a:hover {
  background: rgba(255,255,255,.07);
  color: #e2e8f0;
  text-decoration: none;
}
.sidebar a.active {
  background: rgba(5,150,105,.2);
  color: #34d399;
  font-weight: 700;
}
.sidebar a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #10b981;
  border-radius: 0 3px 3px 0;
}
.sidebar a .sb-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
}
.sidebar a .sb-lnk {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity .18s ease, max-width .22s ease;
  opacity: 1;
  max-width: 180px;
}

/* Salir al fondo */
.sb-spacer { flex: 1; min-height: 8px; }
.sidebar a.sb-salir {
  color: #f87171;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar a.sb-salir:hover {
  background: rgba(239,68,68,.12);
  color: #fca5a5;
}

/* ══════════════════════════════════════════════════════
   COLAPSADO  →  .app-shell.sidebar-collapsed
   (clase que aplica el JS del navbar.php)
══════════════════════════════════════════════════════ */
.app-shell.sidebar-collapsed .sidebar {
  width: 54px;
  min-width: 54px;
}

/* Ocultar textos */
.app-shell.sidebar-collapsed .sb-titulo,
.app-shell.sidebar-collapsed .sb-section-label,
.app-shell.sidebar-collapsed .sidebar a .sb-lnk,
.app-shell.sidebar-collapsed .sb-sep-line {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Centrar iconos */
.app-shell.sidebar-collapsed .sidebar a {
  justify-content: center;
  padding: 10px 0;
}
.app-shell.sidebar-collapsed .sb-header {
  justify-content: center;
  padding: 0;
}

/* Ocultar badges */
.app-shell.sidebar-collapsed .sidebar .badge,
.app-shell.sidebar-collapsed .sidebar .rounded-pill {
  display: none !important;
}

/* Tooltip al pasar el cursor sobre icono colapsado */
.app-shell.sidebar-collapsed .sidebar a[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 58px;
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 9999;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.08);
}
.app-shell.sidebar-collapsed .sidebar a[data-tip]:hover::after {
  opacity: 1;
}

/* ── Responsive móvil ─────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 52px; left: 0; bottom: 0;
    width: 224px !important;
    min-width: 224px !important;
    transform: translateX(0);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.45);
    z-index: 200;
  }
  .app-shell.sidebar-collapsed .sidebar {
    transform: translateX(-224px);
    width: 224px !important;
    min-width: 224px !important;
  }
  /* En móvil no colapsar a iconos — se oculta del todo */
  .app-shell.sidebar-collapsed .sb-titulo,
  .app-shell.sidebar-collapsed .sb-section-label,
  .app-shell.sidebar-collapsed .sidebar a .sb-lnk,
  .app-shell.sidebar-collapsed .sb-sep-line {
    opacity: 1;
    max-width: 180px;
    overflow: visible;
  }
  .app-shell.sidebar-collapsed .sidebar a {
    justify-content: flex-start;
    padding: 9px 16px;
  }
  .app-shell.sidebar-collapsed .sb-header {
    justify-content: flex-start;
    padding: 0 16px;
  }
  .main-area { padding: 16px; }
}

/* ── Elementos comunes de página ─────────────────────── */
.page-header { margin-bottom: 20px; }
.page-header h4 {
  font-size: 18px; font-weight: 800; color: #0f172a; margin: 0 0 4px;
}
.page-header p { font-size: 13px; color: #64748b; margin: 0; }
.tbl-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
