/* Elmoryn base styles */
:root {
  --bg: #0c0d10;
  --card: #151720;
  --text: #eaeaf0;
  --muted: #b6b7c2;
  --brand: #6ea8fe;
  --brand-600: #4b8cf5;
  --border: #222435;
  --ok: #3ddc97;
  --warn: #ffd166;
  --danger: #ef476f;
  --radius: 12px;
}

* { box-sizing: border-box }
html, body { height: 100% }
body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 1200px at 100% -20%, #1d2030 10%, #0c0d10 60%);
}

.container { width: min(1100px, 100% - 32px); margin: 0 auto }
.narrow { width: min(760px, 100% - 32px) }

[data-auth-only] { display: none !important; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(12,13,16,.7); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border) }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 }
.logo { color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: .3px; font-size: 20px }
.nav-toggle { display: none }
.nav-menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px }
.nav-menu a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px }
.nav-menu a[aria-current="page"], .nav-menu a:hover { color: var(--text); background: #191b27 }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; background: #191b27; border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: 8px }
  .nav-menu { display: none; position: absolute; right: 16px; top: 60px; background: #0f111a; border: 1px solid var(--border); border-radius: 12px; padding: 8px; flex-direction: column; min-width: 200px }
  .nav-menu.open { display: flex }
}

/* Hero */
.hero { padding: 56px 0 24px; background: linear-gradient(180deg, #0f111a 0%, rgba(15,17,26,0) 100%) }
.hero-inner { text-align: center }
.hero h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 40px) }
.hero p { margin: 0 0 16px; color: var(--muted) }
.hero-cta { display: inline-flex; gap: 10px }

/* Sections */
.section { padding: 24px 0 56px }
.section-title { margin: 0 0 16px }
.muted { color: var(--muted) }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column }
.card-media { display: block; aspect-ratio: 4/3; background: #0f111a; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block }
.card-body { padding: 12px }
.card-title { margin: 0 0 6px; font-size: 16px }
.card-price { margin: 0 0 10px; color: var(--ok); font-weight: 600 }

/* Product */
.product { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px }
.product-media { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px }
.product-media img { width: 100%; height: auto; border-radius: 8px }
.product-body .back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none }
.price { color: var(--ok); font-weight: 700; font-size: 20px }
.variants { display: flex; gap: 8px; margin: 10px 0 }
.variants .chip { background: #191b27; border: 1px solid var(--border); padding: 6px 10px; border-radius: 999px }
.cta-row { display: flex; gap: 8px; margin-top: 10px }

@media (max-width: 900px) { .product { grid-template-columns: 1fr } }

/* Forms */
.filters { display: flex; gap: 8px; margin: 8px 0 16px; flex-wrap: wrap }
.form label { display: grid; gap: 6px; margin-bottom: 12px }
input, select, textarea { background: #0f111a; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; background: #191b27; color: var(--text); text-decoration: none; border: 1px solid var(--border); padding: 10px 14px; border-radius: 12px; cursor: pointer }
.btn:hover { background: #1d2030 }
.btn-primary { background: var(--brand); border-color: var(--brand-600); color: #081022 }
.btn-primary:hover { background: var(--brand-600) }
.btn-sm { padding: 8px 12px; border-radius: 10px }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 18px 0; background: rgba(12,13,16,.5) }
.footer-inner { display: flex; align-items: center; justify-content: space-between }
.site-footer a { color: var(--muted); text-decoration: none; margin-left: 12px }

#catalog-status { text-align: center; margin: 16px 0 0; }
.muted.error { color: var(--danger); }
#catalog-actions { justify-content: center; margin-top: 16px; }
[hidden] { display: none !important; }

/* Status chips */
.status-chip { display: inline-flex; align-items:center; gap:6px; padding: 4px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); background: #191b27; color: var(--muted) }
.status-chip.paid { border-color: #235d3f; background: #0f1a14; color: #7de3a7 }
.status-chip.pending { border-color: #5c511c; background: #19170b; color: #ffe28a }
.status-chip.failed, .status-chip.canceled { border-color: #5f2431; background: #1a0f13; color: #ff8aa3 }
[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(12, 13, 16, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: min(680px, 100%);
  max-height: 90vh;
  overflow: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover { color: var(--text); }

#category-list { display:flex; flex-direction:column; gap:18px; margin:20px 0; }
.category-section h3 { margin:0 0 10px; font-size:18px; color:var(--text); }
.category-section.highlight {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 14px;
  animation: category-highlight 1.6s ease-in-out;
}
.category-section.highlight .category-grid {
  background: rgba(110, 168, 254, 0.08);
  border-radius: 12px;
  padding: 8px;
}
.category-section.highlight .category-grid button {
  background: rgba(110, 168, 254, 0.14);
}
.category-section.highlight .category-grid button:hover,
.category-section.highlight .category-grid button.active {
  background: rgba(110, 168, 254, 0.22);
}
.category-section.highlight { will-change: outline-color, background; }
@keyframes category-highlight {
  0%, 100% { outline-color: transparent; }
  30%, 60% { outline-color: rgba(110, 168, 254, 0.9); }
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 0;
}

.category-grid button {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #191b27;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.category-grid button:hover,
.category-grid button.active {
  border-color: var(--brand);
  background: rgba(110, 168, 254, 0.12);
  color: var(--text);
}
