/* ==========================================================================
   Club Pluma · sistema de diseño
   Morado para acciones e identidad; rosa solo para corazones, premios y descuentos;
   blanco y lavanda para dar aire. Nunito Sans en todo, DM Serif Display en títulos especiales.
   ========================================================================== */
:root {
  --morado: #402568;
  --morado-900: #2D1947;
  --morado-700: #523384;
  --fondo: #F7F0FC;
  --lavanda: #EDE0FA;
  --rosa: #EFA0E0;
  --rosa-claro: #F9DDF5;
  --rosa-texto: #8E2F7C;       /* texto sobre rosa claro con buen contraste */
  --blanco: #FFFFFF;
  --texto: #2D2040;
  --texto-2: #85769A;
  --texto-3: #6E5F84;          /* secundario en tamaños pequeños (más contraste) */
  --borde: #E6D8F4;
  --borde-fuerte: #D6C3EC;
  --exito: #23704F;  --exito-fondo: #E4F3EB;
  --error: #B42318;  --error-fondo: #FDEDEB;
  --alerta: #7A4E00; --alerta-fondo: #FFF3D6;

  --sans: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px;
  --sombra-1: 0 1px 2px rgba(45, 25, 71, .05);
  --sombra-2: 0 1px 2px rgba(45, 25, 71, .04), 0 12px 32px -16px rgba(45, 25, 71, .28);
  --anillo: 0 0 0 3px rgba(64, 37, 104, .22);
  --t-rapida: 140ms cubic-bezier(.2, .7, .3, 1);
  --t-media: 260ms cubic-bezier(.2, .7, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font: 400 16px/1.5 var(--sans); color: var(--texto); background: var(--fondo);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--morado); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--rosa-claro); }
:focus-visible { outline: none; box-shadow: var(--anillo); border-radius: 8px; }

/* ---------- Tipografía ---------- */
.titulo-editorial { font-family: var(--serif); font-weight: 400; letter-spacing: -.005em; line-height: 1.08; text-wrap: balance; }
.t-xl { font-size: clamp(32px, 7vw, 44px); }
.t-l { font-size: clamp(26px, 5vw, 32px); }
.t-m { font-size: 22px; }
.titulo { font-weight: 700; font-size: 20px; line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }
.subtitulo { font-weight: 700; font-size: 16px; line-height: 1.3; }
.etiqueta { font-weight: 500; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--texto-3); }
.texto-2 { color: var(--texto-2); }
.texto-3 { color: var(--texto-3); }
.pequeno { font-size: 14px; }
.mini { font-size: 13px; }
.cifra { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mono { font-family: var(--mono); letter-spacing: .14em; }

/* ---------- Estructura ---------- */
.contenedor { width: 100%; max-width: 480px; margin: 0 auto; padding-inline: 20px; padding-block: 20px 48px; }
.contenedor.ancho { max-width: 1080px; }
.pila { display: flex; flex-direction: column; gap: 16px; }
.pila-s { display: flex; flex-direction: column; gap: 8px; }
.pila-l { display: flex; flex-direction: column; gap: 28px; }
.fila { display: flex; align-items: center; gap: 12px; }
.fila-entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.envolver { flex-wrap: wrap; }
.crece { flex: 1 1 auto; min-width: 0; }
.separador { height: 1px; background: var(--borde); border: 0; margin: 0; }

/* ---------- Marca ---------- */
.marca { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--texto); }
.marca img { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px var(--blanco), 0 0 0 3px var(--borde); }
.marca b { display: block; font-weight: 700; font-size: 16px; line-height: 1.1; }
.marca small { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--texto-3); margin-top: 2px; }

.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 4px 8px; }

/* ---------- Iconos ---------- */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico.s { width: 16px; height: 16px; }
.ico.l { width: 24px; height: 24px; }
.ico.relleno { fill: currentColor; stroke: none; }

/* ---------- Botones ---------- */
.boton {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 20px; border-radius: var(--r-md); border: 1px solid transparent;
  background: var(--morado); color: var(--blanco); font-weight: 600; font-size: 16px; line-height: 1.2;
  text-decoration: none; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background var(--t-rapida), transform var(--t-rapida), box-shadow var(--t-rapida), opacity var(--t-rapida);
}
.boton:hover { background: var(--morado-700); }
.boton:active { transform: scale(.98); background: var(--morado-900); }
.boton:focus-visible { box-shadow: var(--anillo); border-radius: var(--r-md); }
.boton[disabled], .boton[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.boton.bloque { width: 100%; }
.boton.grande { min-height: 60px; font-size: 18px; border-radius: var(--r-lg); }
.boton.peq { min-height: 38px; padding: 8px 14px; font-size: 14px; border-radius: var(--r-sm); }
.boton.sec { background: var(--blanco); color: var(--morado); border-color: var(--borde-fuerte); }
.boton.sec:hover { background: var(--lavanda); }
.boton.sec:active { background: var(--lavanda); }
.boton.rosa { background: var(--rosa); color: var(--morado-900); }
.boton.rosa:hover { background: #E88DD6; }
.boton.texto { background: transparent; color: var(--morado); min-height: 40px; padding: 8px 10px; }
.boton.texto:hover { background: var(--lavanda); }
.boton.peligro { background: var(--blanco); color: var(--error); border-color: #F2C4BE; }
.boton.peligro:hover { background: var(--error-fondo); }
.boton.peligro.lleno { background: var(--error); color: var(--blanco); border-color: var(--error); }
.boton.negro { background: #000; color: #fff; }
.boton.negro:hover { background: #1a1a1a; }
/* Estado de carga: el texto se oculta y aparece un indicador */
.boton[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.boton[aria-busy="true"] > * { visibility: hidden; }
.boton[aria-busy="true"]::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid currentColor; border-color: rgba(255,255,255,.95) rgba(255,255,255,.95) rgba(255,255,255,.25) rgba(255,255,255,.25);
  animation: girar .7s linear infinite;
}
.boton.sec[aria-busy="true"]::after, .boton.texto[aria-busy="true"]::after, .boton.peligro[aria-busy="true"]::after, .boton.rosa[aria-busy="true"]::after {
  border-color: var(--morado) var(--morado) var(--borde) var(--borde);
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .campo > .nombre-campo { font-weight: 600; font-size: 14px; }
.campo .ayuda { font-size: 13px; color: var(--texto-3); }
.entrada {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--borde-fuerte); background: var(--blanco); color: var(--texto); font-size: 16px;
  transition: border-color var(--t-rapida), box-shadow var(--t-rapida);
}
.entrada::placeholder { color: #A99CBB; }
.entrada:hover { border-color: #C8B2E3; }
.entrada:focus { outline: none; border-color: var(--morado); box-shadow: var(--anillo); }
.entrada[aria-invalid="true"] { border-color: var(--error); }
textarea.entrada { min-height: 104px; resize: vertical; line-height: 1.45; }
.con-prefijo { position: relative; }
.con-prefijo .prefijo { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--texto-3); font-weight: 600; pointer-events: none; display: flex; align-items: center; gap: 8px; }
.con-prefijo .entrada { padding-left: var(--pad, 54px); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--texto-3); line-height: 1.45; cursor: pointer; }
.check input { appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border-radius: 7px; border: 1.5px solid var(--borde-fuerte); background: var(--blanco); display: grid; place-content: center; cursor: pointer; transition: background var(--t-rapida), border-color var(--t-rapida); }
.check input::after { content: ""; width: 11px; height: 6px; border: 2px solid var(--blanco); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.check input:checked { background: var(--morado); border-color: var(--morado); }
.check input:checked::after { opacity: 1; }
.check input:focus-visible { box-shadow: var(--anillo); }

/* ---------- Superficies ---------- */
.panel { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--r-lg); padding: 20px; }
.panel.plano { box-shadow: none; }
.panel.elevado { box-shadow: var(--sombra-2); border-color: transparent; }
.panel.compacto { padding: 14px 16px; }
.seccion-titulo { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* ---------- Avisos ---------- */
.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; line-height: 1.45; }
.aviso .ico { margin-top: 1px; }
.aviso.error { background: var(--error-fondo); color: var(--error); }
.aviso.exito { background: var(--exito-fondo); color: var(--exito); }
.aviso.alerta { background: var(--alerta-fondo); color: var(--alerta); }
.aviso.info { background: var(--lavanda); color: var(--morado); }

/* ---------- Chips / estados ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--lavanda); color: var(--morado); white-space: nowrap; }
.chip.rosa { background: var(--rosa-claro); color: var(--rosa-texto); }
.chip.exito { background: var(--exito-fondo); color: var(--exito); }
.chip.alerta { background: var(--alerta-fondo); color: var(--alerta); }
.chip.gris { background: #F1ECF7; color: var(--texto-3); }
.punto { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* Segmentado (filtros y pestañas) */
.segmentado { display: inline-flex; padding: 4px; gap: 2px; background: var(--lavanda); border-radius: 12px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmentado::-webkit-scrollbar { display: none; }
.segmentado button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: none; padding: 8px 14px; min-height: 38px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--texto-3); cursor: pointer; white-space: nowrap; transition: background var(--t-rapida), color var(--t-rapida); }
.segmentado button[aria-selected="true"], .segmentado button[aria-pressed="true"] { background: var(--blanco); color: var(--morado); box-shadow: var(--sombra-1); }
.segmentado.lleno { display: flex; }
.segmentado.lleno button { flex: 1; }

/* ---------- Premio disponible ---------- */
.premio {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--rosa-claro); color: var(--rosa-texto);
}
.premio .icono-premio { width: 40px; height: 40px; border-radius: 12px; background: var(--rosa); color: var(--morado-900); display: grid; place-items: center; flex: none; }
.premio b { display: block; color: var(--morado-900); font-size: 16px; }
.premio small { font-size: 13px; }

/* ==========================================================================
   Tarjeta Club Pluma (pieza principal de la marca)
   ========================================================================== */
.tarjeta-club {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--morado); color: var(--blanco);
  border-radius: var(--r-xl); padding: 20px 20px 18px;
  box-shadow: 0 24px 48px -28px rgba(45, 25, 71, .7);
}
.tarjeta-club::before { /* borde fino interior */
  content: ""; position: absolute; inset: 6px; border-radius: 21px; border: 1px solid rgba(239, 160, 224, .22); pointer-events: none; z-index: -1;
}
.tarjeta-club .pluma-marca { position: absolute; right: -18px; top: -14px; width: 150px; height: 150px; color: var(--rosa); opacity: .14; z-index: -1; transform: rotate(18deg); }
.tarjeta-club .encabezado { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tarjeta-club .programa { display: flex; align-items: center; gap: 10px; }
.tarjeta-club .programa img { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(239, 160, 224, .6); }
.tarjeta-club .programa span { font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.tarjeta-club .contador { margin-top: 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.tarjeta-club .contador .numero { font-family: var(--serif); font-size: 52px; line-height: .9; font-variant-numeric: tabular-nums; }
.tarjeta-club .contador .numero small { font-family: var(--sans); font-size: 18px; font-weight: 600; opacity: .7; margin-left: 2px; }
.tarjeta-club .contador .lbl { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--rosa); font-weight: 700; margin-bottom: 6px; }
.tarjeta-club .duena { text-align: right; min-width: 0; }
.tarjeta-club .duena b { display: block; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.tarjeta-club .duena small { display: block; font-size: 13px; opacity: .72; }
.tarjeta-club .sellos { margin: 14px -6px 4px; }
.tarjeta-club .sellos svg { width: 100%; height: auto; }
.tarjeta-club .proximo { display: flex; align-items: center; gap: 8px; font-size: 14px; color: rgba(255,255,255,.88); }
.tarjeta-club .proximo .ico { color: var(--rosa); }
.tarjeta-club.compacta { padding: 16px 16px 14px; border-radius: var(--r-lg); }
.tarjeta-club.compacta::before { border-radius: 15px; }
.tarjeta-club.compacta .contador { margin-top: 10px; }
.tarjeta-club.compacta .contador .numero { font-size: 40px; }

/* Barra de progreso hacia el próximo premio */
.progreso { height: 6px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.progreso > i { display: block; height: 100%; border-radius: inherit; background: var(--rosa); transition: width var(--t-media); }

/* Animación de corazón nuevo y premio */
@keyframes latido { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }
.latido { animation: latido 420ms cubic-bezier(.2, .7, .3, 1); }
.destello { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: inherit; }
.destello i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--rosa); opacity: 0; animation: chispa 900ms ease-out forwards; }
@keyframes chispa { 0% { opacity: 0; transform: translate(0,0) scale(.4); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1); } }

/* ---------- QR ---------- */
.qr-caja { background: var(--blanco); border-radius: var(--r-lg); border: 1px solid var(--borde); padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qr-caja .qr { width: 220px; max-width: 100%; aspect-ratio: 1; background: #fff; padding: 12px; border-radius: 12px; }
.qr-caja .qr svg, .qr-caja .qr img { width: 100%; height: 100%; }

/* ---------- Listas de actividad ---------- */
.lista { display: flex; flex-direction: column; }
.lista > * + * { border-top: 1px solid var(--borde); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-width: 0; }
.item .icono { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--lavanda); color: var(--morado); }
.item .icono.rosa { background: var(--rosa-claro); color: var(--rosa-texto); }
.item .icono.verde { background: var(--exito-fondo); color: var(--exito); }
.item .cuerpo { flex: 1 1 auto; min-width: 0; }
.item .cuerpo b { display: block; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .cuerpo small { display: block; font-size: 13px; color: var(--texto-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .lado { text-align: right; font-size: 13px; color: var(--texto-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
button.item { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; padding-inline: 8px; margin-inline: -8px; width: calc(100% + 16px); border-radius: 12px; transition: background var(--t-rapida); }
button.item:hover { background: var(--fondo); }

/* Estado vacío */
.vacio { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 16px; color: var(--texto-3); }
.vacio .ico-vacio { width: 56px; height: 56px; border-radius: 50%; background: var(--lavanda); color: var(--morado); display: grid; place-items: center; margin-bottom: 4px; }
.vacio b { color: var(--texto); font-weight: 700; }

/* Cifras agrupadas */
.cifras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cifras > div { padding: 14px 4px 14px 0; }
.cifras > div:nth-child(n+3) { border-top: 1px solid var(--borde); }
.cifras > div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--borde); }
.cifras .cifra { display: block; white-space: nowrap; font-size: clamp(22px, 6vw, 28px); line-height: 1.1; color: var(--texto); }
.cifras .cifra.rosa { color: var(--rosa-texto); }
.cifras span { font-size: 13px; color: var(--texto-3); }
@media (min-width: 720px) {
  .cifras.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cifras.tres > div { border-top: 0 !important; border-left: 1px solid var(--borde); padding-left: 16px; }
  .cifras.tres > div:nth-child(3n+1) { border-left: 0; padding-left: 0; }
  .cifras.tres > div:nth-child(n+4) { border-top: 1px solid var(--borde) !important; }
}

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  transform: translate(-50%, 140%); opacity: 0; visibility: hidden;
  width: min(440px, calc(100% - 32px)); display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: var(--r-md); background: var(--morado-900); color: var(--blanco);
  font-weight: 600; font-size: 15px; box-shadow: 0 16px 40px -12px rgba(45, 25, 71, .55);
  transition: transform var(--t-media), opacity var(--t-media), visibility 0s linear 260ms;
}
.toast.ver { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform var(--t-media), opacity var(--t-media), visibility 0s; }
.toast.premio { background: var(--rosa); color: var(--morado-900); }
.toast.error { background: var(--error); }
.toast .ico { flex: none; }

/* Confirmación en línea (en vez de ventanas del navegador) */
.confirmar { border: 1px solid var(--borde-fuerte); background: var(--blanco); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.confirmar.peligro { border-color: #F2C4BE; background: #FFF8F7; }
.confirmar > .fila .ico { color: var(--morado); margin-top: 2px; }
.confirmar.peligro > .fila .ico { color: var(--error); }
.confirmar .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.confirmar .acciones .boton { flex: 1 1 140px; }

/* Pie */
.pie { text-align: center; font-size: 13px; color: var(--texto-3); padding-top: 8px; }
.pie a { color: var(--texto-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
