/* =========================================================================
   HOTEL INVENTORY — DESIGN SYSTEM
   Sistema Web de Inventario para Hoteles
   Paleta: naranja profesional | Tipografía: Inter | Estilo: SaaS premium
   ========================================================================= */


/* -------------------------------------------------------------------------
   1. DESIGN TOKENS
   ------------------------------------------------------------------------- */

:root {
  /* Marca */
  --color-primary: #F97316;
  --color-primary-rgb: 249, 115, 22;
  --color-secondary: #FB923C;
  --color-accent: #FDBA74;

  /* Estado */
  --color-success: #22C55E;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-info: #0EA5E9;

  /* Superficies */
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-sidebar: #1E293B;
  --color-sidebar-hover: #29394F;

  /* Texto */
  --color-text: #1E293B;
  --color-text-muted: #64748B;
  --color-text-inverse: #F8FAFC;
  --color-border: #E2E8F0;

  /* Radios */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --shadow-primary: 0 8px 20px rgba(var(--color-primary-rgb), 0.28);

  /* Transiciones */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms var(--ease);
  --transition-base: 220ms var(--ease);
  --transition-slow: 400ms var(--ease);

  /* Layout */
  --sidebar-width: 268px;
  --sidebar-width-collapsed: 84px;
  --navbar-height: 72px;
  --footer-height: 48px;
}


/* -------------------------------------------------------------------------
   MODO OSCURO
   ------------------------------------------------------------------------- */

html.dark-mode {
  --color-bg: #0F172A;
  --color-surface: #1E293B;
  --color-sidebar: #0B1220;
  --color-sidebar-hover: #172033;
  --color-text: #E2E8F0;
  --color-text-muted: #94A3B8;
  --color-border: #2A3A52;

  /* Alinea los componentes de Bootstrap (modales, dropdowns, cards,
     tablas, offcanvas, alerts, list-group) con la paleta oscura de la
     app. Sin esto, esos componentes se quedan con el fondo blanco por
     defecto de Bootstrap mientras el texto hereda el color claro del
     modo oscuro, y el contraste desaparece. */
  --bs-body-bg: var(--color-bg);
  --bs-body-color: var(--color-text);
  --bs-border-color: var(--color-border);
  --bs-border-color-translucent: var(--color-border);
  --bs-secondary-bg: var(--color-surface);
  --bs-tertiary-bg: var(--color-surface);
  --bs-emphasis-color: var(--color-text);

  --bs-modal-bg: var(--color-surface);
  --bs-modal-color: var(--color-text);
  --bs-modal-header-border-color: var(--color-border);
  --bs-modal-footer-border-color: var(--color-border);

  --bs-dropdown-bg: var(--color-surface);
  --bs-dropdown-color: var(--color-text);
  --bs-dropdown-link-color: var(--color-text);
  --bs-dropdown-link-hover-color: var(--color-primary);
  --bs-dropdown-link-hover-bg: var(--color-bg);
  --bs-dropdown-border-color: var(--color-border);
  --bs-dropdown-divider-bg: var(--color-border);
  --bs-dropdown-header-color: var(--color-text-muted);

  --bs-card-bg: var(--color-surface);
  --bs-card-color: var(--color-text);
  --bs-card-border-color: var(--color-border);
  --bs-card-cap-bg: var(--color-surface);

  --bs-table-color: var(--color-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--color-border);
  --bs-table-striped-bg: rgba(226, 232, 240, 0.04);
  --bs-table-hover-bg: rgba(226, 232, 240, 0.06);

  --bs-offcanvas-bg: var(--color-surface);
  --bs-offcanvas-color: var(--color-text);
  --bs-offcanvas-border-color: var(--color-border);

  --bs-list-group-bg: var(--color-surface);
  --bs-list-group-color: var(--color-text);
  --bs-list-group-border-color: var(--color-border);
  --bs-list-group-action-hover-bg: var(--color-bg);

  --bs-alert-bg: var(--color-surface);
  --bs-alert-border-color: var(--color-border);

  /* .bg-light, .bg-white y .text-dark leen estos RGB directamente
     (no encadenan con --bs-body-bg), así que sin esto se quedan
     blancos/negros fijos y el texto claro del modo oscuro se vuelve
     invisible encima. */
  --bs-light-rgb: 30, 41, 59;
  --bs-white-rgb: 30, 41, 59;
  --bs-dark-rgb: 226, 232, 240;
}

html.dark-mode select.form-control,
html.dark-mode .form-select {
  color-scheme: dark;
}

html.dark-mode .table > :not(caption) > * > * {
  background-color: transparent;
  color: var(--color-text);
}

/* .card y .dropdown-menu redeclaran su propio --bs-*-bg a partir de
   --bs-body-bg (ya corregido arriba), pero forzamos --color-surface
   para que se distingan un poco del fondo de la página. */
html.dark-mode .card {
  --bs-card-bg: var(--color-surface);
  --bs-card-color: var(--color-text);
  --bs-card-cap-bg: rgba(226, 232, 240, 0.03);
}

html.dark-mode .dropdown-menu {
  --bs-dropdown-bg: var(--color-surface);
  --bs-dropdown-color: var(--color-text);
}

/* .table-light fija colores en hexadecimal (no usa variables), así
   que se sobreescribe directamente para que no quede blanco. */
html.dark-mode .table-light,
html.dark-mode thead.table-light {
  --bs-table-color: var(--color-text);
  --bs-table-bg: var(--color-surface);
  --bs-table-border-color: var(--color-border);
  --bs-table-striped-bg: rgba(226, 232, 240, 0.04);
  --bs-table-striped-color: var(--color-text);
  --bs-table-active-bg: rgba(226, 232, 240, 0.08);
  --bs-table-active-color: var(--color-text);
  --bs-table-hover-bg: rgba(226, 232, 240, 0.06);
  --bs-table-hover-color: var(--color-text);
}


/* -------------------------------------------------------------------------
   2. BASE
   ------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-base), color var(--transition-base);
}

a {
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.text-muted-app {
  color: var(--color-text-muted) !important;
}

.fw-600 {
  font-weight: 600;
}

.fw-700 {
  font-weight: 700;
}


/* -------------------------------------------------------------------------
   3. BOTONES
   ------------------------------------------------------------------------- */

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
  border: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary,
.btn-brand {
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-secondary)
  );
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover,
.btn-brand:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 24px rgba(var(--color-primary-rgb), 0.36);
  transform: translateY(-1px);
  color: #fff;
}

.btn-outline-brand {
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline-brand:hover {
  background: rgba(var(--color-primary-rgb), 0.08);
  color: var(--color-primary);
}

.btn-light-app {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-light-app:hover {
  background: #EEF2F7;
  color: var(--color-text);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
}


/* -------------------------------------------------------------------------
   4. TARJETAS
   ------------------------------------------------------------------------- */

.card-app {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition-base),
    transform var(--transition-base);
}

.card-app:hover {
  box-shadow: var(--shadow-md);
}

.card-app .card-header-app {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-app .card-body-app {
  padding: 1.5rem;
}


/* Stat card */

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.375rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  flex-shrink: 0;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.stat-card .stat-trend {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.stat-trend.up {
  color: var(--color-success);
}

.stat-trend.down {
  color: var(--color-danger);
}

.stat-icon.bg-primary-soft {
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
}

.stat-icon.bg-success-soft {
  background: rgba(34, 197, 94, 0.12);
  color: var(--color-success);
}

.stat-icon.bg-info-soft {
  background: rgba(14, 165, 233, 0.12);
  color: var(--color-info);
}

.stat-icon.bg-warning-soft {
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-warning);
}

.stat-icon.bg-danger-soft {
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-danger);
}


/* -------------------------------------------------------------------------
   5. BADGES
   ------------------------------------------------------------------------- */

.badge-app {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-app::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success {
  background: rgba(34, 197, 94, 0.12);
  color: #15803D;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #B45309;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #B91C1C;
}

.badge-info {
  background: rgba(14, 165, 233, 0.12);
  color: #0369A1;
}

.badge-neutral {
  background: #F1F5F9;
  color: #475569;
}

.badge-primary {
  background: rgba(var(--color-primary-rgb), 0.12);
  color: #C2410C;
}


/* -------------------------------------------------------------------------
   6. LOGIN — GLASSMORPHISM
   ------------------------------------------------------------------------- */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  background: var(--color-bg);
}

.auth-form-side {
  flex: 1 1 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.auth-illustration-side {
  flex: 1 1 55%;
  position: relative;
  background: linear-gradient(
    160deg,
    var(--color-primary) 0%,
    var(--color-secondary) 55%,
    var(--color-accent) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-illustration-side::before,
.auth-illustration-side::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.auth-illustration-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-illustration-side::before {
  width: 380px;
  height: 380px;
  top: -120px;
  right: -80px;
}

.auth-illustration-side::after {
  width: 260px;
  height: 260px;
  bottom: -100px;
  left: -60px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2.25rem;
}

.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-secondary)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  box-shadow: var(--shadow-primary);
}

.form-floating > .form-control,
.form-floating > .form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text);
  min-height: 58px;
}

/* Estilo "cristal" solo para el formulario de login, que va sobre una
   imagen de fondo; el resto de la app usa el fondo normal de --color-surface
   (arriba) para que los formularios respeten el modo oscuro. */
.auth-card .form-floating > .form-control,
.auth-card .form-floating > .form-select {
  background: rgba(255, 255, 255, 0.85);
  color: var(--color-text);
}

.form-floating > .form-control:focus,
.form-floating > .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.12);
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  z-index: 5;
}


/* -------------------------------------------------------------------------
   7. APP LAYOUT — SIDEBAR / NAVBAR / FOOTER
   ------------------------------------------------------------------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  color: #CBD5E1;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-base);
  overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}

.sidebar-brand {
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand .logo-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-secondary)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-section-title,
.app-shell.sidebar-collapsed .nav-link-text,
.app-shell.sidebar-collapsed .nav-caret {
  display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.nav-section-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  font-weight: 700;
  margin: 1.1rem 0.75rem 0.4rem;
}

.nav-section-title:first-child {
  margin-top: 0.25rem;
}

.sidebar .nav-link {
  color: #CBD5E1;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  white-space: nowrap;
}

.sidebar .nav-link i {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar .nav-link:hover {
  background: var(--color-sidebar-hover);
  color: #fff;
}

.sidebar .nav-link.active {
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-secondary)
  );
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.nav-caret {
  margin-left: auto;
  transition: transform var(--transition-base);
  font-size: 0.75rem;
}

.nav-link[aria-expanded="true"] .nav-caret {
  transform: rotate(90deg);
}

.sidebar .collapse .nav-link {
  padding-left: 2.6rem;
  font-size: 0.8375rem;
}

.sidebar-footer {
  padding: 0.9rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}


/* Contenido principal */

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-base);
  min-width: 0;
}

.app-shell.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-width-collapsed);
}


/* Navbar superior */

.topbar {
  height: var(--navbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar .search-box {
  position: relative;
  max-width: 340px;
  width: 100%;
}

.topbar .search-box input {
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-border);
  padding-left: 2.5rem;
  background: var(--color-bg);
  font-size: 0.875rem;
}

.topbar .search-box input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.1);
}

.topbar .search-box i {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

.topbar-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  position: relative;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.topbar-icon-btn:hover {
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
}

.topbar-icon-btn .dot-badge {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-danger);
  border: 2px solid var(--color-surface);
}

.avatar-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: none;
  background: transparent;
}

.avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-accent);
}


/* Contenido y footer */

.page-content {
  padding: 1.75rem;
  flex: 1;
}

.app-footer {
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.breadcrumb-app {
  font-size: 0.8125rem;
}

.breadcrumb-app .breadcrumb-item + .breadcrumb-item::before {
  content: '›';
  color: var(--color-text-muted);
}


/* -------------------------------------------------------------------------
   8. TABLAS
   ------------------------------------------------------------------------- */

.table-app {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}

.table-app thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  font-weight: 700;
  border-bottom: 1.5px solid var(--color-border);
  padding: 0.85rem 1rem;
  white-space: nowrap;
}

.table-app tbody td {
  padding: 0.9rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
}

.table-app tbody tr {
  transition: background var(--transition-fast);
}

.table-app tbody tr:hover {
  background: var(--color-bg);
}

.table-app tbody tr:last-child td {
  border-bottom: none;
}

.table-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.action-menu-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.action-menu-btn:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}


/* -------------------------------------------------------------------------
   9. FORMULARIOS
   ------------------------------------------------------------------------- */

.form-label-app {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  padding: 0.65rem 0.9rem;
  font-size: 0.875rem;
  background-color: var(--color-surface);
  color: var(--color-text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.1);
}

.form-control.is-invalid {
  border-color: var(--color-danger);
}

.invalid-feedback {
  font-size: 0.75rem;
}

.form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.form-switch .form-check-input {
  width: 2.6em;
  height: 1.4em;
}


/* Dropzone */

.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  background: var(--color-bg);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.05);
}

.dropzone i {
  font-size: 2rem;
  color: var(--color-primary);
}


/* -------------------------------------------------------------------------
   10. MODALES / OFFCANVAS / TABS / TIMELINE / SKELETON
   ------------------------------------------------------------------------- */

.modal-content {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.1rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.offcanvas {
  border: none;
  box-shadow: var(--shadow-lg);
}

.nav-tabs-app {
  border-bottom: 1.5px solid var(--color-border);
}

.nav-tabs-app .nav-link {
  border: none;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 2px solid transparent;
}

.nav-tabs-app .nav-link.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: none;
}

.timeline {
  position: relative;
  padding-left: 1.75rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-primary);
}

.skeleton {
  background: linear-gradient(
    90deg,
    #E2E8F0 25%,
    #EDF2F7 37%,
    #E2E8F0 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

.spinner-brand {
  color: var(--color-primary);
}

.alert-app {
  border-radius: var(--radius-md);
  border: none;
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
}

.alert-app.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #166534;
}

.alert-app.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400E;
}

.alert-app.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #991B1B;
}

.alert-app.alert-info {
  background: rgba(14, 165, 233, 0.1);
  color: #075985;
}


/* -------------------------------------------------------------------------
   11. UTILIDADES DE ANIMACIÓN
   ------------------------------------------------------------------------- */

.fade-in-up {
  animation: fadeInUp var(--transition-slow) both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger > * {
  animation: fadeInUp var(--transition-slow) both;
}

.stagger > *:nth-child(1) {
  animation-delay: 0.02s;
}

.stagger > *:nth-child(2) {
  animation-delay: 0.06s;
}

.stagger > *:nth-child(3) {
  animation-delay: 0.10s;
}

.stagger > *:nth-child(4) {
  animation-delay: 0.14s;
}

.stagger > *:nth-child(5) {
  animation-delay: 0.18s;
}


/* -------------------------------------------------------------------------
   12. RESPONSIVE GENERAL
   ------------------------------------------------------------------------- */

@media (max-width: 991.98px) {

  .sidebar {
    left: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width);
    box-shadow: var(--shadow-lg);
  }

  .app-shell.sidebar-mobile-open .sidebar {
    left: 0;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1025;
  }

  .app-shell.sidebar-mobile-open .sidebar-backdrop {
    display: block;
  }

  .topbar .search-box {
    display: none;
  }

  .auth-illustration-side {
    display: none;
  }

  .auth-form-side {
    flex: 1 1 100%;
  }
}

@media (max-width: 575.98px) {

  .page-content {
    padding: 1rem;
  }

  .topbar {
    padding: 0 1rem;
    gap: 0.6rem;
  }

  .auth-card {
    padding: 1.75rem 1.25rem;
  }
}


/* =========================================================================
   13. PAGINACIÓN APP
   ========================================================================= */

.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.pagination-info {
  color: #64748b;
  font-size: 0.875rem;
}

.pagination-info strong {
  color: #1e293b;
  font-weight: 600;
}

.pagination-app {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pagination-app .page-item {
  margin: 0;
}

.pagination-app .page-link {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  border: 1px solid #e2e8f0;
  border-radius: 8px !important;

  background: #fff;
  color: #475569;

  font-size: 0.875rem;
  font-weight: 600;

  transition: all 0.2s ease;
}

.pagination-app .page-link:hover {
  background: #fff7ed;
  border-color: #fdba74;
  color: #f97316;
}

.pagination-app .page-item.active .page-link {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.20);
}

.pagination-app .page-item.disabled .page-link {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #cbd5e1;
  cursor: not-allowed;
}


/* -------------------------------------------------------------------------
   Paginación responsive
   ------------------------------------------------------------------------- */

@media (max-width: 576px) {

  .pagination-wrapper {
    flex-direction: column;
    align-items: flex-start;
  }

  .pagination-app {
    width: 100%;
    justify-content: center;
  }
}


/* =========================================================================
   14. USUARIOS
   Buscador + tabla responsive + menú de acciones
   ========================================================================= */


/* -------------------------------------------------------------------------
   Contenedor principal de tabla
   ------------------------------------------------------------------------- */

.usuarios-table-container {
  width: 100%;

  /*
   * El scroll horizontal pertenece únicamente
   * a la tabla.
   */
  overflow-x: auto;
  overflow-y: visible;

  -webkit-overflow-scrolling: touch;
}


/*
 * Ancho mínimo para evitar que las columnas
 * se aplasten en pantallas pequeñas.
 */

.usuarios-table {
  width: 100%;
  min-width: 950px;
}


/* -------------------------------------------------------------------------
   BUSCADOR DE USUARIOS
   ------------------------------------------------------------------------- */

.usuarios-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 2rem;

  margin-bottom: 1.5rem;
}

.usuarios-heading {
  min-width: 0;
}

.usuarios-card-title {
  margin: 0;

  color: var(--color-text);

  font-size: 1.35rem;
  font-weight: 700;
}

.usuarios-card-subtitle {
  margin: 0.25rem 0 0;

  color: var(--color-text-muted);

  font-size: 0.95rem;
}


/* Formulario */

.usuarios-search-form {
  flex-shrink: 0;
  margin: 0;
}


/* Caja */

.usuarios-search-box {
  position: relative;

  width: 375px;
  max-width: 100%;
}


/* Input */

.usuarios-search-box input {
  width: 100%;

  height: 46px;

  padding-left: 3rem;
  padding-right: 3rem;

  border-radius: 13px;
}


/* Icono lupa */

.usuarios-search-box > i {
  position: absolute;

  left: 1rem;
  top: 50%;

  transform: translateY(-50%);

  color: var(--color-text-muted);

  pointer-events: none;

  z-index: 2;
}


/*
 * El navegador agrega una X propia a los inputs type="search".
 *
 * La eliminamos porque nosotros tenemos nuestra propia
 * X para limpiar el filtro.
 */

.usuarios-search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}


/* X propia */

.usuarios-search-clear {
  position: absolute;

  right: 0.65rem;
  top: 50%;

  width: 30px;
  height: 30px;

  transform: translateY(-50%);

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  color: var(--color-text-muted);

  text-decoration: none;

  z-index: 3;
}

.usuarios-search-clear:hover {
  background: var(--color-bg);
  color: var(--color-text);
}


/* -------------------------------------------------------------------------
   BARRA DE BÚSQUEDA + FILTROS ESTÁNDAR
   -------------------------------------------------------------------------
   Se usa en TODOS los listados (usuarios, productos, ventas, etc.):
   una caja de búsqueda (.usuarios-search-box) seguida de selects de
   filtro que se envían solos al cambiar (onchange="this.form.submit()").
   Nunca va dentro de una tarjeta blanca (x-card): flota directo sobre
   la tabla, igual que en esta regla.
   ------------------------------------------------------------------------- */

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.productos-toolbar .productos-count {
  margin-left: auto;
}

.list-toolbar .usuarios-search-box {
  width: 375px;
  min-width: 0;
}

.ventas-toolbar .usuarios-search-box,
.pagos-toolbar .usuarios-search-box {
  width: 375px;
}

.ventas-toolbar .filter-select,
.pagos-toolbar .filter-select {
  width: 190px;
  min-width: 190px;
}

/* Cualquier <select> de filtro que viva junto a la caja de búsqueda
   queda con la misma altura y redondeo que la caja de búsqueda, para
   que se vean como una sola barra. Se aplica agregando la clase
   .filter-select junto a .form-select en el <select>. */
.list-toolbar .form-select,
.filter-select {
  height: 46px;
  border-radius: 13px;
  min-width: 170px;
  padding-right: 2.75rem;
}

.usuarios-rol-filter {
  width: 260px;
  min-width: 260px;
}

.clientes-toolbar .usuarios-search-box {
  width: 375px;
}

.clientes-estado-filter {
  width: 180px;
  min-width: 180px;
}

.usuarios-estado-filter {
  width: 160px;
  min-width: 160px;
}


/* -------------------------------------------------------------------------
   RESULTADO DE BÚSQUEDA
   ------------------------------------------------------------------------- */

.usuarios-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 1rem;

  padding: 0.75rem 1rem;

  margin-bottom: 1rem;

  background: var(--color-bg);

  border: 1px solid var(--color-border);

  border-radius: var(--radius-sm);

  color: var(--color-text-muted);

  font-size: 0.875rem;
}


/* =========================================================
   MENÚ DE ACCIONES DE USUARIOS
   ========================================================= */

.usuarios-dropdown {
  position: relative;
}

.usuarios-dropdown .action-menu-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.usuarios-dropdown .action-menu-btn:hover {
  background: var(--color-bg);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.usuarios-actions-menu {
  min-width: 235px;
  padding: 0.4rem;
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  z-index: 1100;
}

/* Última fila: Bootstrap abre el menú hacia arriba. */
.usuarios-dropdown.dropup .usuarios-actions-menu {
  margin-bottom: 8px !important;
}

.usuarios-actions-menu .dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.875rem;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.usuarios-actions-menu .dropdown-item:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.usuarios-actions-menu .dropdown-item i {
  width: 20px;
  margin-right: 0.35rem;
  text-align: center;
}

.usuarios-actions-menu .dropdown-divider {
  margin: 0.35rem 0;
  border-color: var(--color-border);
}

.usuarios-actions-menu .dropdown-item.text-danger {
  color: var(--color-danger) !important;
}

.usuarios-actions-menu .dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #B91C1C !important;
}

/* -------------------------------------------------------------------------
   SIN RESULTADOS
   ------------------------------------------------------------------------- */

.usuarios-empty {
  padding: 2rem;

  text-align: center;

  color: var(--color-text-muted);
}

.usuarios-empty > i {
  display: block;

  margin-bottom: 0.75rem;

  font-size: 2.5rem;

  color: #94A3B8;
}

.usuarios-empty h6 {
  margin-bottom: 0.35rem;

  color: var(--color-text);

  font-weight: 600;
}

.usuarios-empty p {
  margin-bottom: 1rem;
}


/* -------------------------------------------------------------------------
   PAGINACIÓN DE USUARIOS
   ------------------------------------------------------------------------- */

.usuarios-pagination {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 1rem;

  margin-top: 1.5rem;

  padding-top: 1rem;

  border-top: 1px solid var(--color-border);
}

.usuarios-pagination-info {
  color: var(--color-text-muted);

  font-size: 0.875rem;

  white-space: nowrap;
}

.usuarios-pagination-info strong {
  color: var(--color-text);

  font-weight: 600;
}


/* =========================================================================
   15. USUARIOS — RESPONSIVE
   ========================================================================= */


/* Tablet */

@media (max-width: 991.98px) {

  .usuarios-card-header {
    gap: 1rem;
  }

  .usuarios-search-box {
    width: 300px;
  }
}


/* -------------------------------------------------------------------------
   Móvil
   ------------------------------------------------------------------------- */

@media (max-width: 767.98px) {

  .ventas-toolbar form,
  .pagos-toolbar form {
    flex-wrap: wrap;
  }

  .ventas-toolbar .usuarios-search-box,
  .pagos-toolbar .usuarios-search-box {
    width: 100%;
  }

  .ventas-toolbar .filter-select,
  .pagos-toolbar .filter-select {
    width: auto;
    min-width: 170px;
  }

  .productos-toolbar .usuarios-search-form {
    width: 100%;
  }

  .productos-toolbar .productos-count {
    margin-left: 0;
  }

  .usuarios-card-header {
    flex-direction: column;

    align-items: stretch;

    gap: 1rem;
  }

  .usuarios-search-form {
    width: 100%;
  }

  .usuarios-search-box {
    width: 100%;
  }

  /*
   * SOLO la tabla tiene desplazamiento horizontal.
   *
   * El resto de la página continúa siendo responsive.
   */

  .usuarios-table-container {
    width: 100%;

    overflow-x: auto;
    overflow-y: visible;
  }

  .usuarios-table {
    min-width: 950px;
  }

  .usuarios-search-result {
    flex-direction: column;

    align-items: flex-start;
  }

  .usuarios-pagination {
    flex-direction: column;

    align-items: flex-start;
  }

  .usuarios-pagination-info {
    white-space: normal;
  }
}


/* -------------------------------------------------------------------------
   Móvil pequeño
   ------------------------------------------------------------------------- */

@media (max-width: 480px) {

  .usuarios-card-title {
    font-size: 1.15rem;
  }

  .usuarios-card-subtitle {
    font-size: 0.875rem;
  }

  .usuarios-search-box input {
    height: 44px;
  }
}

/* =========================================================
   CORRECCIÓN FINAL DEL DROPDOWN DE USUARIOS
   ========================================================= */

html, body {
  overflow-x: hidden;
}

.usuarios-table-container {
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
}

.usuarios-table td:last-child {
  width: 76px;
  min-width: 76px;
  position: relative;
}

@media (max-width: 767.98px) {
  .usuarios-actions-menu {
    min-width: 220px;
    max-width: calc(100vw - 24px);
  }
}


/* =========================================================
   PERMISOS - MODAL DE ROLES
   ========================================================= */

.roles-permisos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}


/* Contenedor general */

.roles-permisos-container {
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
}


/* Scroll */

.roles-permisos-container::-webkit-scrollbar {
    width: 7px;
}

.roles-permisos-container::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 10px;
}

.roles-permisos-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.roles-permisos-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* =========================================================
   MÓDULO
   ========================================================= */

.permiso-modulo {
    border-bottom: 1px solid #e2e8f0;
}

.permiso-modulo:last-child {
    border-bottom: none;
}


/* Cabecera */

.permiso-modulo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}


.permiso-modulo-nombre {
    display: flex;
    align-items: center;
    gap: 12px;
}


.permiso-modulo-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    background: #fff1e6;

    color: #f97316;
}


.permiso-modulo-nombre strong {
    display: block;

    font-size: .92rem;
    font-weight: 700;

    color: #1e293b;
}


.permiso-modulo-nombre small {
    display: block;

    margin-top: 2px;

    color: #64748b;

    font-size: .76rem;
}


/* Botón seleccionar */

.btn-seleccionar-modulo {
    border: none;
    background: transparent;

    color: #64748b;

    font-size: .78rem;
    font-weight: 600;

    padding: 5px 8px;

    border-radius: 6px;

    cursor: pointer;

    transition: .2s;
}


.btn-seleccionar-modulo:hover {
    background: #e2e8f0;
    color: #334155;
}


/* =========================================================
   ITEMS
   ========================================================= */

.permiso-modulo-items {
    background: #fff;
}


.permiso-item {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    padding: 13px 18px;

    margin: 0;

    cursor: pointer;

    border-bottom: 1px solid #f1f5f9;

    transition: background .15s ease;
}


.permiso-item:last-child {
    border-bottom: none;
}


.permiso-item:hover {
    background: #fafafa;
}


/* Información */

.permiso-item-info {
    min-width: 0;
}


.permiso-item-vista {
    color: #475569;

    font-size: .86rem;

    font-weight: 600;

    margin-bottom: 2px;
}


.permiso-item-descripcion {
    color: #94a3b8;

    font-size: .75rem;

    line-height: 1.35;
}


/* Acción */

.permiso-item-accion {
    display: flex;

    align-items: center;

    gap: 14px;

    flex-shrink: 0;
}


.permiso-accion-badge {
    display: inline-flex;

    align-items: center;

    padding: 5px 9px;

    border-radius: 999px;

    background: #f1f5f9;

    color: #475569;

    font-size: .72rem;

    font-weight: 700;

    letter-spacing: .02em;
}


.permiso-accion-badge::before {
    content: "";

    width: 5px;
    height: 5px;

    margin-right: 6px;

    border-radius: 50%;

    background: #64748b;
}


/* Checkbox */

.permiso-item .form-check {
    margin: 0;

    padding: 0;
}


.permiso-item .form-check-input {
    width: 18px;
    height: 18px;

    margin: 0;

    cursor: pointer;
}


.permiso-item .form-check-input:checked {
    background-color: #f97316;
    border-color: #f97316;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {

    .roles-permisos-header {
        align-items: flex-start;
    }


    .roles-permisos-container {
        max-height: 360px;
    }


    .permiso-modulo-header {
        padding: 12px;
    }


    .permiso-item {
        padding: 12px;
    }


    .permiso-item-descripcion {
        display: none;
    }


    .permiso-item-accion {
        gap: 8px;
    }


    .permiso-accion-badge {
        font-size: .68rem;
        padding: 4px 7px;
    }

}


@media (max-width: 480px) {

    .roles-permisos-header {
        flex-direction: column;
        align-items: flex-start;
    }


    .permiso-modulo-header {
        align-items: flex-start;
    }


    .btn-seleccionar-modulo {
        font-size: .7rem;
    }


    .permiso-item-vista {
        font-size: .8rem;
    }


    .permiso-item-accion {
        flex-direction: column;
        align-items: flex-end;
        gap: 5px;
    }

}
.sidebar-logo {
    width: 40px;
    height: 32px;
    object-fit: contain;
    display: block;
}
