:root {
  --bg: #0b0b10;
  --card: #15151d;
  --text: #f5f2e8;
  --muted: #b9b3a4;
  --accent: #d4af37;
  --accent-2: #b8932f;
  --border: #26262f;
  --shadow: 0 4px 16px rgba(0,0,0,0.5);
  --radius: 14px;
  --font-ar: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}
html[data-theme="light"] {
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 16px rgba(30,41,59,0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  font-feature-settings: "tnum";
  line-height: 1.6;
  min-height: 100vh;
}
html[lang="en"] body { font-family: var(--font-en); }
html[lang="en"] .ar-only { display: none; }
html:not([lang="en"]) .en-only { display: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.header { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.brand { text-decoration: none; color: var(--accent); font-weight: 700; font-size: 1.4rem; letter-spacing: 0.5px; }
.nav { display: flex; gap: 14px; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; font-size: 0.95rem; }
.nav a:hover { color: var(--accent); }
.controls { display: flex; gap: 8px; }
.btn { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 0.9rem; min-height: 44px; min-width: 44px; }
.btn-primary { background: var(--accent); color: #1e293b; border-color: var(--accent); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }

.hero { padding: 24px 0 8px; }
.hero h1 { margin: 0 0 4px; font-size: 1.8rem; }
.subtitle { margin: 0 0 12px; color: var(--muted); }
.live-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%{transform:scale(1);opacity:1} 50%{transform:scale(1.6);opacity:0.5} 100%{transform:scale(1);opacity:1} }
.btn, .nav a, .badge { font-weight: 500; }
h1, h2, h3 { font-weight: 600; }
.brand { font-weight: 700; }
.card-value, .price-table td, .hero-price-value { font-weight: 700; }
.live-label { font-weight: 700; letter-spacing: 0.05em; color: #22c55e; }
.chart-svg { width: 100%; height: 200px; }
.chart-change { margin-top: 8px; font-weight: 700; }
.change-up { color: #22c55e; }
.change-down { color: #ef4444; }
.ico { width: 18px; height: 18px; vertical-align: middle; display: inline-block; }
.last-update { color: var(--muted); font-size: 0.9rem; }
.badge { display: inline-block; padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; margin-top: 8px; }
.badge-warn { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.hidden { display: none !important; }

.ad-slot { display: none !important; }

.section { padding: 20px 0; }
.hero-price { text-align: center; padding: 20px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
.hero-price-label { display: block; color: var(--muted); font-size: 0.9rem; }
.hero-price-value {
  display: block;
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 700;
  background: linear-gradient(135deg, #b8860b, #d4af37, #e9c46a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.hero-price-unit { color: var(--muted); font-size: 0.9rem; }
.card-value, .price-table td, .calc-result, #lastUpdate, .hero-price-value { font-variant-numeric: tabular-nums; }
.hero-date { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.card { display:block; text-decoration:none; color:inherit; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; box-shadow: var(--shadow); }
.card-label { color: var(--muted); font-size: 0.85rem; }
.card-value { font-size: 1.2rem; font-weight: 700; margin: 4px 0; }
.card-unit { color: var(--muted); font-size: 0.75rem; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.price-table { width: 100%; border-collapse: collapse; }
.price-table th, .price-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: start; }
.price-table th { background: var(--accent); color: #1e293b; font-weight: 600; }
.price-table tr:last-child td { border-bottom: none; }

.units { margin-top: 16px; }
.units-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.units-head h2 { margin: 0; font-size: 1.1rem; }

.calc { display: grid; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.calc label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calc input, .calc select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; background: var(--card); color: var(--text); text-align: left; direction: ltr; }
.calc-result { font-size: 1.1rem; }

.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 8px 0 0; color: var(--muted); }

.footer { padding: 24px 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); margin-top: 24px; }
.footer-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.footer nav { display: flex; flex-direction: column; gap: 6px; }
.footer a { color: var(--text); text-decoration: none; font-size: 0.9rem; }
.footer nav strong { margin-bottom: 2px; }
.footer .note + .note { margin-top: 6px; }

@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; gap: 14px; }
}
.breadcrumb { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; }
.breadcrumb a { color: #d4af37; text-decoration: none; }
.note { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 600px) {
  .hero-price-value { font-size: 2rem; }
  .nav { gap: 8px; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.arrow { font-size: 0.75rem; margin-inline-start: 6px; font-weight: 700; }
.arrow-up { color: #22c55e; }
.arrow-down { color: #ef4444; }

/* Hover feedback — cards, tables, FAQ, footer, breadcrumb */
.card, .faq-item, .footer a, .price-table tbody tr, .breadcrumb a { transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(212,175,55,0.18); }
.price-table tbody tr:hover { background: rgba(212,175,55,0.08); }
.faq-item:hover { border-color: var(--accent); }
.faq-item summary:hover { color: var(--accent); }
.footer a:hover { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; color: var(--accent); }

@keyframes goldFlash { 0% { background-color: rgba(212,175,55,0.3); } 100% { background-color: transparent; } }
.flash { animation: goldFlash 1s ease-out; }

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton { background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
