/* ==========================================================================
   WhatsApp PriceList — sistema visual "SaaS Premium"
   Complementa a Tailwind (CDN) con lo que no conviene generar como utility:
   estados interactivos, burbuja de chat, tabla, tarjeta Pro y animaciones.
   ========================================================================== */

:root {
  --emerald-50:  #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --slate-900:   #0f172a;
  --ring:        rgb(16 185 129 / 0.16);
}

/* ---------- Base ---------- */

body {
  font-feature-settings: "cv11", "ss01";
  text-rendering: optimizeLegibility;
}

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

/* ---------- Ionicons ---------- */

/* Ionicons v7 no distribuye hoja de estilos: ion-icon es un web component que
   se renderiza en Shadow DOM y hereda el color vía currentColor. */
ion-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  flex-shrink: 0;
  pointer-events: none;
  color: inherit;
  fill: currentColor;
}

/* Si el CDN de iconos no carga, los botones siguen siendo operables
   porque todos tienen etiqueta de texto visible. */
ion-icon:not(:defined) { opacity: 0; }

/* ---------- Superficies ---------- */

.card {
  background: #fff;
  border: 1px solid rgb(226 232 240 / 0.8);
  border-radius: 1rem;
  box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.04);
}

/* ---------- Botón primario ---------- */

.btn-primary { position: relative; }

.btn-primary.is-success {
  background-color: var(--emerald-700);
}

/* Check animado tras copiar */
.btn-primary.is-success #copyIcon {
  animation: pop-check 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-check {
  0%   { transform: scale(0.4) rotate(-25deg); opacity: 0; }
  60%  { transform: scale(1.25) rotate(6deg);   opacity: 1; }
  100% { transform: scale(1) rotate(0);         opacity: 1; }
}

/* ---------- Dropzone ---------- */

.dropzone { outline: none; }

.dropzone:focus-visible {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 4px var(--ring);
}

@media (hover: hover) {
  .dropzone:hover {
    border-color: #cbd5e1;
    box-shadow: 0 10px 28px -18px rgb(15 23 42 / 0.35);
  }
  .dropzone:hover ion-icon[name="cloud-upload-outline"] {
    transform: translateY(-3px);
  }
}

/* Arrastrando un archivo encima */
.dropzone.is-dragging {
  border-color: var(--emerald-500);
  background-color: var(--emerald-50);
  transform: scale(1.01);
  box-shadow: 0 18px 40px -22px rgb(5 150 105 / 0.5);
}

.dropzone.is-dragging ion-icon[name="cloud-upload-outline"] {
  transform: translateY(-5px) scale(1.1);
  color: #fff;
}

.dropzone ion-icon {
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

/* Chips de formatos soportados */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
}

.dropzone.is-dragging .file-chip {
  border-color: var(--emerald-500);
  color: var(--emerald-700);
}

/* ---------- Pills de metadatos ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
}

.pill--neutral { background: #f1f5f9; color: #475569; }
.pill--success { background: var(--emerald-50); color: var(--emerald-700); }
.pill--warning { background: #fffbeb; color: #b45309; }
.pill--danger  { background: #fff1f2; color: #be123c; }
.pill--ghost   { background: transparent; color: #94a3b8; }

/* ---------- Selects estilizados ---------- */

.select-wrap { position: relative; }

.field {
  width: 100%;
  appearance: none;
  background-color: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  padding: 0.6rem 2.25rem 0.6rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #0f172a;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field:hover { border-color: #94a3b8; }

.field:focus {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 4px var(--ring);
}

.select-wrap__chevron {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  font-size: 1rem;
  color: #94a3b8;
  pointer-events: none;
}

/* Muestra la letra de columna en negrita dentro de la opción */
.field option { font-size: 0.8125rem; }

/* Chip de celda de ejemplo bajo cada select */
.sample-chip {
  display: block;
  margin-top: 0.4rem;
  padding: 0.3rem 0.55rem;
  border-radius: 0.5rem;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  font-size: 0.7rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-chip strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  color: #0f172a;
}

/* ---------- Tabla de previsualización ---------- */

.preview-table th {
  padding: 0.6rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  white-space: nowrap;
}

.preview-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.8125rem;
  vertical-align: middle;
}

.preview-table tbody tr:last-child td { border-bottom: 0; }

.preview-table tbody tr {
  transition: background-color 0.12s ease;
}

.preview-table tbody tr:hover { background-color: #f8fafc; }

.preview-table .cell-name {
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: #0f172a;
}

.preview-table .num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.preview-table .num--usd { color: #64748b; }

.preview-table .num--ves {
  font-weight: 600;
  color: var(--emerald-700);
}

/* Fila marcados como "se va a ocultar por el límite gratuito" */
.preview-table tbody tr.is-overflow {
  background-image: linear-gradient(90deg, rgb(255 251 235 / 0.85), transparent);
}

.preview-table tbody tr.is-overflow .cell-name,
.preview-table tbody tr.is-overflow .num { opacity: 0.55; }

.preview-table__gap td {
  padding: 0.3rem 1rem;
  color: #cbd5e1;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-align: center;
  background: #f8fafc;
}

.preview-table__more td {
  padding: 0.55rem 1rem;
  background: #fffbeb;
  color: #b45309;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}

/* ---------- Burbuja de WhatsApp ---------- */

.wa-bubble-wrap {
  background:
    radial-gradient(circle at 12px 12px, rgb(15 23 42 / 0.035) 1.6px, transparent 0) 0 0 / 24px 24px,
    #f8fafc;
}

.wa-output {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  border-top-left-radius: 0.3rem;
  padding: 0.9rem 1rem;
  box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 11rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wa-output:focus {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 4px var(--ring);
  outline: none;
}

/* ---------- Badge de tasa BCV ---------- */

.bcv-badge {
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.bcv-badge.is-live {
  border-color: rgb(167 243 208 / 0.9);
  background-color: rgb(236 253 245 / 0.9);
  box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.04);
}

.bcv-badge.is-error {
  border-color: #fecdd3;
  background-color: rgb(255 241 242 / 0.9);
}

/* Punto de "en vivo" */
.bcv-pulse {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background-color: var(--emerald-500);
  animation: bcv-pulse 2.4s ease-in-out infinite;
}

.bcv-badge.is-error .bcv-pulse { background-color: #f43f5e; animation: none; }

@keyframes bcv-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.75); }
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 0.35em;
  vertical-align: -0.1em;
  border: 2px solid rgb(148 163 184 / 0.3);
  border-top-color: var(--emerald-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Tarjeta Pro ---------- */

.pro-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 1.25rem;
  border-radius: 1rem;
  color: #fff;
  background-image: linear-gradient(140deg, #0f172a 0%, #134e4a 55%, #065f46 100%);
  box-shadow: 0 24px 48px -24px rgb(15 23 42 / 0.65);
}

@media (min-width: 640px) {
  .pro-card { padding: 1.75rem; }
}

/* Halo esmeralda */
.pro-card::before {
  content: "";
  position: absolute;
  inset: -60% -20% auto auto;
  z-index: -1;
  width: 20rem;
  height: 20rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgb(16 185 129 / 0.3) 0%, transparent 65%);
  animation: pro-pulse 7s ease-in-out infinite;
}

/* Brillo diagonal */
.pro-card__sheen {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / 0.07) 48%, transparent 62%);
  transform: translateX(-100%);
  animation: pro-sheen 6s ease-in-out 0.8s infinite;
}

@keyframes pro-pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

@keyframes pro-sheen {
  0%        { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .pro-card::before,
  .pro-card__sheen { animation: none; }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
  padding: 0.7rem 1rem;
  transform: translate(-50%, 160%);
  border-radius: 0.85rem;
  background: var(--slate-900);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  box-shadow: 0 18px 40px -14px rgb(15 23 42 / 0.6);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast.is-error   { background: #9f1239; }
.toast.is-success { background: var(--emerald-700); }

/* ---------- Scrollbar ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
  background-color: #cbd5e1;
}

*::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }

/* ---------- Cifras tabulares ---------- */

.font-mono,
.preview-table .num {
  font-variant-numeric: tabular-nums;
}