/* KindMX v2: componentes compartidos. Valores tomados de los bocetos. */

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: var(--r-pill); border: 0;
  font: 700 16px/1 var(--font-ui); text-decoration: none; white-space: nowrap;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-night); }
.btn-primary:hover { background: var(--accent-strong); color: var(--on-night); }
.btn-outline { background: var(--paper); border: 1.5px solid var(--accent); color: var(--accent-strong); }
.btn-outline:hover { background: var(--accent-wash); color: var(--accent-strong); }
.btn-danger { background: var(--paper); border: 1.5px solid var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn-lg { height: 52px; font-size: 17px; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Sobre --night */
.btn-glass { height: 44px; padding: 0 18px; border: 1px solid var(--glass-line-2); background: var(--glass); color: var(--on-night); font: 600 15px/1 var(--font-ui); }
.btn-glass:hover { background: var(--glass-2); color: var(--on-night); }
.btn-line { height: 44px; padding: 0 18px; border: 1.5px solid var(--accent-line); background: transparent; color: var(--on-night); font: 600 15px/1 var(--font-ui); }
.btn-line:hover { background: var(--glass); color: var(--on-night); }

/* Botón redondo solo con icono (siempre con aria-label) */
.btn-round {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.btn-round:hover { background: var(--paper-soft); }
.btn-round.sm { width: 40px; height: 40px; color: var(--muted); }
.btn-round.on-night { border-color: var(--glass-line); background: transparent; color: var(--on-night); }
.btn-round.on-night:hover { background: var(--glass); }

/* Píldoras de enlace (barra de accesos) */
.pill {
  display: inline-flex; align-items: center; gap: 8px; flex: none; height: 40px; padding: 0 16px;
  border-radius: var(--r-pill); border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  font: 600 15px/1 var(--font-ui); text-decoration: none;
}
.pill:hover { background: var(--canvas); color: var(--ink); }
.pill-soft { border-color: transparent; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.pill-soft:hover { background: var(--accent-soft); color: var(--accent-ink); text-decoration: underline; }

/* Chips de filtro */
.chip {
  display: inline-flex; align-items: center; flex: none; height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: 600 14px/1 var(--font-ui); text-decoration: none; white-space: nowrap;
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-night); font-weight: 700; }
.chip.lg { height: 40px; }

/* Contador blanco sobre botón violeta */
.count {
  display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--paper); color: var(--accent-strong); font: 800 13px/1 var(--font-ui); font-variant-numeric: tabular-nums;
}

/* ---------- menú de moneda ---------- */
.currency-wrap { position: relative; }
.currency-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: max-content; min-width: 240px; max-width: calc(100vw - 32px); padding: 6px;
  display: flex; flex-direction: column; gap: 2px; border-radius: var(--r-box); background: var(--paper);
  border: 1px solid var(--line); box-shadow: var(--shadow-dialog);
}
.currency-menu button {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); text-align: left; font-size: 15px;
}
.currency-menu button:hover, .currency-menu button[aria-checked="true"] { background: var(--accent-soft); }
.currency-menu .cm-code { font-weight: 800; min-width: 38px; }
.currency-menu .cm-name { flex: 1; color: var(--body); }
.currency-menu .icon { color: var(--accent-strong); }

/* ---------- precios ---------- */
.price-pill {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--paper); color: var(--ink); font-family: var(--font-tight); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.price-pill b { font-weight: 800; font-size: 19px; }
.price-pill span { font-weight: 700; font-size: 12px; color: var(--unit); }
.price-total { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--font-tight); font-variant-numeric: tabular-nums; }
.price-total b { font-weight: 800; font-size: 34px; color: var(--ink); }
.price-total span { font-weight: 700; font-size: 15px; color: var(--unit); }
.vb-amount { display: inline-flex; align-items: center; gap: 6px; font: 600 16px var(--font-tight); font-variant-numeric: tabular-nums; }

/* Etiqueta inclinada de descuento (en paVos) */
.save-tag {
  align-self: flex-start; max-width: 100%; padding: 3px 10px; border-radius: 6px; transform: skewX(-8deg);
  background: var(--paper); color: var(--ink); font: italic 800 13px/1.2 var(--font-tight);
  text-transform: uppercase; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- avisos en línea ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: var(--r-box); background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--accent-soft); color: var(--accent-ink); }
.alert p { font-weight: 500; }

/* ---------- estado del pedido ---------- */
.status-pill { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-pill); font-weight: 700; font-size: 15px; white-space: nowrap; }
.status-pill.sm { height: 30px; padding: 0 10px; gap: 6px; font-size: 13px; }
.st-pendiente { background: var(--warn-soft); color: var(--warn); }
.st-revision { background: var(--accent-soft); color: var(--accent-ink); }
.st-aprobado, .st-entregado { background: var(--ok-soft); color: var(--ok); }
.st-rechazado, .st-cancelado { background: var(--bad-soft); color: var(--bad); }

/* ---------- títulos ---------- */
.section-title {
  display: flex; align-items: center; gap: 12px; color: var(--ink);
  font: 800 22px/1.15 var(--font-display); text-transform: uppercase;
}
.section-title::before { content: ""; flex: none; width: 4px; height: 26px; border-radius: 2px; background: var(--accent); }
@media (max-width: 719px) {
  .section-title { gap: 10px; font-size: 17px; }
  .section-title::before { height: 20px; }
}
.block-title { font: 800 22px/1.15 var(--font-tight); color: var(--ink); }

/* ---------- campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: 15px; color: var(--ink); }
.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r-input); border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink); font: 500 16px var(--font-ui);
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
select.input { padding-right: 36px; }
.help { font-size: 13px; color: var(--muted); }
.error-text { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; font-weight: 600; color: var(--bad); }
.error-text:empty { display: none; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }

/* ---------- tarjetas ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 479px) { .card { padding: 18px 16px; } }

/* ---------- diálogos ---------- */
.dialog {
  width: min(780px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0;
  border-radius: var(--r-dialog); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-dialog); overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; animation: pop-in 180ms ease-out; }
.dialog::backdrop { background: var(--scrim-strong); }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none;
  padding: 24px 28px; background: var(--night); color: var(--on-night);
}
.dialog-head h2 { font: 800 24px/1.1 var(--font-display); text-transform: uppercase; }
.dialog-body { padding: 12px 28px; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; padding: 20px 28px 28px; flex: none; }
@media (max-width: 559px) {
  .dialog-head { padding: 18px 20px; }
  .dialog-head h2 { font-size: 19px; }
  .dialog-body { padding: 8px 20px; }
  .dialog-foot { padding: 16px 20px 20px; }
  .dialog-foot .btn { flex: 1 1 auto; }
}

/* ---------- aviso (toast) ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; display: inline-flex; align-items: center; gap: 8px;
  max-width: calc(100% - 32px); padding: 12px 20px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--on-night); font-weight: 600; font-size: 15px;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity var(--ease), transform var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }

/* ---------- estado vacío ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 56px 16px; color: var(--body); }
.empty-state .icon { color: var(--line-dashed); }
.empty-state h2 { font: 800 22px var(--font-tight); color: var(--ink); }
.empty-state p { max-width: 46ch; }

/* ---------- miniatura de artículo con fondo de rareza ---------- */
.mini {
  position: relative; display: grid; place-items: center; flex: none; width: 72px; height: 88px;
  border-radius: 10px; overflow: hidden; background: var(--r-common); color: var(--on-night);
}
.mini img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.mini .icon { width: 34px; height: 34px; }
.mini.sm { width: 52px; height: 64px; }
.mini.sm .icon { width: 26px; height: 26px; }
.mini.r-uncommon { background: var(--r-uncommon); } .mini.r-rare { background: var(--r-rare); }
.mini.r-epic { background: var(--r-epic); } .mini.r-legendary, .mini.r-mythic { background: var(--r-legendary); }
.mini.r-icon, .mini.r-gaminglegends { background: var(--r-icon); } .mini.r-manual { background: var(--r-manual); }
.mini.r-gold { background: var(--r-gold); } .mini.has-bg { background: var(--tile-bg); }

/* ---------- carrito (panel lateral, boceto Carrito) ---------- */
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(460px, 100%); height: 100%; max-height: none; max-width: none;
  margin: 0; padding: 0; border: 0; background: var(--paper); color: var(--ink); box-shadow: var(--shadow-drawer);
}
.drawer[open] { display: flex; flex-direction: column; animation: slide-in 200ms ease-out; }
.drawer::backdrop { background: var(--scrim); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font: 800 20px/1.1 var(--font-display); text-transform: uppercase; }
.drawer-head h2 span { color: var(--accent); }
.drawer-list { flex: 1; overflow: auto; padding: 8px 24px; }
.cart-row { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.cart-row:last-child { border-bottom: 0; }
.cart-row.gone { opacity: .75; }
.cart-row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cart-row .name { font: 700 19px/1.1 var(--font-tight); }
.cart-row .type { font-size: 14px; color: var(--muted); }
.cart-row .vb-amount { font-size: 15px; color: var(--body); }
.cart-row .gone-note { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--bad); }
.cart-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cart-row .price { font: 800 19px var(--font-tight); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-row.gone .price { text-decoration: line-through; }
.drawer-foot { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px 24px; border-top: 1px solid var(--line); background: var(--paper-soft); }
.drawer-foot .line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-foot .total-label { font-weight: 600; font-size: 17px; }
.drawer-foot .notice-text { font-size: 14px; color: var(--muted); }
.drawer-foot .notice-text.bad { color: var(--bad); font-weight: 600; }
.drawer-foot .keep { align-self: center; font-weight: 600; font-size: 15px; color: var(--body); background: none; border: 0; text-decoration: underline; }
.mini-currency { height: 36px; padding: 0 12px; gap: 6px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); font: 700 14px var(--font-ui); display: inline-flex; align-items: center; }
.mini-currency + .currency-menu { top: auto; bottom: calc(100% + 8px); }
@media (max-width: 479px) {
  .drawer-head, .drawer-list { padding-left: 16px; padding-right: 16px; }
  .drawer-foot { padding: 16px; }
  .cart-row { gap: 10px; }
  .cart-row .mini { width: 60px; height: 74px; }
  .cart-row .name { font-size: 17px; }
}

/* ---------- marca (logo o "K") ---------- */
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-night); text-decoration: none; min-height: 40px; }
.brand:hover { color: var(--on-night); }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); font: 800 18px var(--font-display); }
.brand-name { font: 700 18px var(--font-display); }
.brand-logo { height: 36px; width: auto; max-width: 180px; object-fit: contain; }
@media (max-width: 719px) {
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 16px; }
  .brand-name { font-size: 16px; }
  .brand-logo { height: 32px; }
}
