/* HDF Price Widgets — loaded once globally in WordPress
   Uses WordPress theme CSS variables for colors.
   Falls back to sensible defaults if theme doesn't define them. */

:root {
  --hdf-primary:    var(--wp--preset--color--primary,       #1d4ed8);
  --hdf-accent:     var(--wp--preset--color--vivid-red,     #dc2626);
  --hdf-text:       var(--wp--preset--color--foreground,    #111827);
  --hdf-muted:      var(--wp--preset--color--contrast-2,    #6b7280);
  --hdf-bg:         var(--wp--preset--color--background,    #ffffff);
  --hdf-border:     var(--wp--preset--color--contrast-3,    #e5e7eb);
  --hdf-surface:    var(--wp--preset--color--base-2,        #f9fafb);
  --hdf-green:      #16a34a;
  --hdf-red:        #dc2626;
  --hdf-radius:     8px;
  --hdf-font:       inherit;
}

/* ── Loading skeleton ── */
.hdf-widget[data-loading] { min-height: 80px; background: linear-gradient(90deg, var(--hdf-surface) 25%, var(--hdf-border) 50%, var(--hdf-surface) 75%); background-size: 200% 100%; animation: hdf-shimmer 1.4s infinite; border-radius: var(--hdf-radius); }
@keyframes hdf-shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* ── Price hero card ── */
.hdf-hero { background: var(--hdf-text); color: #fff; border-radius: var(--hdf-radius); padding: 24px; margin: 0 0 24px; }
.hdf-hero-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; }
.hdf-hero-meta { font-size: 12px; opacity: .6; margin-top: 4px; }
.hdf-hero-price { font-size: 36px; font-weight: 800; line-height: 1; }
.hdf-hero-unit { font-size: 12px; opacity: .6; margin-top: 4px; }
.hdf-hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; }
.hdf-pill { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.hdf-pill strong { margin-right: 3px; }

/* ── Live badge ── */
.hdf-live { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,68,68,.15); border: 1px solid rgba(255,68,68,.4); border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; color: #ff6b6b; text-transform: uppercase; letter-spacing: .5px; }
.hdf-live i { width: 7px; height: 7px; border-radius: 50%; background: #ff4444; display: inline-block; animation: hdf-blink 1.2s ease-in-out infinite; }
@keyframes hdf-blink { 0%,100%{opacity:1} 50%{opacity:.2} }

/* ── Change badge ── */
.hdf-change { display: inline-flex; align-items: center; gap: 4px; border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 600; margin-top: 8px; }
.hdf-change.up   { color: var(--hdf-green); background: #f0fdf4; border: 1px solid #bbf7d0; }
.hdf-change.down { color: var(--hdf-red);   background: #fff1f2; border: 1px solid #fecdd3; }
.hdf-change.none { color: var(--hdf-muted); background: var(--hdf-surface); border: 1px solid var(--hdf-border); }

/* ── Tables ── */
.hdf-table-wrap { overflow-x: auto; border-radius: var(--hdf-radius); border: 1px solid var(--hdf-border); margin: 20px 0; }
.hdf-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hdf-table caption { text-align: left; padding: 12px 14px; font-size: 14px; font-weight: 700; color: var(--hdf-text); background: var(--hdf-surface); border-bottom: 1px solid var(--hdf-border); }
.hdf-table thead tr { background: var(--hdf-text); }
.hdf-table thead th { padding: 10px 14px; color: #fff; font-size: 12px; font-weight: 700; text-align: left; letter-spacing: .3px; }
.hdf-table thead th:not(:first-child) { text-align: center; }
.hdf-table tbody tr { border-bottom: 1px solid var(--hdf-border); transition: background .15s; }
.hdf-table tbody tr:hover { background: #f0f6ff; }
.hdf-table tbody tr:last-child { border-bottom: none; }
.hdf-table td { padding: 10px 14px; color: var(--hdf-text); }
.hdf-table td:not(:first-child) { text-align: center; font-variant-numeric: tabular-nums; }
.hdf-table .hdf-rank { font-weight: 700; color: var(--hdf-primary); }
.hdf-table .hdf-price-cell { font-weight: 700; }
.hdf-table .hdf-tag { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.hdf-table .hdf-tag.cheap  { background: #f0fdf4; color: var(--hdf-green); }
.hdf-table .hdf-tag.exp    { background: #fff1f2; color: var(--hdf-red); }

/* ── Callout / Read Also ── */
.hdf-callout { border-left: 3px solid var(--hdf-primary); background: #f0f6ff; border-radius: 0 var(--hdf-radius) var(--hdf-radius) 0; padding: 10px 14px; margin: 20px 0; font-size: 13px; }
.hdf-callout .hdf-callout-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--hdf-muted); }
.hdf-callout a { color: var(--hdf-primary); font-weight: 600; text-decoration: none; font-size: 14px; }
.hdf-callout a:hover { text-decoration: underline; }

/* ── Info box ── */
.hdf-info { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: var(--hdf-radius); padding: 12px 16px; font-size: 13px; color: #0c4a6e; line-height: 1.6; margin: 16px 0; }

/* ── Source badge ── */
.hdf-source { display: inline-block; background: #fffbe6; border: 1px solid #ffe58f; border-radius: 4px; padding: 2px 8px; font-size: 11px; color: #92400e; font-weight: 600; margin: 8px 0; }

/* ── FAQ ── */
.hdf-faq { margin: 28px 0; }
.hdf-faq h2 { font-size: 18px; font-weight: 700; border-bottom: 2px solid var(--hdf-border); padding-bottom: 10px; margin-bottom: 0; }
.hdf-faq-item { border-bottom: 1px solid var(--hdf-border); padding: 14px 0; }
.hdf-faq-item h3 { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--hdf-text); }
.hdf-faq-item p { margin: 0; font-size: 13px; color: #374151; line-height: 1.7; }

/* ── Breadcrumb ── */
.hdf-breadcrumb { font-size: 12px; color: var(--hdf-muted); margin-bottom: 16px; }
.hdf-breadcrumb a { color: var(--hdf-primary); text-decoration: none; }
.hdf-breadcrumb a:hover { text-decoration: underline; }
.hdf-breadcrumb span { margin: 0 5px; opacity: .5; }

/* ── Stat pills (standalone) ── */
.hdf-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.hdf-pill-item { background: #f0f6ff; border: 1px solid #cce0ff; border-radius: 20px; padding: 5px 14px; font-size: 12px; color: var(--hdf-primary); font-weight: 600; }

/* ── Mobile ── */
@media (max-width: 640px) {
  .hdf-hero { padding: 18px; }
  .hdf-hero-price { font-size: 28px; }
  .hdf-hero-top { flex-direction: column; }
}

/* ── Chart ── */
.hdf-chart-wrap { margin: 20px 0; border-radius: var(--hdf-radius); border: 1px solid var(--hdf-border); padding: 16px; background: var(--hdf-bg); }
.hdf-chart-wrap h3 { font-size: 14px; font-weight: 700; margin: 0 0 12px; color: var(--hdf-text); }
.hdf-chart-wrap canvas { max-height: 280px; }

/* ── Variant pills ── */
.hdf-variant-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
.hdf-variant-pill { padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; border: 1px solid var(--hdf-border); background: var(--hdf-surface); color: var(--hdf-text); }
.hdf-variant-pill.active { background: var(--hdf-primary); color: #fff; border-color: var(--hdf-primary); }

/* ── Delta badge ── */
.hdf-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; margin: 8px 0 0; }
.hdf-delta.up   { background: #f0fdf4; color: var(--hdf-green); border: 1px solid #bbf7d0; }
.hdf-delta.down { background: #fff1f2; color: var(--hdf-red);   border: 1px solid #fecdd3; }
.hdf-delta.flat { background: var(--hdf-surface); color: var(--hdf-muted); border: 1px solid var(--hdf-border); }

/* ── City pills ── */
.hdf-city-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.hdf-city-pills a { padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--hdf-surface); border: 1px solid var(--hdf-border); color: var(--hdf-primary); text-decoration: none; white-space: nowrap; transition: background .15s; }
.hdf-city-pills a:hover { background: #e0ecff; }

/* ── Cross-metal comparison ── */
.hdf-cross-metal { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.hdf-cross-metal-card { flex: 1 1 140px; border: 1px solid var(--hdf-border); border-radius: var(--hdf-radius); padding: 14px 16px; background: var(--hdf-surface); text-align: center; }
.hdf-cross-metal-card .hdf-cmc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--hdf-muted); margin-bottom: 6px; }
.hdf-cross-metal-card .hdf-cmc-price { font-size: 20px; font-weight: 800; color: var(--hdf-text); }
.hdf-cross-metal-card .hdf-cmc-unit  { font-size: 11px; color: var(--hdf-muted); margin-top: 2px; }

/* ── Fill-up calculator ── */
.hdf-fillup { border: 1px solid var(--hdf-border); border-radius: var(--hdf-radius); padding: 16px; background: var(--hdf-surface); margin: 20px 0; }
.hdf-fillup h3 { font-size: 14px; font-weight: 700; margin: 0 0 12px; color: var(--hdf-text); }
.hdf-fillup-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--hdf-border); font-size: 13px; }
.hdf-fillup-row:last-child { border-bottom: none; font-weight: 700; }
