/* BotShop Mini App — tema claro / oscuro + Plus Jakarta Sans */
html[data-theme="dark"] {
  --bg: #08090f;
  --bg-elevated: #10121a;
  --text: #f4f4f8;
  --hint: #9898a8;
  --link: #7dd3fc;
  --btn: #3b82f6;
  --btn-t: #ffffff;
  --secondary: #161822;
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.14);
  --glass: rgba(255, 255, 255, 0.05);
  --input-bg: rgba(0, 0, 0, 0.35);
  --pre-bg: rgba(0, 0, 0, 0.4);
  --err-border: rgba(248, 113, 113, 0.4);
  --err-bg: linear-gradient(135deg, rgba(248, 113, 113, 0.16), rgba(239, 68, 68, 0.08));
  --err-text: #fecaca;
  --warn: #fca5a5;
  --mesh-1: rgba(59, 130, 246, 0.22);
  --mesh-2: rgba(125, 211, 252, 0.09);
  --hero-glow: rgba(37, 99, 235, 0.18);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-tile: 0 4px 20px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-lg: 22px;
}

html[data-theme="light"] {
  --bg: #eef0f6;
  --bg-elevated: #ffffff;
  --text: #14151c;
  --hint: #64748b;
  --link: #2563eb;
  --btn: #2563eb;
  --btn-t: #ffffff;
  --secondary: #f1f4f9;
  --stroke: rgba(15, 23, 42, 0.1);
  --stroke-strong: rgba(15, 23, 42, 0.14);
  --glass: rgba(255, 255, 255, 0.85);
  --input-bg: #ffffff;
  --pre-bg: #f1f5f9;
  --err-border: rgba(220, 38, 38, 0.35);
  --err-bg: linear-gradient(135deg, rgba(254, 202, 202, 0.5), rgba(252, 165, 165, 0.25));
  --err-text: #7f1d1d;
  --warn: #b91c1c;
  --mesh-1: rgba(37, 99, 235, 0.12);
  --mesh-2: rgba(14, 165, 233, 0.1);
  --hero-glow: rgba(37, 99, 235, 0.1);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-tile: 0 4px 16px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --radius-lg: 22px;
}

:root {
  --font: "Plus Jakarta Sans", "Outfit", system-ui, -apple-system, sans-serif;
  --font-display: "Outfit", "Plus Jakarta Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 16px));
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 90% at 50% -25%, var(--mesh-1), transparent 55%),
    radial-gradient(90% 60% at 100% 0%, var(--mesh-2), transparent 50%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 40%, transparent) 0%, transparent 45%);
  letter-spacing: 0.01em;
  transition: background-color 0.35s var(--ease), color 0.25s ease;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ——— Header ——— */
.top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg) 94%, transparent) 0%,
    color-mix(in srgb, var(--bg) 82%, transparent) 100%
  );
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--stroke);
  transition: border-color 0.3s ease, background 0.3s ease;
}

.top-side {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
}

.top h1 {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--text) 0%, color-mix(in srgb, var(--text) 55%, var(--hint)) 130%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@supports not (-webkit-background-clip: text) {
  .top h1 {
    color: var(--text);
    -webkit-text-fill-color: var(--text);
  }
}

.top-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 14px;
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.15s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--stroke);
}

.top-icon:hover {
  background: color-mix(in srgb, var(--glass) 80%, var(--btn) 20%);
}

.top-icon:active {
  transform: scale(0.94);
}

.theme-toggle .theme-ico {
  display: flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="dark"] .theme-ico-moon {
  display: none !important;
}

html[data-theme="light"] .theme-ico-sun {
  display: none !important;
}

.top-icon:focus-visible {
  outline: 2px solid var(--btn);
  outline-offset: 2px;
}

/* ——— Botones ——— */
.btn {
  font-family: inherit;
  background: var(--secondary);
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(165deg, var(--btn) 0%, color-mix(in srgb, var(--btn) 88%, #000) 100%);
  color: var(--btn-t);
  border-color: color-mix(in srgb, var(--btn-t) 15%, transparent);
  box-shadow:
    0 4px 22px color-mix(in srgb, var(--btn) 45%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

html[data-theme="light"] .btn.primary {
  box-shadow:
    0 4px 18px rgba(37, 99, 235, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn.full {
  width: 100%;
  margin-top: 14px;
}

/* ——— Home ——— */
.view-home {
  padding-top: 8px;
}

.hero-card {
  position: relative;
  padding: 24px 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, color-mix(in srgb, var(--bg-elevated) 95%, white) 0%, var(--glass) 100%);
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow 0.35s ease, border-color 0.3s ease;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 100% 0%, var(--hero-glow), transparent 55%);
  pointer-events: none;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Contenedor logo bienvenida: banner 16:9 (tamaño recomendado solo en admin del bot) */
.hero-logo-container {
  position: relative;
  z-index: 1;
  margin: 0 auto 14px;
  text-align: center;
}

.hero-logo-fallback-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--btn) 35%, transparent), color-mix(in srgb, var(--btn) 12%, transparent));
  border: 1px solid color-mix(in srgb, var(--btn) 40%, transparent);
  font-size: 1.15rem;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--btn) 25%, transparent);
  line-height: 1;
}

/* Imagen completa visible: escala al ancho del contenedor, sin recorte (antes 16:9 + cover cortaba) */
.hero-logo-container.hero-logo-container--has-image {
  position: relative;
  width: 100%;
  max-width: 640px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--stroke-strong) 85%, transparent);
  box-shadow: var(--shadow-sm);
  background: var(--bg-elevated);
  isolation: isolate;
}

/* Ligera viñeta: la foto sigue nítida (sin blur ni máscara que la apague) */
.hero-logo-container.hero-logo-container--has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 6%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg-elevated) 8%, transparent) 0%,
    transparent 28%,
    transparent 72%,
    color-mix(in srgb, var(--bg-elevated) 10%, transparent) 100%
  );
  opacity: 0.55;
}

.hero-logo-container.hero-logo-container--has-image .hero-logo-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  border: none;
  box-shadow: none;
  position: relative;
  z-index: 0;
  transform: none;
  filter: none;
  opacity: 1;
}

.hero-logo-container.hero-logo-container--has-image .hero-logo-fallback-badge {
  display: none;
}

.hero-logo-img[hidden] {
  display: none !important;
}

.hero-logo-img:not([hidden]) {
  display: block;
}

.lead {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.58;
  font-weight: 500;
  color: var(--text);
  transition: opacity 0.35s var(--ease);
}

.hero-card.is-loading .lead {
  opacity: 0.65;
  animation: welcomePulse 1.1s ease-in-out infinite;
}

@keyframes welcomePulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.92;
  }
}

.grid-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 108px;
  padding: 16px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elevated) 90%, transparent) 0%, var(--glass) 100%);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.2s, box-shadow 0.25s;
  box-shadow: var(--shadow-tile);
}

.tile:active {
  transform: scale(0.97);
}

.tile-accent {
  border-color: color-mix(in srgb, var(--btn) 50%, var(--stroke));
  background: linear-gradient(165deg, color-mix(in srgb, var(--btn) 26%, transparent) 0%, color-mix(in srgb, var(--btn) 8%, transparent) 100%);
  box-shadow:
    var(--shadow-tile),
    inset 0 1px 0 color-mix(in srgb, white 12%, transparent);
}

.tile-wide {
  grid-column: 1 / -1;
  min-height: 76px;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
}

.tile-ico {
  font-size: 1.9rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

html[data-theme="dark"] .tile-ico {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.tile-wide .tile-ico {
  font-size: 1.55rem;
}

.tile-txt {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.95;
}

.support-foot {
  margin-top: 24px;
  padding: 15px 17px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--secondary) 85%, transparent);
  border: 1px solid var(--stroke);
  font-size: 0.87rem;
  line-height: 1.55;
  color: var(--hint);
}

.muted {
  color: var(--hint);
  font-size: 0.9rem;
}

.muted.small {
  font-size: 0.8rem;
  margin-top: 6px;
}

main {
  padding: 20px 16px 36px;
}

.view {
  animation: viewIn 0.32s var(--ease);
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hint);
  margin: 22px 0 8px;
}

/* ——— Listas ——— */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list button,
.item {
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elevated) 95%, transparent) 0%, var(--glass) 100%);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

.list button:hover,
.item:hover {
  border-color: color-mix(in srgb, var(--btn) 35%, var(--stroke));
}

.list button:active,
.item:active {
  transform: scale(0.99);
}

.item .sub {
  color: var(--hint);
  font-size: 0.84rem;
  margin-top: 6px;
  font-weight: 500;
}

/* ——— Cards ——— */
.card {
  border-radius: var(--radius-lg);
  padding: 22px;
  line-height: 1.65;
  background: linear-gradient(165deg, color-mix(in srgb, var(--bg-elevated) 98%, transparent) 0%, var(--glass) 100%);
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.3s ease;
}

.card.big {
  font-family: var(--font-display);
  font-size: 1.48rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.03em;
  padding: 34px 22px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--btn) 18%, transparent) 0%, var(--glass) 100%);
  border-color: color-mix(in srgb, var(--btn) 28%, var(--stroke));
}

/* Aviso límites / cooldowns depósitos (texto alineado con reglas del servidor) */
.dep-limits-card {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--secondary) 88%, transparent);
}

.dep-limits-title {
  margin: 0 0 10px;
  line-height: 1.45;
}

.dep-limits-list {
  margin: 0;
  padding-left: 1.15em;
}

.dep-limits-list li {
  margin: 0.35em 0;
}

.row {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hint);
}

.row input,
.row select {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.row input:focus,
.row select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--btn) 65%, var(--stroke));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--btn) 22%, transparent);
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  padding: 14px 8px;
  flex-wrap: wrap;
}

.pager span {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--hint);
  min-width: 5ch;
  text-align: center;
}

.banner {
  margin: 0 10px 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--err-border);
}

.banner.err {
  background: var(--err-bg);
  color: var(--err-text);
}

.policy {
  white-space: pre-wrap;
  line-height: 1.68;
  font-size: 0.94rem;
  color: color-mix(in srgb, var(--text) 88%, var(--hint));
}

.btn:focus-visible,
.tile:focus-visible {
  outline: 2px solid var(--btn);
  outline-offset: 2px;
}

/* ——— Depósitos ——— */
.deposit-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 6px;
  margin: 16px 0 12px;
}

.dep-tab {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: var(--hint);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s, border-color 0.2s;
}

.dep-tab.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--btn) 55%, var(--stroke));
  background: linear-gradient(165deg, color-mix(in srgb, var(--btn) 26%, transparent) 0%, color-mix(in srgb, var(--btn) 8%, transparent) 100%);
}

.dep-panel {
  margin-bottom: 8px;
}

.dep-instructions {
  margin-bottom: 14px;
  line-height: 1.55;
}

.dep-instructions code {
  font-size: 0.88em;
  word-break: break-all;
}

.dep-instructions .warn {
  color: var(--warn);
}

.row-file input[type="file"] {
  padding: 10px 0;
  font-size: 0.88rem;
}

.deposits-list .item {
  text-align: left;
}

button.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Detalle de pedido */
.order-num {
  font-family: var(--font-display);
  font-size: 1.12rem;
  margin: 0 0 8px;
}

.order-line {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}

.order-line-head {
  margin: 0 0 4px;
}

pre.order-delivered {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--pre-bg);
  border: 1px solid var(--stroke);
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.user-data-panel {
  margin-top: 14px;
}

.user-data-instr {
  margin: 8px 0 12px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.user-data-textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  font: inherit;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--text);
}

.user-data-counter {
  margin: 6px 0 12px;
}

.order-attachment-img {
  margin-top: 10px;
  width: 100%;
  display: block;
}

.order-attachment-img img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  border: 1px solid var(--stroke);
}

a.order-dl-link {
  color: var(--link);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 600;
}
