/* ==========================================================================
   bacvang.com - Mobile-first CSS
   ========================================================================== */

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: 72px; /* chừa chỗ cho bottom-nav */
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 700; }
p { margin: 0 0 .75rem; }
ul { margin: 0; padding: 0; list-style: none; }

/* --- DESIGN TOKENS --- */
:root {
  --bg:        #0f172a;
  --bg-soft:   #1e293b;
  --surface:   #ffffff;
  --surface-2: #f1f5f9;
  --border:    #e2e8f0;
  --text:      #0f172a;
  --text-muted:#64748b;
  --text-inv:  #f8fafc;

  --gold:      #d4af37;
  --gold-2:    #f4c430;
  --silver:    #9ca3af;
  --silver-2:  #d1d5db;

  --up:        #10b981;
  --down:      #ef4444;

  --radius:    14px;
  --radius-lg: 20px;
  --shadow:    0 2px 10px rgba(15,23,42,.06);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.10);
}

.container { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* --- APP BAR --- */
.app-bar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--text-inv);
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.app-bar__inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; }
.brand__logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(212,175,55,.35);
}
.nav-pill { display: none; gap: 4px; background: rgba(255,255,255,.06); padding: 4px; border-radius: 999px; }
.nav-pill__item { padding: 6px 14px; border-radius: 999px; font-weight: 500; font-size: 14px; color: rgba(255,255,255,.85); transition: .2s; }
.nav-pill__item:hover { background: rgba(255,255,255,.12); color: #fff; }

@media (min-width: 640px) { .nav-pill { display: inline-flex; } }

/* --- MAIN --- */
.main { padding: 16px 16px 24px; }

/* --- HERO --- */
.hero {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: var(--text-inv);
  padding: 24px;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: -50% -20% auto auto; width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(212,175,55,.25), transparent 70%);
  pointer-events: none;
}
.hero__title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 4px; }
.hero__date  { font-size: 14px; color: rgba(255,255,255,.7); }
.hero__update {
  display: inline-block; margin-top: 12px;
  background: rgba(255,255,255,.08); padding: 6px 14px; border-radius: 999px;
  font-size: 12px; color: rgba(255,255,255,.85);
}

/* --- TABS --- */
.tabs {
  display: flex; gap: 8px; margin: 0 -4px 16px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding: 0 4px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  padding: 10px 16px;
  background: var(--surface); color: var(--text);
  border-radius: 999px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); white-space: nowrap;
  transition: transform .15s, background .15s, color .15s;
}
.tab.is-active {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #0f172a;
  box-shadow: 0 6px 18px rgba(212,175,55,.35);
}
.tab:active { transform: scale(.96); }

.tab-pane { display: none; }
.tab-pane.is-active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- SECTION TITLE --- */
.section-title { font-size: 18px; margin: 8px 0 12px; letter-spacing: -.01em; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.section-more { color: var(--gold); font-weight: 600; font-size: 13px; }
.section-more--muted { color: var(--text-muted); font-size: 12px; }

/* --- PRICE CARD --- */
.price-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 480px) { .price-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 720px) { .price-grid { grid-template-columns: 1fr 1fr; } }

.price-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--gold);
  position: relative;
  transition: transform .15s, box-shadow .15s;
}
.price-card:active { transform: scale(.98); }
.price-card.silver { border-left-color: var(--silver); }
.price-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.price-card__brand { font-weight: 700; font-size: 15px; letter-spacing: .02em; text-transform: uppercase; color: var(--text); }
.price-card__name { color: var(--text-muted); font-size: 12px; margin-bottom: 10px; }
.price-card__row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 14px;
}
.price-card__row .label { color: var(--text-muted); }
.price-card__row .value { font-weight: 700; font-variant-numeric: tabular-nums; }
.price-card__row .value--sell { color: var(--gold); }
.price-card.silver .price-card__row .value--sell { color: #4b5563; }
.price-card__unit { margin-top: 6px; font-size: 11px; color: var(--text-muted); text-align: right; }

.badge {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.badge.up   { background: rgba(16,185,129,.12); color: var(--up); }
.badge.down { background: rgba(239,68,68,.12);  color: var(--down); }

.empty {
  grid-column: 1/-1;
  padding: 24px; text-align: center;
  background: var(--surface); border-radius: var(--radius);
  color: var(--text-muted); border: 1px dashed var(--border);
}

/* --- NEWS --- */
.news-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .news-grid { grid-template-columns: 1fr 1fr; } }

.news-card {
  display: block;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.news-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.news-card__image {
  width: 100%; aspect-ratio: 16/9;
  background: var(--surface-2) center/cover no-repeat;
}
.news-card__image--placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}
.news-card__body { padding: 12px 14px 14px; }
.news-card__meta {
  display: flex; gap: 6px; align-items: center;
  color: var(--text-muted); font-size: 11px; margin-bottom: 6px;
}
.news-card__cat {
  background: rgba(212,175,55,.12); color: #a17c1b;
  padding: 2px 8px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.news-card__title { font-size: 15px; line-height: 1.35; margin-bottom: 6px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-card__excerpt { font-size: 13px; color: var(--text-muted); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* --- ECOSYSTEM LINKS --- */
.eco-section { margin-top: 24px; }
.eco-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .eco-grid { grid-template-columns: 1fr 1fr; } }

.eco-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.eco-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.eco-card__icon {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.eco-card__icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.eco-card__body { flex: 1; min-width: 0; }
.eco-card__title { font-weight: 700; font-size: 14px; color: var(--text); }
.eco-card__desc  { font-size: 12px; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.eco-card__arrow { color: var(--text-muted); font-size: 20px; }

/* --- SEO CONTENT --- */
.seo-content {
  margin-top: 28px;
  background: var(--surface); border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.seo-content h2 { font-size: 17px; margin-bottom: 10px; }
.seo-content p { font-size: 14px; color: var(--text-muted); }
.seo-content strong { color: var(--text); }

/* --- BOTTOM NAV --- */
.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 90;
  background: rgba(255,255,255,.95);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav__item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; color: var(--text-muted); font-size: 11px; font-weight: 600;
}
.bottom-nav__icon { font-size: 20px; }
.bottom-nav__item:active { color: var(--gold); transform: scale(.95); }

/* --- FOOTER --- */
.footer {
  margin-top: 32px;
  background: #0f172a; color: rgba(255,255,255,.75);
  padding: 28px 0 16px;
}
.footer__grid { display: grid; gap: 24px; grid-template-columns: 1fr; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
@media (min-width: 640px) { .footer__grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer__title { color: #fff; font-weight: 700; margin-bottom: 8px; }
.footer__desc  { font-size: 13px; line-height: 1.6; }
.footer__links li { margin: 6px 0; font-size: 13px; }
.footer__links a:hover { color: var(--gold-2); }
.footer__bottom { padding-top: 16px; text-align: center; font-size: 12px; color: rgba(255,255,255,.55); }

/* --- NEWS DETAIL --- */
.article { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.article__head { margin-bottom: 14px; }
.article__title { font-size: 22px; line-height: 1.3; margin-bottom: 8px; }
.article__meta { color: var(--text-muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.article__content { font-size: 15px; line-height: 1.75; }
.article__content img { border-radius: 10px; margin: 14px 0; }
.article__content h2, .article__content h3 { margin-top: 20px; }
.article__content p { margin-bottom: 14px; }
.article__source {
  margin-top: 16px; padding: 10px 12px; background: var(--surface-2);
  border-radius: 10px; font-size: 12px; color: var(--text-muted);
}

.news-list { display: grid; gap: 14px; margin-top: 16px; }

/* --- BACK LINK --- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 8px 0 14px; color: var(--text-muted); font-size: 13px; font-weight: 500;
}
