/* Teralth Studio - design system */
:root {
  --bg: #0a0d12;
  --bg-elev: #11161e;
  --bg-card: #151b25;
  --border: #1f2733;
  --border-hi: #2a3442;
  --text: #e6ecf5;
  --text-mute: #8a96a8;
  --accent: #3ddcc6;
  --accent-2: #66e9d6;
  --accent-glow: rgba(61, 220, 198, 0.18);
  --primary: #5865f2;
  --danger: #ff5c7a;
  --success: #4ade80;
  --radius: 14px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 0 1px var(--accent-glow), 0 12px 40px -12px var(--accent-glow);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: radial-gradient(1200px 600px at 80% -200px, rgba(61,220,198,0.08), transparent 60%),
              radial-gradient(900px 500px at -10% 10%, rgba(88,101,242,0.07), transparent 60%),
              var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.accent { color: var(--accent); }
.muted { color: var(--text-mute); }
.hidden { display: none !important; }
.t { color: var(--accent); font-family: 'JetBrains Mono', monospace; font-weight: 600; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 13, 18, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-mark { color: var(--accent); font-size: 22px; text-shadow: 0 0 18px var(--accent-glow); }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--text-mute); font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--text); }

/* USER PANEL */
.user-panel { display: flex; align-items: center; gap: 10px; }
.user-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 6px 10px 6px 6px; border-radius: 999px;
  transition: border-color .2s, box-shadow .2s;
}
.user-box:hover { border-color: var(--border-hi); box-shadow: var(--shadow-glow); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-elev); }
.user-meta { display: flex; flex-direction: column; line-height: 1.1; }
.user-name { font-size: 13px; font-weight: 600; }
.user-balance { font-size: 13px; color: var(--text-mute); display: flex; align-items: center; gap: 3px; font-family: 'JetBrains Mono', monospace; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a1614;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.btn-outline { background: transparent; border-color: var(--border-hi); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-mute); }
.btn-ghost:hover { border-color: var(--border-hi); color: var(--text); }
.btn-discord { background: var(--primary); color: white; }
.btn-discord:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; transform: translateY(-1px); }

/* HERO */
.hero { padding: 90px 0 70px; }
.hero-inner { text-align: center; max-width: 820px; margin: 0 auto; }
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--accent-glow); color: var(--accent);
  font-size: 13px; font-weight: 600; margin-bottom: 22px;
  border: 1px solid var(--accent-glow);
}
.hero h1 {
  font-size: clamp(36px, 6vw, 60px); line-height: 1.1; font-weight: 700;
  letter-spacing: -0.02em; margin-bottom: 18px;
}
.grad {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: 18px; color: var(--text-mute); margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 50px; }
.stats {
  display: flex; gap: 40px; justify-content: center; flex-wrap: wrap;
  padding-top: 30px; border-top: 1px solid var(--border);
}
.stats > div { display: flex; flex-direction: column; align-items: center; }
.stats strong { font-size: 24px; font-weight: 700; color: var(--accent); font-family: 'JetBrains Mono', monospace; }
.stats span { font-size: 13px; color: var(--text-mute); margin-top: 4px; }

/* SECTIONS */
.section { padding: 80px 0; }
.section-alt { background: linear-gradient(180deg, transparent, rgba(255,255,255,0.01)); }
.section-title { font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -0.01em; }
.section-sub { color: var(--text-mute); margin-top: 6px; margin-bottom: 32px; }

/* CATEGORIES */
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
}
.category-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; cursor: pointer;
  transition: all .25s; text-align: left;
}
.category-card:hover {
  border-color: var(--accent); transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}
.category-icon { font-size: 28px; margin-bottom: 12px; }
.category-name { font-weight: 600; font-size: 17px; margin-bottom: 4px; }
.category-count { color: var(--text-mute); font-size: 13px; }

/* CATALOG */
.catalog-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 20px; margin-bottom: 32px;
}
.catalog-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.catalog-controls input, .catalog-controls select {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-family: inherit; font-size: 14px;
  min-width: 200px; transition: border-color .2s;
}
.catalog-controls input:focus, .catalog-controls select:focus {
  outline: none; border-color: var(--accent);
}
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px;
}
.product-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 12px;
  transition: all .25s; position: relative;
}
.product-card:hover { border-color: var(--border-hi); transform: translateY(-2px); box-shadow: var(--shadow); }
.product-card.featured { border-color: var(--accent-glow); }
.product-card.featured::before {
  display: none;
}

.product-media {
  position: relative;
  width: 100%;
  /* Eliminamos el height fijo y forzamos la proporción exacta de tus imágenes */
  aspect-ratio: 1920 / 650; 
  background: #1a1a1a;
  overflow: hidden;
  border-radius: 8px; /* Ajustado para quedar bien dentro de los 22px de padding de la card */
}

/* imagen base */
.product-img {
  width: 100%;
  height: 100%;
  /* Como el contenedor ahora tiene la proporción 1920x650, 'cover' rellenará todo sin cortar absolutamente nada de la imagen */
  object-fit: cover; 
  position: relative;
  z-index: 1;
}

/* fallback */
.product-img-none {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #333;
  background: linear-gradient(45deg, #0f0f0f, #1a1a1a);
  position: relative;
  z-index: 1;
}

/* overlays encima de TODO */
.product-cat-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #eee;
  border: 1px solid rgba(255,255,255,0.1);
}

/* destacado */

/* badge encima de la imagen */
.product-card.featured .product-media::after {
  content: '★ Destacado';
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;

  background: var(--accent-glow);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;

  backdrop-filter: blur(6px);
}
.product-cat { font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.product-name { font-size: 18px; font-weight: 600; }
.product-desc { color: var(--text-mute); font-size: 14px; flex: 1; }
.product-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  background: var(--bg-elev); color: var(--text-mute); border: 1px solid var(--border);
}
.product-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.product-price {
  display: flex; align-items: center; gap: 4px;
  font-size: 18px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
}

/* FOOTER */
.footer { border-top: 1px solid var(--border); padding: 50px 0 20px; margin-top: 60px; }
.footer-inner {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px;
}
.footer h4 { margin-bottom: 12px; font-size: 14px; }
.footer a { display: block; color: var(--text-mute); padding: 4px 0; transition: color .2s; }
.footer a:hover { color: var(--accent); }
.footer-bottom { text-align: center; padding-top: 30px; margin-top: 30px; border-top: 1px solid var(--border); color: var(--text-mute); font-size: 13px; }

/* MODAL */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
  overflow: hidden;
}
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border-hi);
  border-radius: var(--radius); padding: 32px; max-width: 440px; width: 100%;
  position: relative; box-shadow: var(--shadow);
}

.modal-box.product-modal {
  max-width: 1100px;
  width: 90%;
  padding: 32px;
  max-height: 95vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: auto;
  min-height: 400px;
}

.modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  flex-shrink: 0;
  position: relative;
  padding: 0 50px;
}

.modal-header h3 {
  margin: 0;
  text-align: center;
  flex: 1;
}

.modal-header #productModalBuyBtn {
  position: absolute;
  right: 0;
  margin-left: auto;
  z-index: 15;
}

.banner-container {
  width: 100%;
  display: none;
  flex-shrink: 0;
}

.banner-container img {
  width: 100%;
  aspect-ratio: 1920 / 650;
  object-fit: cover;
  border-radius: 8px;
}

.modal-divider {
  width: 100%;
  border: none;
  border-top: 1px dashed var(--border-color, #444);
  margin: 15px 0;
  display: none;
  flex-shrink: 0;
}

.iframe-wrapper {
  flex: 1;
  position: relative;
  background: var(--bg-alt, #1e1e2e);
  border-radius: 8px;
  overflow: visible;
  height: auto;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  flex: 1;
  min-height: 500px;
  overflow: visible;
}
.modal-close {
  position: absolute; top: 12px; right: 12px; background: none; border: none;
  color: var(--text-mute); font-size: 24px; cursor: pointer; width: 32px; height: 32px;
}
.modal-close:hover { color: var(--text); }
.modal-box h3 { margin-bottom: 8px; font-size: 22px; }

/* Custom scrollbar for modal */
.modal-box::-webkit-scrollbar {
  width: 8px;
}

.modal-box::-webkit-scrollbar-track {
  background: var(--bg-elev);
  border-radius: 4px;
}

.modal-box::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.modal-box::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}

/* Special styles for product modal */
.product-modal {
  overflow-y: auto !important;
  max-height: 90vh !important;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-elev);
}

.product-modal::-webkit-scrollbar {
  width: 8px;
}

.product-modal::-webkit-scrollbar-track {
  background: var(--bg-elev);
  border-radius: 4px;
}

.product-modal::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.product-modal::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}
.topup-row { display: flex; gap: 8px; margin-top: 18px; }
.topup-row input {
  flex: 1; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-family: 'JetBrains Mono', monospace;
}
.topup-row input:focus { outline: none; border-color: var(--accent); }
.quick-amounts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-mute);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-family: 'JetBrains Mono', monospace;
  font-size: 13px; transition: all .2s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* TOAST */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-card); border: 1px solid var(--border-hi);
  padding: 12px 20px; border-radius: 10px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 200;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

@media (max-width: 700px) {
  .nav-links { display: none; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .catalog-head { flex-direction: column; align-items: stretch; }
  .stats { gap: 24px; }
}
