/* ============================================================
   BASE — LENTIFLIX
   Tokens globales + componentes compartidos por todos los módulos.
   NO tocar login.css: tiene su propio scope aislado.
   ============================================================ */

/* ─── Reset de modelo de caja (border-box global) ───────────── */
*, *::before, *::after { box-sizing: border-box; }

/* Reserva el hueco de la barra de scroll: la cabecera ya no "salta" al cambiar de página (G-14) */
html { scrollbar-gutter: stable; }

/* Los textarea no heredan la fuente por defecto (salía letra de máquina de escribir) (G-6) */
textarea { font-family: inherit; }

/* Placeholders con contraste suficiente (G-10) */
::placeholder { color: var(--color-muted); opacity: 1; }

/* Anillo de foco al navegar con teclado (G-7): azul sobre fondo claro, blanco sobre las cabeceras azules */
:focus-visible {
  outline: 2px solid var(--color-primary) !important;
  outline-offset: 2px !important;
}
:is(.app-header, .modal-head, .lfx-modal__head, .modal-semana-head, .modal-header) :focus-visible {
  outline-color: #fff !important;
}

:root {
  /* ─── Color primario (azul Lentiflix) ──────────────────── */
  --color-primary:        #1f4fd8;
  --color-primary-dark:   #1743b0;
  --color-primary-soft:   rgba(31, 79, 216, 0.10);
  --color-primary-border: rgba(31, 79, 216, 0.18);
  --color-primary-light:  #dbeafe;

  /* ─── Fondos ────────────────────────────────────────────── */
  --color-bg:        #f4f7fb;
  --color-card:      #ffffff;
  --color-card-soft: #f8fafc;

  /* ─── Texto ─────────────────────────────────────────────── */
  --color-text:      #0f172a;
  --color-text-soft: #475569;
  --color-muted:     #64748b;

  /* ─── Bordes ────────────────────────────────────────────── */
  --color-border:      #e2e8f0;
  --color-border-soft: #edf2f7;

  /* ─── Semánticos ────────────────────────────────────────── */
  --color-danger:         #dc2626;
  --color-danger-soft:    #fef2f2;
  --color-danger-border:  #fecaca;
  --color-success:        #16a34a;
  --color-success-soft:   #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-warning:        #f59e0b;

  /* ─── Hover de filas de tabla ───────────────────────────── */
  --color-resaltado: #f0f5ff;

  /* ─── Radios ────────────────────────────────────────────── */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 18px;

  /* ─── Sombras ───────────────────────────────────────────── */
  --shadow-xs:   0 1px 2px  rgba(15, 23, 42, .04);
  --shadow-sm:   0 4px 12px rgba(15, 23, 42, .06);
  --shadow-md:   0 8px 24px rgba(15, 23, 42, .08);
  --shadow-lg:   0 20px 60px rgba(15, 23, 42, .18);

  /* ─── Espaciado ─────────────────────────────────────────── */
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;

  /* ─── Tipografía ────────────────────────────────────────── */
  --font-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* ─── Aliases de compatibilidad (tokens heredados) ──────── */
  /* Algunos módulos aún referencian estos nombres */
  --lfx-card:     var(--color-card);
  --lfx-border:   var(--color-border);
  --lfx-radius:   var(--radius-md);
  --lfx-shadow-2: var(--shadow-sm);
  --lfx-muted:    var(--color-muted);
  --lfx-text:     var(--color-text);

  /* dashboard.css legacy */
  --card:        var(--color-card);
  --border:      var(--color-border);
  --radius:      var(--radius-md);
  --shadow-soft: var(--shadow-sm);
  --shadow:      var(--shadow-sm);
  --white:       #ffffff;
  --text:        var(--color-text);
  --muted:       var(--color-muted);
}

/* ─── Iconos de estado ──────────────────────────────────────── */
.icon-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}
.icon-status svg {
  width: 32px;
  height: 32px;
}
.btn-portal-link,
.btn-portal-wassap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  vertical-align: middle;
  padding-left: 7px;
  padding-right: 7px;
}
.btn-portal-link .icon-status,
.btn-portal-wassap .icon-status {
  width: 1.4em;
  height: 1.4em;
}

/* ─── Badge ID de cliente ───────────────────────────────────── */
.client-id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px var(--color-primary-soft);
  text-decoration: none;
  transition: box-shadow .18s ease;
}
.client-id-badge:hover {
  box-shadow: 0 4px 14px rgba(31, 79, 216, .28);
}

/* ─── Botón base ────────────────────────────────────────────── */
.btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:hover {
  background: var(--color-primary-dark);
}

/* ─── Botón suave azul (tres aliases al mismo estilo) ───────── */
.boton-accion,
.btn-soft-client,
.btn-soft {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
  transition: background .18s ease;
}
.boton-accion:hover,
.btn-soft-client:hover,
.btn-soft:hover {
  background: #dbeafe;
}

/* Desactivado (p. ej. "« Anterior" en la primera página) (P-1) */
.boton-accion:disabled,
.btn-soft-client:disabled,
.btn-soft:disabled {
  opacity: .45;
  cursor: not-allowed;
  background: #eff6ff;
}

/* Variante ámbar (envío a domicilio / stock) */
.action--envio,
.tiene-stock {
  background: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .28);
  color: #92400e;
}
.action--envio:hover,
.tiene-stock:hover {
  background: rgba(245, 158, 11, .22);
}

/* ─── Botones de filtro/toolbar ─────────────────────────────── */
/* Fuente única de verdad para btn-filter* en toda la app */
.btn-filter {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease;
}
.btn-filter-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: transparent;
}
.btn-filter-primary:hover {
  background: var(--color-primary-dark);
}
.btn-filter-soft,
.btn-limpiar {
  background: #fff;
  border-color: var(--color-border);
  color: var(--color-muted);
}
.btn-filter-soft:hover,
.btn-limpiar:hover {
  background: var(--color-card-soft);
  border-color: #cbd5e1;
}

.bulk-action--hidden {
  display: none !important;
}

/* ─── Botón peligro ─────────────────────────────────────────── */
.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover {
  background: var(--color-danger);
}

/* ─── Botón suave verde ─────────────────────────────────────── */
.btn-soft-success {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #16a34a;
  transition: background .18s ease;
}
.btn-soft-success:hover {
  background: #dcfce7;
}

/* ─── Botón suave rojo ──────────────────────────────────────── */
.btn-soft-danger {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: #dc2626;
  transition: background .18s ease;
}
.btn-soft-danger:hover {
  background: #fee2e2;
}

/* ─── Input global ──────────────────────────────────────────── */
.input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: .95rem;
  outline: none;
  background: var(--color-card-soft);
  color: var(--color-text);
  font-family: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.input:focus {
  background: #fff;
  border-color: var(--color-primary-border);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
}

/* ─── Checkbox ──────────────────────────────────────────────── */
input[type="checkbox"] {
  width: 18px !important;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ─── Check-pill (toggle de filtros) ───────────────────────── */
.check-pill {
  display: inline-flex;
  align-items: center;
  background: #eef1fb;
  border-radius: var(--radius-md);
  padding: 4px;
  cursor: pointer;
  border: none;
  margin-top: auto;
}
.check-pill span {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--color-text-soft);
  transition: background .15s ease, color .15s ease;
}
.check-pill input:checked ~ span {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 3px var(--color-primary-soft);
}
/* Oculto a la vista pero no al teclado (con display:none no se podía usar con Tab) (G-9) */
.check-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.check-pill input:focus-visible ~ span {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ─── Filtros avanzados (acordeón) — compartido ─────────────── */
.filtros-avanzados {
  margin-top: 10px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.filtros-avanzados > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.filtros-avanzados > summary::-webkit-details-marker { display: none; }
.filtros-avanzados__chevron {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--color-muted);
  transition: transform .18s ease;
}
.filtros-avanzados[open] > summary .filtros-avanzados__chevron {
  transform: rotate(180deg);
}
.filtros-avanzados[open] > summary {
  border-bottom: 1px solid var(--color-border);
}
.filtros-avanzados__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  padding: 18px 20px;
}
.fa-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.fa-field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--color-muted);
}
.fa-field select {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 9px 10px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-card-soft);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fa-field select:focus {
  border-color: var(--color-primary-border);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
}
.fa-field select:disabled {
  background: rgba(15, 23, 42, .05);
  color: var(--color-muted);
  cursor: not-allowed;
}

/* ─── Tabla global ──────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  background: var(--color-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}
table thead th,
table tr th {
  text-align: center;
  font-weight: 700;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-primary);
  padding: 12px 10px;
  border-bottom: 1px solid var(--color-primary);
  background: #eef3fd;
}
table td {
  padding: 12px 10px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(0, 0, 0, .04);
  color: var(--color-text);
  text-align: center;
  font-size: larger;
}
table tr:last-child td {
  border-bottom: none;
}
table tbody tr:hover {
  background: var(--color-resaltado);
}

/* ─── Badge de días ─────────────────────────────────────────── */
.badge-dias {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 28px;
  padding: 0 12px;
  font-size: 1em;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-sm);
}

/* ─── Fila resaltada ────────────────────────────────────────── */
.row-highlight {
  background: linear-gradient(
    90deg,
    rgba(31, 79, 216, .12),
    rgba(31, 79, 216, .05)
  );
  position: relative;
}

/* ─── Título de página (Dashboard, Administración, Mi cuenta…) ─ */
.pagina-titulo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px;
}

/* ─── Fila de cliente suspendido ────────────────────────────── */
/* Fondo suave (no rojo intenso) para que los iconos de suscrito y WhatsApp se sigan viendo */
table tbody tr.fila-suspendida {
  background: var(--color-danger-soft);
}
table tbody tr.fila-suspendida:hover {
  background: #fee2e2;
}
table tbody tr.fila-suspendida > td:first-child {
  box-shadow: inset 4px 0 0 var(--color-danger);
}
.etiqueta-suspendido {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: #fee2e2;
  border: 1px solid var(--color-danger-border);
  color: #991b1b;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

/* ─── Precio en footer de modal ─────────────────────────────── */
.modal-foot-precio {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  margin-right: auto;
}
.precio-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
}
.precio-chip + .precio-chip {
  border-left: 1px solid #e2e8f0;
}
.precio-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--color-muted);
}
.precio-valor {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-success);
}
.modal-foot-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

/* ─── Validación de formularios ─────────────────────────────── */
input.error,
select.error {
  border: 2px solid var(--color-danger) !important;
  background-color: var(--color-danger-soft) !important;
  animation: shake .3s ease;
}
.error-message {
  color: var(--color-danger);
  font-size: .85em;
  margin-top: 4px;
  display: block;
  animation: fadeInDown .3s ease;
}
label:has(+ input.error),
label:has(+ select.error) {
  color: var(--color-danger);
  font-weight: 600;
}
input:focus:invalid,
select:focus:invalid {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .10);
}

/* ─── Producto no apto para suscripción ─────────────────────── */
.producto-no-apto {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, .12);
  background: var(--color-danger-soft);
}
.subscription-alert,
#aviso-no-apto-suscripcion {
  display: none;
  margin: 10px 24px 12px;
  width: min(760px, calc(100% - 48px));
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid #f3c7c7;
  border-left: 3px solid #ef4444;
  background: #fff7f7;
  color: #7f1d1d;
}
.subscription-alert.is-visible,
#aviso-no-apto-suscripcion.is-visible {
  display: block;
}
.subscription-alert__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.subscription-alert__icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-weight: 700;
  font-size: .74rem;
  flex: 0 0 auto;
  margin-top: 2px;
}
.subscription-alert__content {
  min-width: 0;
}
.subscription-alert__title {
  font-size: .93rem;
  font-weight: 700;
  line-height: 1.25;
  color: #991b1b;
}
.subscription-alert__text {
  margin: 2px 0 0;
  font-size: .88rem;
  line-height: 1.35;
  color: #7f1d1d;
}
.subscription-alert__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.subscription-alert__chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #f3cece;
  background: #fff;
  color: #b91c1c;
  font-size: .78rem;
  font-weight: 600;
}

/* ─── Modal close button global ─────────────────────────────── */
#modal-close {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .25);
  color: #fff;
}
#modal-close:hover { filter: brightness(.97); }

/* ─── Animaciones globales ──────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-5px); }
  75%       { transform: translateX(5px); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

