* { margin: 0; padding: 0; box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --bg: #06070b;
  --bg-gradient: linear-gradient(180deg, #06070b 0%, #0c0d14 100%);
  --surface: #111219;
  --surface-2: #181923;
  --surface-3: #1f2130;
  --border: rgba(255,255,255,0.05);
  --border-hover: rgba(245,183,49,0.25);
  --text: #eeeef1;
  --text-muted: #6b6f82;
  --gold: #f0b326;
  --gold-light: #ffd97a;
  --gold-dim: rgba(240,179,38,0.12);
  --green: #2dd4a0;
  --green-dim: rgba(45,212,160,0.12);
  --red: #f06060;
  --red-dim: rgba(240,96,96,0.12);
  --silver: #b8bdd4;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

body {
  font-family: 'Cairo', 'Segoe UI', sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(240,179,38,0.03) 0%, transparent 60%);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

/* ─── Topbar ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6,7,11,0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--bg);
  font-weight: 800;
}

.logo-text {
  font-weight: 800;
  font-size: 1.15rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45,212,160,0.4); }
  50% { box-shadow: 0 0 0 5px rgba(45,212,160,0); }
}

/* ─── Section Wrapper ─── */
.section-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0;
}

/* ─── Hero Section: Gold Karats ─── */
.hero-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.hero-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

.hero-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(240,179,38,0.08);
}

.hero-card-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.7rem;
  letter-spacing: 0.3px;
}

.hero-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.25rem 0;
}

.hero-card-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  font-feature-settings: 'tnum';
}

.hero-card-price.buy {
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 600;
}

.hero-card-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.hero-card-unit {
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  opacity: 0.4;
  text-align: center;
}

.hero-extra {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hero-extra-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hero-extra-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
  font-feature-settings: 'tnum';
}

/* ─── Section Header ─── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.section-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ─── Analytics Section ─── */
.analytics-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.analytics-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  transition: border-color 0.3s, transform 0.15s;
}

.metric-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.metric-icon {
  font-size: 0.7rem;
  font-weight: 800;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--gold-dim);
  color: var(--gold);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.metric-icon.signal { font-size: 1rem; font-weight: 900; }
.metric-icon.up { background: var(--green-dim); color: var(--green); }
.metric-icon.down { background: var(--red-dim); color: var(--red); }
.metric-icon.neutral { background: var(--gold-dim); color: var(--gold); }

.metric-body { flex: 1; min-width: 0; }

.metric-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  font-feature-settings: 'tnum';
}

.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.metric-value.gold { color: var(--gold); }

.metric-name {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.metric-desc {
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: 0.15rem;
  line-height: 1.4;
}

/* ─── Dashboard Grid ─── */
.dashboard-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.3s;
}

.card:hover { border-color: var(--border-hover); }
.card-full { grid-column: 1 / -1; }
.card-span-2 { grid-column: span 2; }
.card-accent { background: linear-gradient(135deg, var(--surface), rgba(240,96,96,0.03)); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  background: var(--gold-dim);
  color: var(--gold);
  letter-spacing: 0.3px;
}

.badge.red { background: var(--red-dim); color: var(--red); }
.badge.gold { background: var(--gold-dim); color: var(--gold); }

/* ─── International Gold ─── */
.intl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.intl-item {
  text-align: center;
  padding: 0.7rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.intl-item.primary { background: linear-gradient(135deg, var(--surface-2), rgba(240,179,38,0.06)); }

.intl-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gold);
  font-feature-settings: 'tnum';
}

.intl-value.small { font-size: 1rem; color: var(--text); }

.intl-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.change {
  text-align: center;
  font-size: 0.8rem;
  margin-top: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  display: inline-block;
}

.change.up { color: var(--green); background: var(--green-dim); }
.change.down { color: var(--red); background: var(--red-dim); }

/* ─── Currency / Dollar ─── */
.rate-display { text-align: center; padding: 0.8rem 0; }
.rate-display.market { border-top: 1px solid var(--border); margin-top: 0.7rem; padding-top: 0.7rem; }

.rate-main {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--gold);
  font-feature-settings: 'tnum';
}

.rate-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }
.rate-row { display: flex; justify-content: center; gap: 0.8rem; align-items: baseline; }
.rate-small-label { font-size: 0.75rem; color: var(--text-muted); }
.rate-small-value { font-size: 1.1rem; font-weight: 700; color: var(--text); font-feature-settings: 'tnum'; }

/* ─── Black Market ─── */
.bm-rates { display: flex; justify-content: center; align-items: center; gap: 2rem; padding: 1rem 0; }
.bm-divider { width: 1px; height: 45px; background: var(--border); }
.bm-item { text-align: center; }
.bm-value { font-size: 1.8rem; font-weight: 800; color: var(--text); font-feature-settings: 'tnum'; }
.bm-label { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.2rem; text-transform: uppercase; letter-spacing: 1.5px; }

/* ─── Tables ─── */
table { width: 100%; border-collapse: separate; border-spacing: 0; }

thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 0.6rem 0.9rem;
  text-align: right;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

thead th:first-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
thead th:last-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

tbody td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-feature-settings: 'tnum';
}

tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(255,255,255,0.015); }
tbody tr:last-child td { border-bottom: none; }

tbody tr.highlight-row { background: var(--gold-dim); }
tbody tr.highlight-row td { border-bottom-color: rgba(240,179,38,0.15); font-weight: 600; }

/* ─── Converter ─── */
.converter-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

.converter-field { flex: 1; min-width: 140px; }

.converter-field label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.converter-field input,
.converter-field select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.converter-field input:focus,
.converter-field select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240,179,38,0.1);
}

.converter-field select option { background: var(--surface); color: var(--text); }

.swap-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid rgba(240,179,38,0.2);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s;
}

.swap-btn:hover { background: var(--gold); color: var(--bg); transform: rotate(180deg); }

.converter-result { text-align: center; padding: 1rem 0 0.3rem; }

.converter-result-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
  font-feature-settings: 'tnum';
}

/* ─── Signal ─── */
.signal-gauge { text-align: center; padding: 1.2rem 0 0.8rem; }

.signal-dot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--text);
}

.signal-dot.buy { background: var(--green-dim); box-shadow: 0 0 24px rgba(45,212,160,0.15); color: var(--green); }
.signal-dot.sell { background: var(--red-dim); box-shadow: 0 0 24px rgba(240,96,96,0.15); color: var(--red); }
.signal-dot.neutral { background: var(--gold-dim); box-shadow: 0 0 24px rgba(240,179,38,0.15); color: var(--gold); }

.signal-text { font-size: 1.15rem; font-weight: 800; }
.signal-text.buy { color: var(--green); }
.signal-text.sell { color: var(--red); }
.signal-text.neutral { color: var(--gold); }

.signal-explain {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 0.5rem 0.8rem;
  line-height: 1.6;
}

.signal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }

.signal-stat {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 0.5rem 0.4rem;
  text-align: center;
}

.signal-stat-label { display: block; font-size: 0.58rem; color: var(--text-muted); }
.signal-stat-value { display: block; font-size: 0.85rem; font-weight: 700; color: var(--text); margin-top: 0.15rem; font-feature-settings: 'tnum'; }

/* ─── Silver ─── */
.silver-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }

.silver-item {
  text-align: center;
  padding: 0.9rem 0.5rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.silver-item:hover { background: var(--surface-3); }

.silver-grade {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--silver);
  background: rgba(184,189,212,0.08);
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
}

.silver-price { font-size: 1.25rem; font-weight: 800; color: var(--silver); font-feature-settings: 'tnum'; }
.silver-label { font-size: 0.63rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ─── Inflation ─── */
.inflation-current { text-align: center; padding: 0.8rem 0; }

.inflation-rate {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--red);
  font-feature-settings: 'tnum';
}

.inflation-label { font-size: 0.8rem; color: var(--text-muted); }
.inflation-year { font-size: 0.7rem; color: var(--text-muted); opacity: 0.5; }

.inflation-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 90px;
  padding: 1.2rem 0 1.5rem;
}

.inflation-bar {
  flex: 1;
  background: linear-gradient(to top, var(--red), rgba(240,96,96,0.3));
  border-radius: 4px 4px 0 0;
  position: relative;
  min-width: 18px;
  transition: opacity 0.2s;
  cursor: default;
}

.inflation-bar:hover { opacity: 0.75; }

.inflation-bar.estimated {
  background: linear-gradient(to top, var(--gold), rgba(240,179,38,0.3));
  border: 1px dashed rgba(240,179,38,0.4);
  border-bottom: none;
}

.inflation-note {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.6;
  padding-top: 0.5rem;
  font-style: italic;
}

.inflation-bar-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.inflation-bar-value {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-feature-settings: 'tnum';
}

/* ─── Chart Section ─── */
.chart-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.chart-toggle, .chart-periods, .chart-karat {
  display: flex;
  gap: 0.2rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}

.chart-toggle-btn, .chart-period-btn, .chart-karat-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chart-toggle-btn:hover, .chart-period-btn:hover, .chart-karat-btn:hover {
  color: var(--text);
}

.chart-toggle-btn.active, .chart-period-btn.active, .chart-karat-btn.active {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 700;
}

.chart-karat-btn {
  padding: 0.4rem 0.6rem;
  font-size: 0.7rem;
}

.chart-container {
  position: relative;
  height: 350px;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-top: 1rem;
}

.chart-stat {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 0.5rem 0.4rem;
  text-align: center;
}

.chart-stat-label {
  display: block;
  font-size: 0.58rem;
  color: var(--text-muted);
}

.chart-stat-value {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: 0.15rem;
  font-feature-settings: 'tnum';
}

/* ─── Misc ─── */
.source {
  color: var(--text-muted);
  font-size: 0.63rem;
  text-align: left;
  margin-top: 0.8rem;
  opacity: 0.45;
}

.vat-note { color: var(--text-muted); font-size: 0.7rem; margin-top: 0.4rem; font-style: italic; }

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 1.8rem 0;
  font-size: 0.8rem;
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.loading.hero-loading { padding: 2.5rem 0; font-size: 0.7rem; }

.hidden { display: none; }
.error { color: var(--red); text-align: center; padding: 0.8rem; font-size: 0.85rem; }

footer {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  opacity: 0.55;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .hero-cards { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .card-full, .card-span-2 { grid-column: 1; }
  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-controls { flex-direction: column; align-items: stretch; }
  .chart-toggle, .chart-periods, .chart-karat { justify-content: center; }
}

@media (max-width: 500px) {
  .hero-cards { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .hero-section, .analytics-section { padding: 0.8rem 0.8rem 0; }
  .hero-card { padding: 0.9rem 0.7rem; }
  .hero-card-price { font-size: 1.25rem; }
  .hero-card-price.buy { font-size: 1rem; }
  .dashboard-grid { padding: 0.8rem; gap: 0.6rem; }
  .card { padding: 1rem; }
  .rate-main { font-size: 1.8rem; }
  .bm-value { font-size: 1.5rem; }
  .intl-value { font-size: 1.1rem; }
  .intl-value.small { font-size: 0.9rem; }
  .converter-row { flex-direction: column; }
  .swap-btn { align-self: center; }
  .signal-stats { grid-template-columns: repeat(2, 1fr); }
  .silver-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .metric-card { padding: 0.9rem; }
  .metric-value { font-size: 1.1rem; }
  table { font-size: 0.78rem; }
  thead th, tbody td { padding: 0.45rem 0.6rem; }
  .chart-container { height: 250px; }
  .chart-stats { grid-template-columns: repeat(2, 1fr); }
  .chart-toggle-btn, .chart-period-btn { font-size: 0.65rem; padding: 0.35rem 0.55rem; }
}
