/* ===== Tỷ Giá / Giá Vàng page ===== */

.tg-main { min-height: calc(100vh - 200px); padding: 28px 0 60px; background: linear-gradient(180deg, #faf9ff 0%, #fff 100%); }
.tg-container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.tg-page-title { font-size: 28px; font-weight: 800; color: #1e1b4b; margin: 0 0 8px; text-align: center; line-height: 1.2; }
.tg-page-desc { font-size: 14px; color: #6b7280; text-align: center; margin: 0 0 24px; }

/* Tabs */
.tg-tabs { display: flex; gap: 6px; margin-bottom: 20px; background: #f3f4f6; padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.tg-tab { flex: 1 1 auto; min-width: 130px; padding: 10px 16px; border: none; background: transparent; font-size: 14px; font-weight: 600; color: #6b7280; cursor: pointer; border-radius: 8px; transition: all 0.15s; white-space: nowrap; }
.tg-tab:hover { background: rgba(255,255,255,0.7); color: #1e1b4b; }
.tg-tab.active { background: #fff; color: #1e1b4b; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }

/* Panel */
.tg-panel { display: none; animation: tgFadeIn 0.2s ease; }
.tg-panel.active { display: block; }
@keyframes tgFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Loading state */
.tg-loading { text-align: center; padding: 60px 20px; color: #9ca3af; font-size: 14px; }
.tg-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; padding: 12px 16px; border-radius: 10px; margin: 12px 0; font-size: 13px; }

/* Source line above table */
.tg-source-line { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding: 10px 14px; background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); flex-wrap: wrap; gap: 8px; }
.tg-source-name { font-size: 15px; font-weight: 700; color: #1e1b4b; }
.tg-source-time { font-size: 12px; color: #6b7280; }
.tg-note { font-size: 13px; color: #6b7280; margin: 0 0 12px; }

/* Table */
.tg-table-wrap { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid #e5e7eb; }
.tg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tg-table thead th { background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%); color: #fff; padding: 12px 14px; text-align: left; font-weight: 700; font-size: 13px; letter-spacing: 0.3px; }
.tg-table thead th.num { text-align: right; }
.tg-table tbody tr { border-top: 1px solid #f3f4f6; transition: background 0.1s; }
.tg-table tbody tr:hover { background: #faf9ff; }
.tg-table tbody td { padding: 10px 14px; color: #1e1b4b; }
.tg-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: #4c1d95; }
.tg-table tbody td.code { font-weight: 700; color: #4c1d95; }
.tg-table tbody td.code-with-flag { display: flex; align-items: center; gap: 8px; }
.tg-flag { font-size: 18px; }
.tg-currency-name { display: inline-block; color: #6b7280; font-weight: 400; font-size: 12px; margin-left: 6px; }

/* Intl grid */
.tg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tg-grid-card { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); border: 1px solid #e5e7eb; transition: transform 0.15s, box-shadow 0.15s; }
.tg-grid-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(124,58,237,0.12); border-color: #c4b5fd; }
.tg-grid-flag { font-size: 22px; margin-bottom: 4px; }
.tg-grid-code { font-size: 14px; font-weight: 800; color: #4c1d95; margin-bottom: 2px; }
.tg-grid-name { font-size: 11px; color: #9ca3af; margin-bottom: 8px; line-height: 1.3; }
.tg-grid-value { font-size: 18px; font-weight: 800; color: #1e1b4b; font-variant-numeric: tabular-nums; }
.tg-grid-unit { font-size: 11px; color: #6b7280; margin-top: 2px; }

/* Gold VN — multiple sources */
.tg-gold-source { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid #e5e7eb; margin-bottom: 14px; overflow: hidden; }
.tg-gold-source-name { font-size: 15px; font-weight: 800; color: #1e1b4b; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid #fbbf24; display: flex; align-items: center; gap: 8px; }
.tg-gold-source-name::before { content: '🥇'; font-size: 20px; }
.tg-gold-source.error { background: #fef2f2; border-color: #fecaca; }
.tg-gold-source.error .tg-gold-source-name { color: #b91c1c; border-bottom-color: #fca5a5; }
.tg-gold-source.error .tg-gold-source-name::before { content: '⚠'; }

.tg-gold-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tg-gold-table thead th { background: #faf9ff; color: #4c1d95; padding: 8px 10px; text-align: left; font-weight: 700; font-size: 12px; border-bottom: 1px solid #e5e7eb; }
.tg-gold-table thead th.num { text-align: right; }
.tg-gold-table tbody tr { border-top: 1px solid #f3f4f6; }
.tg-gold-table tbody td { padding: 10px; color: #1e1b4b; line-height: 1.4; }
.tg-gold-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.tg-gold-table tbody td.buy { color: #15803d; }
.tg-gold-table tbody td.sell { color: #b91c1c; }
.tg-gold-table tbody td.type { font-weight: 600; }

/* Gold intl card */
.tg-gold-intl-card { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border: 1px solid #d97706; border-radius: 14px; padding: 22px 24px; max-width: 480px; margin: 0 auto; }
.tg-gold-intl-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid rgba(217,119,6,0.2); }
.tg-gold-intl-row:last-child { border-bottom: none; }
.tg-gold-intl-label { font-size: 14px; font-weight: 600; color: #78350f; }
.tg-gold-intl-value { font-size: 24px; font-weight: 800; color: #78350f; font-variant-numeric: tabular-nums; }
.tg-gold-intl-value.up { color: #15803d; }
.tg-gold-intl-value.down { color: #b91c1c; }
.tg-gold-intl-unit { font-size: 12px; color: #92400e; font-weight: 600; }

/* Disclaimer */
.tg-disclaimer { margin-top: 32px; padding: 16px 20px; background: #fefce8; border: 1px solid #fde68a; border-radius: 10px; font-size: 12px; color: #78350f; line-height: 1.6; }
.tg-disclaimer p { margin: 0 0 6px; }
.tg-disclaimer p:last-child { margin: 0; }
.tg-source-credits { color: #92400e; font-style: italic; }

/* Responsive */
@media (max-width: 700px) {
  .tg-page-title { font-size: 22px; }
  .tg-tabs { font-size: 12px; }
  .tg-tab { min-width: auto; padding: 8px 10px; font-size: 12px; }
  .tg-table { font-size: 12px; }
  .tg-table thead th, .tg-table tbody td { padding: 8px 10px; }
  .tg-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tg-grid-card { padding: 10px; }
  .tg-grid-value { font-size: 15px; }
  .tg-gold-table { font-size: 11px; }
  .tg-gold-table thead th, .tg-gold-table tbody td { padding: 6px 8px; }
  .tg-gold-intl-value { font-size: 20px; }
}
