/* ── Tokens de marca EasyMat ── */
:root {
  --background: hsl(220 20% 7%);
  --card-bg: hsl(220 15% 12%);
  --card-hover: hsl(220 15% 15%);
  --foreground: hsl(40 10% 95%);
  --muted-foreground: hsl(40 10% 60%);
  --primary-color: #FF8A3D;
  --primary-glow: rgba(255, 138, 61, 0.25);
  --border-color: hsl(220 15% 18%);
  --sidebar-bg: hsl(220 15% 12%);
  --radius-custom: 0.75rem;
  --hero-gradient: linear-gradient(135deg, hsl(220 15% 12%) 0%, hsl(220 20% 18%) 50%, hsl(25 40% 20%) 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  margin: 0;
  background-color: var(--background) !important;
  color: var(--foreground) !important;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.brand-mark,
.kpi-value,
.funnel-num,
.section-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* Contenedor principal */
.max-container {
  max-width: 1320px;
}

/* Header & Footer Custom */
.header-custom {
  background: var(--hero-gradient);
  border-color: var(--border-color) !important;
}

.nav-pills-custom {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
}

.nav-link-custom {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: calc(var(--radius-custom) - 0.25rem);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-link-custom:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link-custom.active {
  color: #12151c !important;
  background: var(--primary-color) !important;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.footer-custom {
  background: var(--sidebar-bg);
  border-color: var(--border-color) !important;
}

.footer-link:hover,
.footer-bit-link:hover {
  color: var(--primary-color) !important;
  text-decoration: underline !important;
}

/* Brand */
.logo-icon {
  height: 38px;
  width: 38px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(255, 138, 61, 0.35));
}

.brand-mark {
  font-weight: 700;
  font-size: 22px;
  background: linear-gradient(135deg, hsl(25 95% 55%), hsl(35 100% 60%), hsl(25 95% 50%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.badge-custom {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 138, 61, 0.12);
  color: var(--primary-color);
  border: 1px solid rgba(255, 138, 61, 0.3);
  padding: 4px 10px;
  border-radius: 50rem;
}

/* Controles & Botones */
.select-custom {
  font-size: 13px;
  border-radius: var(--radius-custom);
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--foreground);
  padding: 6px 14px;
  cursor: pointer;
  accent-color: var(--primary-color);
  transition: all 0.2s ease;
  text-decoration: none;
}

.select-custom:hover {
  background-color: var(--card-bg);
  border-color: var(--primary-color);
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 138, 61, 0.25);
  transform: translateY(-1px);
}

.select-custom:focus,
.select-custom.show {
  background-color: var(--card-bg);
  color: var(--foreground);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(255, 138, 61, 0.25);
  outline: none;
}

.select-custom option {
  background-color: #12151c;
  color: #e8e3d8;
  padding: 8px 12px;
}

/* Hover, Focus, Checked y Active en opciones */
.select-custom option:hover,
.select-custom option:focus,
.select-custom option:active,
.select-custom option:checked {
  background-color: #FF8A3D !important;
  background: #FF8A3D !important;
  color: #12151c !important;
  font-weight: 700;
}

.btn-custom {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: #12151c !important;
  font-weight: 600;
  border-radius: var(--radius-custom);
  padding: 6px 14px;
  transition: all 0.2s ease-in-out;
}

.btn-custom:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 16px var(--primary-glow);
}

.btn-logout {
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-custom);
  transition: all 0.2s ease-in-out;
}

.btn-logout:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.4);
}

.user-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 50rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.user-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(255, 138, 61, 0.25);
  transform: translateY(-1px);
}

.dropdown-menu-custom {
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 0.75rem !important;
  min-width: 210px;
  padding: 0.5rem 0.35rem;
  margin-top: 0.5rem !important;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
}

.dropdown-menu-custom::-webkit-scrollbar {
  width: 6px;
}
.dropdown-menu-custom::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}
.dropdown-menu-custom::-webkit-scrollbar-thumb {
  background: rgba(255, 138, 61, 0.35);
  border-radius: 4px;
}
.dropdown-menu-custom::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

.dropdown-menu-custom .dropdown-item {
  border-radius: 0.5rem;
  color: var(--foreground);
  font-size: 0.875rem;
  transition: all 0.15s ease;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
}

.dropdown-menu-custom .dropdown-item:hover,
.dropdown-menu-custom .dropdown-item:focus {
  background-color: var(--primary-color) !important;
  color: #12151c !important;
  font-weight: 600;
}

.dropdown-menu-custom .dropdown-item:hover svg,
.dropdown-menu-custom .dropdown-item:hover i,
.dropdown-menu-custom .dropdown-item:focus svg,
.dropdown-menu-custom .dropdown-item:focus i {
  color: #12151c !important;
  stroke: #12151c !important;
}

.dropdown-menu-custom .dropdown-item.active {
  background: var(--primary-color) !important;
  color: #12151c !important;
  font-weight: 700;
}

.dropdown-menu-custom .dropdown-item.active svg,
.dropdown-menu-custom .dropdown-item.active i {
  color: #12151c !important;
  stroke: #12151c !important;
}

.dropdown-menu-custom .item-logout:hover,
.dropdown-menu-custom .item-logout:focus {
  background: rgba(220, 38, 38, 0.2) !important;
  color: #f87171 !important;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-superadmin {
  background: linear-gradient(135deg, #FF8A3D, #F2542D);
  box-shadow: 0 0 8px rgba(255, 138, 61, 0.4);
}

.avatar-invitado {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.badge-role-superadmin {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 138, 61, 0.2);
  color: #FF8A3D;
  border: 1px solid rgba(255, 138, 61, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-role-invitado {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Sticky footer rules */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

.footer-custom {
  flex-shrink: 0;
  margin-top: auto !important;
}

/* Cards & KPIs */
.card-custom,
.card-kpi {
  background-color: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-custom) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-kpi {
  cursor: pointer;
}

.card-kpi:hover,
.card-custom:hover {
  border-color: rgba(255, 138, 61, 0.4) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 12px rgba(255, 138, 61, 0.08);
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 6px;
  font-weight: 600;
  transition: color 0.2s ease;
}

.card-kpi:hover .kpi-label {
  color: var(--primary-color);
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
}

.text-primary-custom {
  color: var(--primary-color) !important;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0;
}

.card-subtitle-custom {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  transition: color 0.2s ease;
}

.card-custom:hover .card-subtitle-custom {
  color: var(--primary-color);
}

/* Charts */
.chart-wrap {
  height: 260px;
  position: relative;
  width: 100%;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  font-size: 12px;
  text-align: center;
  padding: 0 20px;
  pointer-events: none;
}

/* Embudo */
.funnel-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 260px;
  flex-wrap: wrap;
}

.funnel-step {
  text-align: center;
}

.funnel-num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.funnel-num.primary {
  color: var(--primary-color);
}

.funnel-label {
  font-size: 11px;
  color: var(--muted-foreground);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.funnel-arrow {
  font-size: 20px;
  color: var(--muted-foreground);
}

.funnel-rate {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-color);
  background: rgba(255, 138, 61, 0.1);
  border: 1px solid rgba(255, 138, 61, 0.25);
  border-radius: 50rem;
  padding: 4px 12px;
}

/* Loading Bar */
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--primary-color);
  transition: width 0.3s ease;
  box-shadow: 0 0 12px var(--primary-glow);
  z-index: 1050;
}

/* Modales & Formularios Compartidos */
.modal-backdrop {
  background-color: rgba(10, 14, 23, 0.75) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop.show {
  opacity: 1 !important;
}

/* Ocultar barras de scroll cuando se levanta un modal/diálogo */
html:has(body.modal-open),
body.modal-open {
  overflow: hidden !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  padding-right: 0 !important;
}

html:has(body.modal-open)::-webkit-scrollbar,
body.modal-open::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Barra de desplazamiento (scrollbar) estilizada para los diálogos/modales */
.modal {
  overflow-y: auto !important;
  scrollbar-width: thin !important;
  scrollbar-color: rgba(255, 138, 61, 0.4) hsl(220 15% 10%);
}

.modal::-webkit-scrollbar {
  display: block !important;
  width: 8px !important;
}

.modal::-webkit-scrollbar-track {
  background: hsl(220 15% 10%);
  border-radius: 4px;
}

.modal::-webkit-scrollbar-thumb {
  background: rgba(255, 138, 61, 0.35);
  border-radius: 4px;
  border: 1px solid rgba(255, 138, 61, 0.2);
}

.modal::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
  box-shadow: 0 0 8px var(--primary-glow);
}

.modal-dialog-scrollable .modal-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 138, 61, 0.4) hsl(220 15% 10%);
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar {
  display: block;
  width: 6px;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 138, 61, 0.35);
  border-radius: 4px;
}

/* Fondo para diálogos modales de Bootstrap */
body.modal-open > header,
body.modal-open > main,
body.modal-open > footer {
  filter: blur(4px) brightness(0.7);
  transition: filter 0.2s ease-out;
  pointer-events: none;
  user-select: none;
}

/* SweetAlert2 Toast Containers: Garantizar 100% fondo transparente y sin blur */
.swal2-container.swal2-top-end,
.swal2-container.swal2-toast-shown,
.swal2-container.swal2-no-backdrop,
.swal2-toast-container {
  background: transparent !important;
  background-color: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: none !important;
}

.swal2-popup.swal2-toast {
  pointer-events: auto !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7), 0 0 15px rgba(56, 189, 248, 0.2) !important;
}

/* SweetAlert2 Backdrop exclusivo para Modales completos (no Toasts) */
.swal2-container:not(.swal2-toast-container):not(.swal2-no-backdrop):not(.swal2-top-end).swal2-backdrop-show {
  background: rgba(10, 14, 23, 0.75) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content-custom {
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 1rem !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85), 0 0 20px rgba(255, 138, 61, 0.1);
}

.form-control-custom {
  background-color: hsl(220 18% 9%) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-custom) !important;
  color: #fff !important;
  padding: 0.65rem 0.9rem;
  font-size: 0.925rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control-custom:focus {
  background-color: hsl(220 18% 11%) !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
  color: #fff !important;
}

/* ── Responsive Header UX/UI ── */
@media (max-width: 767.98px) {
  .header-custom {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(18, 21, 28, 0.95);
  }

  .logo-icon {
    height: 32px;
    width: 32px;
  }

  .brand-mark {
    font-size: 19px;
  }

  .user-badge {
    padding: 3px 8px;
  }

  .user-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .mobile-nav-pills {
    flex-grow: 1;
  }

  .mobile-nav-pills .nav-link-custom {
    flex: 1;
    justify-content: center;
    padding: 5px 10px;
    font-size: 12px;
  }

  .mobile-dashboard-controls {
    flex-grow: 1;
    justify-content: flex-end;
  }

  .mobile-dashboard-controls .select-custom {
    min-width: 95px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .mobile-dashboard-controls .btn-custom {
    padding: 4px 10px;
    font-size: 12px;
  }

  .dropdown-menu-custom {
    min-width: 220px;
  }
}