/* Blog & tin-tuc — App Báo chuyển tiền */
:root {
  color-scheme: light;
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #0369a1;
  --accent-hover: #0284c7;
  --accent-soft: #e0f2fe;
  --accent-dark: #0c4a6e;
  --success: #059669;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

* { box-sizing: border-box; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 56px;
}

/* —— Nav —— */
.topnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  font-size: 0.9rem;
}
.topnav a {
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  transition: background var(--transition), color var(--transition);
}
.topnav a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.topnav span { color: var(--border); user-select: none; }

/* —— Hero (index) —— */
.blog-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 45%, var(--accent) 100%);
  border-radius: 24px;
  padding: 40px 32px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.blog-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.12), transparent 50%);
  pointer-events: none;
}
.blog-hero-inner { position: relative; z-index: 1; }
.blog-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.14);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
}
.blog-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.blog-hero p {
  margin: 0;
  opacity: 0.92;
  max-width: 640px;
  font-size: 1.05rem;
  line-height: 1.6;
}
.blog-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.2);
}
.blog-stat strong { display: block; font-size: 1.35rem; }
.blog-stat span { font-size: 0.82rem; opacity: 0.85; }

/* —— Toolbar: search + filter —— */
.blog-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .blog-toolbar { grid-template-columns: 1fr; }
}
.blog-search-wrap { position: relative; }
.blog-search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}
#blog-search {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--bg-elevated);
  transition: border-color var(--transition), box-shadow var(--transition);
}
#blog-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.blog-sort select {
  padding: 14px 36px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--bg-elevated);
  cursor: pointer;
  min-height: 50px;
}

/* —— Category chips —— */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.blog-filter-chip {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.blog-filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.blog-filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.blog-filter-chip .count {
  opacity: 0.75;
  font-size: 0.78rem;
  margin-left: 4px;
}

.blog-results-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  min-height: 1.4em;
}

/* —— Post grid —— */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.blog-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  opacity: 0;
  transform: translateY(12px);
}
.blog-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}
.blog-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.8rem;
}
.blog-card-category {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.blog-card-date { color: var(--text-muted); }
.blog-card h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.blog-card h2 a {
  color: var(--text);
  text-decoration: none;
}
.blog-card h2 a:hover { color: var(--accent); }
.blog-card-desc {
  flex: 1;
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}
.blog-card-link::after {
  content: "→";
  transition: transform var(--transition);
}
.blog-card:hover .blog-card-link::after { transform: translateX(4px); }

.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--text-muted);
}

/* —— Pagination —— */
.blog-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}
.blog-pagination button {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
}
.blog-pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.blog-pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.blog-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* —— Promo card —— */
.blog-promo {
  background: linear-gradient(135deg, #ecfdf5, #e0f2fe);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 28px;
}
.blog-promo h2 { margin: 0 0 8px; font-size: 1.15rem; }
.blog-promo p { margin: 0 0 16px; color: var(--text-muted); }

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff !important;
  font-weight: 600;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(3, 105, 161, 0.35);
  transition: transform var(--transition), box-shadow var(--transition);
}
.cta:hover {
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(3, 105, 161, 0.4);
}

.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* —— Article page —— */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s linear;
}

.article-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.article-breadcrumb a { color: var(--text-muted); }
.article-breadcrumb a:hover { color: var(--accent); }

.article-hero {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.article-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}
.article-hero-category {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
}
.article-hero-date { color: var(--text-muted); align-self: center; }
.article-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.35rem, 3.5vw, 1.85rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.article-hero-lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 900px) {
  .article-layout.has-toc {
    grid-template-columns: 220px 1fr;
    align-items: start;
  }
}

.article-toc {
  display: none;
  position: sticky;
  top: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 0.85rem;
}
@media (min-width: 900px) {
  .article-layout.has-toc .article-toc { display: block; }
}
.article-toc-title {
  margin: 0 0 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}
.article-toc ul { margin: 0; padding: 0; list-style: none; }
.article-toc li { margin-bottom: 6px; }
.article-toc a {
  color: var(--text-muted);
  display: block;
  padding: 4px 0;
  border-left: 2px solid transparent;
  padding-left: 10px;
  transition: all var(--transition);
}
.article-toc a:hover,
.article-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.article-body {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.article-prose h2 {
  margin: 2em 0 0.75em;
  font-size: 1.25rem;
  line-height: 1.35;
  color: var(--text);
  scroll-margin-top: 24px;
}
.article-prose h2:first-child { margin-top: 0; }
.article-prose h3 {
  margin: 1.5em 0 0.5em;
  font-size: 1.05rem;
  color: #334155;
}
.article-prose p { margin: 0 0 1em; color: #334155; }
.article-prose ul, .article-prose ol {
  margin: 0 0 1.25em;
  padding-left: 1.35em;
}
.article-prose li { margin-bottom: 0.4em; }
.article-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25em 0;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.article-prose th,
.article-prose td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
}
.article-prose tr:nth-child(even) { background: #f8fafc; }
.article-prose a { font-weight: 500; }

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* FAQ accordion */
.faq-section { margin-top: 2.5em; padding-top: 2em; border-top: 1px solid var(--border); }
.faq-section > h2 { margin-top: 0; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fafbfc;
  transition: border-color var(--transition);
}
.faq-item[open] { border-color: var(--accent); }
.faq-item summary {
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--accent);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer {
  padding: 0 18px 14px;
  color: var(--text-muted);
  line-height: 1.6;
  animation: faqOpen 0.3s ease;
}
@keyframes faqOpen {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Related posts */
.related-section { margin-top: 2.5em; padding-top: 2em; border-top: 1px solid var(--border); }
.related-section h2 { margin-top: 0; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.related-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
  color: var(--text);
  transition: all var(--transition);
}
.related-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
  color: var(--accent-dark);
}
.related-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.4;
  margin: 0;
}

.article-cta-bar {
  margin-top: 28px;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  border-radius: var(--radius);
  color: #fff;
  text-align: center;
}
.article-cta-bar p { margin: 0 0 16px; opacity: 0.9; }
