/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #2e2e2e;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #e8a020;
  --accent-dim: #a06a10;
  --green: #3ecf6a;
  --red: #e85050;
  --radius: 8px;
  --font: 'Inter', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; width: 100%; }

/* ── Header ───────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.logo span { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 1.25rem; font-size: 0.9rem; }
.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* ── Buttons ──────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-login, .btn-danger, .btn-buy {
  display: inline-block; padding: 0.5rem 1.1rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none;
  transition: opacity 0.15s;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-login { background: #1877f2; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-buy-paid { background: var(--accent); color: #000; font-size: 1rem; padding: 0.6rem 1.4rem; }
.btn-buy-free { background: var(--green); color: #000; font-size: 1rem; padding: 0.6rem 1.4rem; }
.btn-primary:hover, .btn-secondary:hover, .btn-login:hover, .btn-danger:hover, .btn-buy:hover { opacity: 0.85; text-decoration: none; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

/* ── Flash messages ───────────────────────────── */
.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin: 1rem 0; font-size: 0.9rem; }
.flash-success { background: #1a3a25; border: 1px solid var(--green); color: var(--green); }
.flash-error { background: #3a1a1a; border: 1px solid var(--red); color: var(--red); }
.flash-info { background: #1a2a3a; border: 1px solid #4a9eff; color: #4a9eff; }

/* ── Main / Footer ────────────────────────────── */
main { flex: 1; padding: 2rem 0; }
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 1.5rem 0; font-size: 0.8rem; color: var(--text-muted); text-align: center;
}
.footer-links { margin-top: 0.5rem; }

/* ── Hero ─────────────────────────────────────── */
.hero { text-align: center; padding: 3rem 1rem; }
.hero h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 0.75rem; }
.hero p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 1.5rem; }

/* ── Category grid ────────────────────────────── */
.categories { margin-top: 3rem; }
.categories h2 { margin-bottom: 1rem; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.category-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.25rem;
  transition: border-color 0.15s;
}
.category-card:hover { border-color: var(--accent); text-decoration: none; }
.cat-name { font-weight: 600; color: var(--text); }
.cat-count { font-size: 0.8rem; color: var(--text-muted); }

/* ── Block grid ───────────────────────────────── */
.block-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.block-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.3rem;
  transition: border-color 0.15s;
}
.block-card:hover { border-color: var(--accent); text-decoration: none; }
.block-meta { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.block-name { font-weight: 600; font-size: 1rem; color: var(--text); }
.block-vendor { font-size: 0.85rem; color: var(--text-muted); }
.block-price { font-size: 0.875rem; font-weight: 600; color: var(--accent); margin-top: auto; }
.block-price.free { color: var(--green); }
.block-rating { font-size: 0.8rem; color: var(--accent); }
.no-rating { color: var(--text-muted); font-size: 0.8rem; }

/* ── Filter bar ───────────────────────────────── */
.filter-bar { margin-bottom: 1.25rem; }
.filter-bar form { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.filter-bar select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 0.4rem 0.75rem; border-radius: var(--radius); font-size: 0.875rem; cursor: pointer;
}

/* ── Page header ──────────────────────────────── */
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.75rem; }
.badge { background: var(--surface2); padding: 0.2rem 0.6rem; border-radius: 99px; font-size: 0.8rem; color: var(--text-muted); }
.badge-firmware { background: var(--accent-dim); color: #fff; border-radius: 4px; font-size: 0.7rem; padding: 0.1rem 0.4rem; font-weight: 600; }
.badge-video { background: #0e7c7b; color: #fff; border-radius: 4px; font-size: 0.7rem; padding: 0.1rem 0.4rem; font-weight: 600; }

/* ── Block detail ─────────────────────────────── */
.block-detail-header { padding: 1.5rem 0 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.block-detail-meta { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.5rem; }
.block-detail-header h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.block-detail-vendor { color: var(--text-muted); margin-bottom: 0.75rem; }
.block-detail-price { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.price-free { color: var(--green); font-weight: 700; font-size: 1.1rem; }
.price-paid { color: var(--accent); font-weight: 700; font-size: 1.1rem; }
.overall-rating { margin: 0.5rem 0; }
.big-stars { font-size: 1.5rem; color: var(--accent); }
.rating-num { font-weight: 600; margin-left: 0.5rem; }
.rating-count { color: var(--text-muted); font-size: 0.9rem; margin-left: 0.25rem; }
.hx-equiv { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.5rem; }
.hx-equiv .label { font-weight: 600; color: var(--text); }

/* ── Block description ────────────────────────── */
.block-description { margin-bottom: 1.5rem; }
.block-description h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.block-description p { color: var(--text-muted); }

/* ── AI Summary ───────────────────────────────── */
.ai-summary {
  background: var(--surface); border: 1px solid var(--accent-dim); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-bottom: 1.5rem;
}
.ai-summary-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.ai-badge { background: var(--accent-dim); color: #fff; font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 4px; font-weight: 600; }
.ai-date { font-size: 0.8rem; color: var(--text-muted); }
.ai-summary p { font-size: 0.925rem; color: var(--text-muted); }

/* ── Videos ───────────────────────────────────── */
.block-videos { margin-bottom: 2rem; }
.block-videos h2 { margin-bottom: 1rem; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.video-embed iframe { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); }
.video-notes { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Reviews section ──────────────────────────── */
.reviews-section { margin-top: 2rem; }
.reviews-header { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.reviews-header h2 { font-size: 1.4rem; }

.instrument-filter { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter-pill {
  padding: 0.3rem 0.8rem; border: 1px solid var(--border); border-radius: 99px;
  font-size: 0.8rem; color: var(--text-muted); transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 600; }

/* ── Review form ──────────────────────────────── */
.review-form-wrap, .video-submit-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1.5rem;
}
.review-form-wrap h3, .video-submit-wrap h3 { margin-bottom: 1rem; font-size: 1rem; }
.review-form { display: flex; flex-direction: column; gap: 1rem; }
.video-form { display: flex; flex-direction: column; gap: 0.5rem; }
.video-form input { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.9rem; }

/* Star picker */
.star-picker { display: flex; flex-direction: row-reverse; gap: 0.25rem; width: fit-content; }
.star-picker input { display: none; }
.star-picker label { font-size: 2rem; color: var(--border); cursor: pointer; transition: color 0.1s; }
.star-picker input:checked ~ label,
.star-picker label:hover,
.star-picker label:hover ~ label { color: var(--accent); }

/* Instrument selector */
.instrument-selector { display: flex; flex-direction: column; gap: 0.5rem; }
.field-label { font-size: 0.875rem; font-weight: 600; }
.optional { color: var(--text-muted); font-weight: 400; }
.checkbox-pill { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.875rem; }
.checkbox-pill input { accent-color: var(--accent); }

textarea {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 0.75rem; border-radius: var(--radius); font-family: var(--font); font-size: 0.9rem;
  resize: vertical; width: 100%;
}

.login-prompt { text-align: center; padding: 2rem; }

/* ── Reviews list ─────────────────────────────── */
.reviews-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.review-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.review-top { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.review-meta { display: flex; flex-direction: column; gap: 0.1rem; }
.review-meta strong { font-size: 0.9rem; }
.review-stars { color: var(--accent); font-size: 1rem; }
.review-date { font-size: 0.75rem; color: var(--text-muted); }
.review-instruments { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.instrument-tag { background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; font-size: 0.75rem; padding: 0.1rem 0.5rem; color: var(--text-muted); }
.genre-tag { background: #1a2e1a; border: 1px solid #2d5a2d; border-radius: 4px; font-size: 0.75rem; padding: 0.1rem 0.5rem; color: #7ec87e; }
.review-text { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; }
.no-reviews { color: var(--text-muted); text-align: center; padding: 2rem; }

/* ── Admin ────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }
.admin-video-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; }
.admin-video-card.approved { border-color: var(--green); }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.75rem; }
  .filter-bar form { flex-direction: column; }
  .block-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Wish List ────────────────────────────────── */
.wishlist-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem;
}
.wishlist-header h1 { margin-bottom: 0.25rem; }
.wishlist-subtitle { color: var(--text-muted); font-size: 0.95rem; }

.wishlist-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.wishlist-sort { display: flex; gap: 0.25rem; }
.sort-tab {
  padding: 0.4rem 0.9rem; border-radius: 20px; font-size: 0.875rem;
  color: var(--text-muted); border: 1px solid var(--border);
  transition: all 0.15s;
}
.sort-tab:hover { color: var(--text); border-color: var(--accent); }
.sort-tab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.wishlist-filters { display: flex; gap: 0.5rem; }

.wish-list { display: flex; flex-direction: column; gap: 0.75rem; }
.wish-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; display: flex; gap: 1rem; align-items: flex-start;
  transition: border-color 0.15s;
}
.wish-card:hover { border-color: var(--accent-dim); }
.wish-card.wish-granted { border-color: var(--green); }
.wish-card.wish-in-progress { border-color: var(--accent); }

.wish-vote-col {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.2rem; min-width: 44px; padding-top: 0.15rem;
}
.vote-btn {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted);
  width: 40px; height: 36px; border-radius: var(--radius); font-size: 1rem;
  cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.vote-btn:hover, .vote-btn.voted { background: var(--accent); color: #000; border-color: var(--accent); }
.vote-count { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); }

.wish-content { flex: 1; min-width: 0; }
.wish-meta-top { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; align-items: center; }
.wish-title { font-size: 1.05rem; font-weight: 600; color: var(--text); display: block; margin-bottom: 0.3rem; }
.wish-title:hover { color: var(--accent); }
.wish-block-link { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.wish-meta-bottom { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Badges */
.badge-granted { background: var(--green); color: #000; padding: 0.15rem 0.6rem; border-radius: 20px; font-size: 0.78rem; font-weight: 700; }
.badge-in-progress { background: var(--accent); color: #000; padding: 0.15rem 0.6rem; border-radius: 20px; font-size: 0.78rem; font-weight: 700; }
.badge-open { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); padding: 0.15rem 0.6rem; border-radius: 20px; font-size: 0.78rem; }
.wish-type-badge { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); padding: 0.15rem 0.6rem; border-radius: 20px; font-size: 0.78rem; }

/* Wish detail */
.wish-detail { max-width: 760px; }
.wish-detail-header { display: flex; gap: 1.5rem; align-items: flex-start; margin-bottom: 1.5rem; }
.wish-vote-col-large { min-width: 60px; align-items: center; }
.vote-btn-large {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted);
  width: 52px; height: 48px; border-radius: var(--radius); font-size: 1.4rem;
  cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.vote-btn-large:hover, .vote-btn-large.voted { background: var(--accent); color: #000; border-color: var(--accent); }
.vote-count-large { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.vote-label { font-size: 0.75rem; color: var(--text-muted); }
.wish-badges { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.wish-detail-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.4rem; }
.wish-detail-submitter { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }
.wish-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; line-height: 1.7; }

.admin-controls { background: var(--surface2); border: 1px solid var(--accent-dim); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; display: flex; gap: 0.75rem; align-items: center; }
.wish-actions { margin-bottom: 1rem; }

.wish-comments { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.wish-comments h2 { margin-bottom: 1rem; }
.wish-comment { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.875rem 1rem; margin-bottom: 0.75rem; }
.comment-meta { display: flex; gap: 0.75rem; align-items: baseline; margin-bottom: 0.4rem; font-size: 0.875rem; }
.comment-date { color: var(--text-muted); font-size: 0.8rem; }
.comment-body { font-size: 0.9rem; }
.comment-form { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.no-comments { color: var(--text-muted); font-size: 0.9rem; padding: 0.5rem 0; }

/* Wish form */
.form-page { max-width: 640px; }
.form-page h1 { margin-bottom: 0.5rem; }
.form-subtitle { color: var(--text-muted); margin-bottom: 2rem; }
.wish-form { display: flex; flex-direction: column; gap: 1.25rem; }
.type-picker { display: flex; gap: 1rem; flex-wrap: wrap; }
.type-option { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.type-option input { accent-color: var(--accent); }
.field-select, .filter-select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.875rem; cursor: pointer;
}
.field-input {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 0.6rem 0.75rem; border-radius: var(--radius); font-size: 0.9rem; width: 100%;
  font-family: var(--font);
}
.field-input:focus, .field-select:focus, .field-textarea:focus { outline: none; border-color: var(--accent); }
.field-textarea { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 0.75rem; border-radius: var(--radius); font-size: 0.9rem; resize: vertical; width: 100%; font-family: var(--font); }
.required { color: var(--accent); }
.form-actions { display: flex; gap: 0.75rem; align-items: center; }
.btn-secondary { color: var(--text-muted); font-size: 0.9rem; }
.btn-danger-sm { background: transparent; border: 1px solid var(--red); color: var(--red); padding: 0.3rem 0.75rem; border-radius: var(--radius); font-size: 0.8rem; cursor: pointer; }
.btn-danger-sm:hover { background: var(--red); color: #fff; }

.back-link { margin-top: 2rem; }
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 1rem; align-items: center; }

/* ── External Video Link Button ─────────────────────────────── */
.external-video-link {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  aspect-ratio: 16/9;
  min-height: 120px;
}
.btn-watch-external {
  display: inline-block;
  background: #0e7c7b;
  color: #fff;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-watch-external:hover { background: #0a5e5d; color: #fff; }
