/* =====================================================================
   Catálogo (pages/catalog.js) — mismo diseño que las cards de winoptima.es:
   imagen con fundido, etiqueta, kicker, nombre, características con check y
   botón. Packs destacados en horizontal (violeta); el resto en cuadrícula.
   Full: brillo y elevación al pasar el ratón. Lite (perf-lite): paneles
   lisos, sin sombras grandes, sin zoom ni transiciones.
   ===================================================================== */
.ct-wrap {
  --ct-text: #f2f2f3; --ct-muted: rgba(245,245,247,.82); --ct-dim: rgba(245,245,247,.58);
  display: flex; flex-direction: column; gap: 26px; color: var(--ct-text);
  container-type: inline-size;
}
.ct-head { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 0; }
.ct-head > div { flex: 1 1 360px; min-width: 0; }
.ct-label {
  display: inline-block; margin-bottom: 8px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  background: linear-gradient(90deg, #e5e5e5, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ct-group { scroll-margin-top: 20px; }
.ct-group-title { margin: 0 0 12px 2px; font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ct-dim); }
.ct-stack { display: flex; flex-direction: column; gap: 18px; }
.ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 18px; }

/* ── Card ── */
.ct-card {
  --rgb: 59,130,246;
  position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: 18px;
  background:
    radial-gradient(130% 65% at 50% -18%, rgba(var(--rgb),.07) 0%, transparent 60%),
    linear-gradient(165deg, rgba(12,12,13,.96) 0%, rgba(8,8,8,.98) 100%);
  border: 1px solid rgba(var(--rgb),.18);
  transition: border-color .3s ease, transform .35s cubic-bezier(.19,.72,.28,1), box-shadow .35s ease;
}
.ct-violet { --rgb: 167,139,250; }
.ct-card:hover {
  border-color: rgba(var(--rgb),.5); transform: translateY(-4px);
  box-shadow: 0 22px 44px -16px rgba(0,0,0,.6), 0 0 36px -8px rgba(var(--rgb),.25);
}
.ct-img { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0a0a0a; }
.ct-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.19,.72,.28,1); }
.ct-card:hover .ct-img img { transform: scale(1.04); }
.ct-fade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(8,8,8,0) 45%, rgba(8,8,8,.6) 80%, rgba(8,8,8,.97) 100%); }
.ct-body { position: relative; flex: 1; display: flex; flex-direction: column; padding: 16px 20px 20px; }
.ct-badge {
  align-self: flex-start; margin-bottom: 10px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: #ede9fe; background: rgba(139,92,246,.22); border: 1px solid rgba(167,139,250,.45);
}
.ct-blue .ct-badge { color: #dbeafe; background: rgba(245,245,245,.2); border-color: rgba(229,229,229,.45); }
.ct-kicker { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ct-dim); margin-bottom: 6px; }
.ct-card:hover .ct-kicker { color: rgb(var(--rgb)); }
.ct-name { margin: 0 0 8px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.ct-desc {
  margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--ct-muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ct-feats { list-style: none; margin: auto 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ct-feats li { position: relative; padding-left: 24px; font-size: 13px; line-height: 1.45; color: rgba(245,245,247,.88); }
.ct-feats li::before {
  /* Check como imagen de fondo (no máscara): se rasteriza una vez y no crea capas extra */
  content: ''; position: absolute; left: 0; top: 1px; width: 15px; height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.2 2.4 2.4 4.6-4.9'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ct-violet .ct-feats li::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.2 2.4 2.4 4.6-4.9'/%3E%3C/svg%3E"); }
.ct-note { display: flex; gap: 8px; margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; font-size: 12px; line-height: 1.5; color: #fde68a; background: rgba(251,191,36,.07); border: 1px solid rgba(251,191,36,.22); }
.ct-note svg { flex: none; margin-top: 2px; }
.ct-note a { color: #fcd34d; font-weight: 600; }

/* ── Botones ── */
.ct-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  font: inherit; font-size: 13.5px; font-weight: 600; color: #fff; cursor: pointer; border-radius: 10px;
  border: 1px solid rgba(var(--rgb, 59,130,246),.5);
  background: linear-gradient(135deg, rgba(var(--rgb, 59,130,246),.28), rgba(var(--rgb, 59,130,246),.1));
  transition: border-color .25s ease, background .25s ease, filter .2s ease;
}
.ct-card .ct-btn { margin-top: auto; }
.ct-card:hover .ct-btn { border-color: rgba(var(--rgb),.8); background: linear-gradient(135deg, rgba(var(--rgb),.4), rgba(var(--rgb),.16)); }
.ct-btn svg { transition: transform .25s ease; }
.ct-btn:hover svg, .ct-card:hover .ct-btn svg { transform: translate(2px, -2px); }
.ct-btn:focus-visible { outline: 2px solid #e5e5e5; outline-offset: 2px; }
.ct-btn-ghost { --rgb: 96,165,250; }

/* ── Packs destacados: imagen a la derecha y botón relleno ── */
.ct-big { flex-direction: row-reverse; min-height: 290px; }
.ct-big .ct-img { width: 50%; flex: none; aspect-ratio: auto; }
.ct-big .ct-fade { background: linear-gradient(90deg, rgba(6,6,7,.98) 0%, rgba(6,6,7,.5) 22%, rgba(6,6,7,0) 48%); }
.ct-big .ct-body { padding: 24px 26px; justify-content: center; }
.ct-big .ct-name { font-size: 21px; }
.ct-big .ct-desc { -webkit-line-clamp: 4; }
.ct-big .ct-feats { margin-top: 0; }
.ct-big .ct-btn {
  align-self: flex-start; margin-top: 0; min-width: 220px; border-color: transparent;
  background: linear-gradient(135deg, #f5f5f5, #4f46e5); box-shadow: 0 8px 24px -10px rgba(245,245,245,.7);
}
.ct-big:hover .ct-btn { border-color: transparent; background: linear-gradient(135deg, #f5f5f5, #4f46e5); filter: brightness(1.1); }
@container (max-width: 660px) {
  .ct-big { flex-direction: column; }
  .ct-big .ct-img { width: 100%; aspect-ratio: 16 / 9; }
  .ct-big .ct-fade { background: linear-gradient(180deg, rgba(6,6,7,0) 45%, rgba(6,6,7,.97) 100%); }
}
.ct-foot { margin: 0 2px; font-size: 12.5px; color: var(--ct-dim); }

/* ── Servicios remotos: card compacta (lo justo) ── */
.ct-compact .ct-img { aspect-ratio: 16 / 8; }
.ct-compact .ct-body { padding: 14px 18px 18px; }
.ct-compact .ct-badge { margin-bottom: 8px; }
.ct-compact .ct-name { font-size: 15px; }
.ct-compact .ct-desc { -webkit-line-clamp: 2; margin-bottom: 12px; }
.ct-compact .ct-feats { margin-top: 0; margin-bottom: 12px; gap: 6px; }
.ct-note-mini { padding: 0; border: 0; background: none; margin: 0 0 14px; font-size: 11.5px; }
.ct-compact .ct-btn { margin-top: auto; min-height: 38px; }

/* ── Lite: mismo diseño, pintado barato ── */
.perf-lite .ct-card { background: #111111; transform: none; box-shadow: none; }
.perf-lite .ct-card:hover { transform: none; box-shadow: none; }
.perf-lite .ct-card:hover .ct-img img { transform: none; }
.perf-lite .ct-big .ct-btn { box-shadow: none; }

/* ══ Carrito y compra — paleta de la app (tokens de themes.css) ════════════ */
.ct-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ct-actions .btn { min-height: 38px; }
.ct-actions .btn svg { flex: none; }
/* Carrito flotante: fijo arriba a la derecha (bajo la barra de título) */
.ct-head { padding-right: 150px; }
.ct-cart-btn {
  position: fixed; z-index: 800; top: 74px; right: 24px; min-height: 40px;
  background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text);
  box-shadow: var(--shadow);
}
.ct-cart-btn svg { flex: none; }
.perf-lite .ct-cart-btn { box-shadow: none; }
.ct-btn[hidden], .ct-actions .btn[hidden] { display: none; }
.ct-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #0f0f0f; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.ct-count[hidden] { display: none; }
.ct-price { margin: 0 0 12px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: #fff; }
.ct-price span { margin-left: 3px; font-size: 13px; font-weight: 500; color: var(--ct-dim); }
.ct-big .ct-price { font-size: 24px; }
.ct-compact .ct-price { margin-top: auto; }
.ct-card .ct-btn { position: relative; }
.ct-btn-label, .ct-btn-done { display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: opacity .2s ease, transform .25s ease; }
.ct-btn-done { position: absolute; inset: 0; opacity: 0; transform: translateY(8px); }
.ct-btn.is-added .ct-btn-label { opacity: 0; transform: translateY(-8px); }
.ct-btn.is-added .ct-btn-done { opacity: 1; transform: translateY(0); }
.ct-card .ct-btn-label svg, .ct-card .ct-btn-done svg { transform: none !important; }

.ct-cart {
  position: fixed; z-index: 900; top: 80px; right: 16px; width: min(380px, calc(100vw - 32px)); max-height: min(540px, calc(100vh - 96px));
  display: flex; flex-direction: column; overflow: hidden; color: var(--text); outline: none;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.06);
  opacity: 0; visibility: hidden; transform: translateY(-10px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.ct-cart.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.ct-cart-close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
  background: transparent; border: 1px solid var(--border);
}
.ct-cart-close:hover { color: var(--text); background: var(--bg-hover); border-color: var(--border-strong); }
.ct-cart-head { padding: 22px 22px 0; }
.ct-cart-kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }
.ct-cart-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.ct-cart-scroll { flex: 1; overflow-y: auto; padding: 0 22px; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.ct-cart-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.ct-cart-empty { padding: 22px 0 26px; text-align: center; font-size: 13px; color: var(--text-dim); }
.ct-item {
  position: relative; display: grid; grid-template-columns: 64px minmax(0,1fr) auto;
  grid-template-areas: "img info del" "img qty sub"; gap: 6px 14px; align-items: center;
  padding: 12px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-surface);
}
.ct-item-thumb { grid-area: img; position: relative; align-self: stretch; min-height: 64px; border-radius: var(--radius); overflow: hidden; background: #0a0a0a; border: 1px solid var(--border); }
.ct-item-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ct-item-badge { position: absolute; top: 4px; left: 4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #0f0f0f; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ct-item-info { grid-area: info; min-width: 0; }
.ct-item-kicker { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-item-name { font-size: 13px; font-weight: 700; line-height: 1.25; margin-bottom: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ct-item-price { font-size: 11px; color: var(--text-dim); }
.ct-item-qty { grid-area: qty; justify-self: start; display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--bg-inset); border: 1px solid var(--border); }
.ct-item-qty button { width: 22px; height: 22px; border-radius: 50%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.ct-item-qty button:hover { background: var(--bg-hover); }
.ct-item-qty span { min-width: 20px; text-align: center; font-size: 12px; }
.ct-item-sub { grid-area: sub; justify-self: end; font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.ct-item-del { grid-area: del; align-self: start; justify-self: end; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 13px; line-height: 1; color: var(--text-muted); background: transparent; border: 1px solid var(--border); }
.ct-item-del:hover { color: var(--danger); background: rgba(255,82,82,.09); border-color: rgba(255,82,82,.28); }
.ct-cart-foot { padding: 16px 22px 20px; border-top: 1px solid var(--divider); }
.ct-cart-total { display: flex; align-items: baseline; justify-content: space-between; font-size: 14px; font-weight: 700; }
.ct-cart-total span:last-child { font-size: 18px; color: var(--text); }
.ct-cart-pay { width: 100%; justify-content: center; margin-top: 14px; padding: 12px 20px; font-size: 13.5px; }
.ct-cart-pay.is-busy { opacity: .75; cursor: progress; }
.ct-cart-note { margin: 12px 0 0; font-size: 12px; line-height: 1.55; text-align: center; color: var(--text-muted); }

/* ── Confirmación del pago / resultado (como los modales de la app) ── */
.ct-ov {
  position: fixed; inset: 0; z-index: 950; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: var(--bg-overlay); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.ct-ov-box {
  width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 26px 26px 22px; text-align: center; color: var(--text);
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.08);
}
.ct-ov-box h3 { margin: 0 0 10px; font-size: 17px; font-weight: 700; }
.ct-ov-box p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.6; color: var(--text-muted); }
.ct-ov-box p b { color: var(--text); }
.ct-ov-sub { font-size: 12px !important; color: var(--text-dim) !important; }
.ct-ov-spin { width: 34px; height: 34px; margin: 4px auto 16px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: ctSpin .8s linear infinite; }
@keyframes ctSpin { to { transform: rotate(360deg); } }
.ct-ov-ok { width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #0f0f0f; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%); }
.ct-ov-ok svg { width: 22px; height: 22px; }
.ct-ov-id, .ct-ov-key { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius); text-align: left; background: var(--bg-inset); border: 1px solid var(--border); }
.ct-ov-id span { font-size: 11px; color: var(--text-dim); }
.ct-ov-id b, .ct-ov-key code { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.ct-ov-copy { flex: none; }
.ct-ov-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

.perf-lite .ct-cart, .perf-lite .ct-ov-box { box-shadow: none; transition: none; }
.perf-lite .ct-ov { backdrop-filter: none; -webkit-backdrop-filter: none; }
@media (prefers-reduced-motion: reduce) { .ct-cart, .ct-btn-label, .ct-btn-done { transition: none; } .ct-ov-spin { animation-duration: 2s; } }
