/* pages/shop.css — Cửa hàng (/shop). Template: templates/pages/shop.html · JS: js/pages/shop.js
   Thẻ xem trước dùng lại class thật (.cover, .page-icon, .page-title, .card, .btn-primary, .tag) — ở đây chỉ
   thu nhỏ kích thước; MÀU + điểm nhấn đến từ css/themes/<id>.css qua [data-theme-preview]. */

/* ── Ví điểm ─────────────────────────────────────────────────────── */
.shop-wallet {
  display: grid; grid-template-columns: minmax(240px, 1fr) 1.4fr; gap: 20px; align-items: center;
  margin: 4px 0 28px; padding: 20px 22px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-soft) 70%);
}
.shop-wallet-main { display: flex; align-items: center; gap: 16px; }
.shop-coin { flex-shrink: 0; filter: drop-shadow(0 6px 12px rgba(217, 138, 11, 0.35)); animation: shop-coin 4s ease-in-out infinite; }
@keyframes shop-coin { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-4px) rotate(4deg); } }
.shop-wallet-label { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.shop-balance { margin: 2px 0 4px; color: var(--ink); line-height: 1.1; }
.shop-balance b { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.shop-balance span { font-size: 15px; color: var(--muted); font-weight: 600; }
.shop-balance.is-bump b { animation: shop-bump 0.6s ease; }
@keyframes shop-bump { 30% { color: var(--accent); transform: scale(1.08); } }
.shop-balance b { display: inline-block; transform-origin: left center; }
.shop-today { margin: 0; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--green); font-weight: 600; }

.shop-earn-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.shop-earn ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.shop-earn li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); line-height: 1.35; }
.shop-earn li b {
  flex-shrink: 0; min-width: 38px; padding: 2px 6px; border-radius: var(--r-sm);
  background: var(--amber-bg); color: var(--amber); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums;
}
.shop-guest { margin-bottom: 24px; }

/* ── Tab ─────────────────────────────────────────────────────────── */
.shop-tabs { margin-bottom: 20px; }
.shop-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }

/* ── Lưới theme ──────────────────────────────────────────────────── */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.shop-card {
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg); overflow: hidden; transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.shop-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.shop-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* Màn hình thu nhỏ — mọi màu lấy từ biến của theme đó */
.shop-prev {
  position: relative; height: 176px; overflow: hidden; pointer-events: none; user-select: none;
  background: var(--bg); color: var(--text); font-family: var(--font);
  border-bottom: 1px solid var(--line);
}
.shop-prev .cover { height: 58px; }
.shop-prev-body { display: grid; grid-template-columns: 62px 1fr; height: calc(100% - 58px); }
.shop-prev-side { background: var(--bg-side); border-right: 1px solid var(--line); padding: 12px 8px; display: flex; flex-direction: column; gap: 7px; }
.shop-prev-side i { display: block; height: 7px; border-radius: 4px; background: var(--line); }
.shop-prev-side i.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.shop-prev-side i:nth-child(3) { width: 70%; }
.shop-prev-side i:nth-child(5) { width: 55%; }
.shop-prev-main { position: relative; padding: 0 12px; min-width: 0; }
.shop-prev .page-icon { width: 34px; height: 34px; margin-top: -17px; border-radius: calc(var(--r-lg) * 0.6); }
.shop-prev .page-title {
  margin: 6px 0 6px; font-size: 15px; line-height: 1.2; color: var(--ink); font-family: var(--font-display);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Nét cọ dưới tiêu đề (Samurai) thu nhỏ theo thẻ — bộ chọn dài hơn để thắng css/themes/*.css nạp sau */
.shop-card .shop-prev .page-title::after { width: 72px; height: 6px; margin-top: 1px; background-size: 100% 100%; }
.shop-prev .card.shop-prev-card { padding: 7px 8px; gap: 5px; margin: 0 0 7px; }
.shop-prev-card i { display: block; height: 6px; border-radius: 3px; background: var(--line); }
.shop-prev-card i.short { width: 60%; background: var(--bg-soft); }
.shop-prev-row { display: flex; align-items: center; gap: 6px; }
.shop-prev .btn { height: 22px; padding: 0 10px; font-size: 11px; }
.shop-prev .tag { font-size: 10px; padding: 1px 6px; }

.shop-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex-grow: 1; }
.shop-card-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.shop-card-name { margin: 0 4px 0 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.shop-card-head .tag { display: inline-flex; align-items: center; gap: 3px; }
.shop-card-desc { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; flex-grow: 1; }
.shop-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; min-height: 34px; }
.shop-price { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.shop-price .icon { color: #d98a0b; }
.shop-card-foot .grow { flex-grow: 1; }
.shop-state { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--accent); }
.shop-missing { font-size: 12px; color: var(--muted); }
.shop-card-foot .btn[disabled] { opacity: 0.55; cursor: default; }

/* ── Lịch sử điểm ────────────────────────────────────────────────── */
.shop-hist-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.shop-hist-list li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); background: var(--bg); }
.shop-hist-list li:first-child { border-top: 0; }
.shop-hist-main { flex-grow: 1; min-width: 0; }
.shop-hist-label { margin: 0; font-size: 14px; color: var(--ink); font-weight: 500; }
.shop-hist-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-hist-delta { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--green); }
.shop-hist-delta.is-neg { color: var(--red); }
.shop-hist-empty { color: var(--muted); font-size: 14px; }
#shop-hist-more { margin-top: 12px; }

/* ── Admin cộng điểm thử ─────────────────────────────────────────── */
.shop-admin { margin-top: 36px; border: 1px dashed var(--line); border-radius: var(--r-md); padding: 10px 14px; }
.shop-admin summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.shop-admin-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.shop-admin-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.shop-admin-form label.grow { flex-grow: 1; min-width: 180px; }
.shop-admin-form input[type="number"] { width: 150px; }

/* ── Thanh "đang xem thử" ────────────────────────────────────────── */
.shop-trybar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; max-width: calc(100vw - 24px);
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink);
  box-shadow: var(--shadow-pop); font-size: 14px; animation: shop-rise 0.25s ease;
}
#shop-trybar-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-trybar .btn { flex-shrink: 0; white-space: nowrap; }
.shop-trybar b { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 28px; }
.shop-trybar .btn { border-radius: 999px; }
@keyframes shop-rise { from { opacity: 0; transform: translate(-50%, 12px); } }

@media (max-width: 760px) {
  .shop-wallet { grid-template-columns: 1fr; padding: 16px; }
  .shop-balance b { font-size: 34px; }
  .shop-earn ul { grid-template-columns: 1fr; }
  .shop-grid { grid-template-columns: 1fr; }
  .shop-trybar { left: 12px; right: 12px; bottom: 12px; transform: none; font-size: 13px; animation: none; }
  .shop-trybar > .icon { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shop-coin, .shop-balance.is-bump b, .shop-trybar { animation: none; }
  .shop-card, .shop-card:hover { transition: none; transform: none; }
}
