/* ═══════════════════════════════════════════════════════════
   tibr — نظام التصميم (نفس هوية التطبيق)
   ألوان مستمدّة من lib/core/theme.dart
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ذهبي داكن (البراند) */
  --dark-gold: #2C1D08;
  --mid-gold:  #4A3010;
  --gold:      #C9A84C;   /* الذهبي المميّز (أرقام/أيقونات) */
  --gold-soft: #8B6914;
  --gold-hi:   #E4C876;   /* لمعة أفتح للتدرّجات */

  /* أسطح (الوضع الفاتح) */
  --bg:        #FAF7F2;
  --card:      #FFFFFF;
  --border:    #EDE4D3;
  --title:     #2C1D08;
  --body:      #5A4A38;
  --muted:     #8A7A64;
  --sub-bg:    #F5F0E8;

  --up:   #1B8A4B;
  --down: #D14343;

  --header-grad: linear-gradient(135deg, var(--dark-gold), var(--mid-gold));
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 18px rgba(44,29,8,.07);
  --shadow-lg: 0 12px 40px rgba(44,29,8,.14);
  --maxw: 1120px;
  --font: 'Cairo', system-ui, 'Segoe UI', Tahoma, sans-serif;
}

[data-theme="dark"] {
  --bg:     #1C1410;
  --card:   #2A2018;
  --border: #3D3020;
  --title:  #EEE5D8;
  --body:   #CCBBA8;
  --muted:  #9A8A70;
  --sub-bg: #231A10;
  --gold:   #D8B65C;
  --shadow: 0 4px 18px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { color: var(--title); line-height: 1.3; margin: 0 0 .4em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 56px 0; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.center { text-align: center; }

/* ── الهيدر ─────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-grad);
  color: #fff;
  box-shadow: 0 2px 14px rgba(0,0,0,.18);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 18px;
  height: 66px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.logo img { height: 38px; width: 38px; object-fit: contain; }
.logo b { color: #fff; font-size: 1.35rem; letter-spacing: .5px; }
.nav { display: flex; gap: 2px; margin-inline-start: auto; align-items: center; }
.nav a {
  color: rgba(255,255,255,.86); padding: 7px 9px; border-radius: 9px;
  font-size: .88rem; font-weight: 600; transition: .18s; white-space: nowrap;
}
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav a.active { background: rgba(201,168,76,.28); color: #fff; }
.header-tools { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.12); color: #fff; border-radius: 11px;
  cursor: pointer; font-size: .82rem; font-weight: 700; display: grid; place-items: center;
  transition: .18s;
}
.icon-btn:hover { background: rgba(255,255,255,.22); }
.nav-toggle { display: none; }

/* مُبدّل الدولة العام */
.country-select { position: relative; }
.country-btn {
  display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.12);
  color: #fff; border-radius: 11px; cursor: pointer; font-family: var(--font);
  transition: .18s;
}
.country-btn:hover { background: rgba(255,255,255,.22); }
.country-btn .cflag { font-size: 1.1rem; line-height: 1; }
.country-btn b { font-size: .9rem; font-weight: 700; }
.country-btn .carrow { opacity: .7; font-size: .75rem; }
.country-menu {
  position: absolute; inset-block-start: 46px; inset-inline-end: 0; min-width: 190px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px; z-index: 60;
}
.cmenu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  padding: 10px 12px; border: none; background: none; border-radius: 10px;
  cursor: pointer; font-family: var(--font); font-size: .95rem; font-weight: 600; color: var(--body);
}
.cmenu-item:hover { background: var(--sub-bg); }
.cmenu-item.active { background: var(--mid-gold); color: #fff; }
[data-theme="dark"] .cmenu-item.active { background: var(--gold); color: #2C1D08; }

/* جدول الوحدات السريع */
.units-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.unit-box { background: var(--sub-bg); border-radius: 12px; padding: 14px; text-align: center; }
.unit-box .u { font-size: .82rem; color: var(--muted); }
.unit-box .p { font-size: 1.15rem; font-weight: 800; color: var(--gold-soft); margin-top: 4px; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .unit-box .p { color: var(--gold); }

/* مبدّل مقاطع (أيام الرسم / نوع السبيكة) */
.seg { display: inline-flex; background: var(--sub-bg); border-radius: 10px; padding: 3px; }
.seg button { border: none; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-family: var(--font); font-weight: 700; font-size: .85rem; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--gold-soft); box-shadow: var(--shadow); }
[data-theme="dark"] .seg button.on { color: var(--gold); }

/* الأسئلة الشائعة */
.faq { border-bottom: 1px solid var(--border); }
.faq summary { padding: 16px 4px; cursor: pointer; font-weight: 700; color: var(--title); list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--gold-soft); font-size: 1.3rem; }
.faq[open] summary::after { content: '−'; }
.faq p { padding: 0 4px 16px; color: var(--body); margin: 0; }

/* ── الهيرو ─────────────────────────────────────────────── */
.hero {
  background: var(--header-grad);
  color: #fff; padding: 62px 0 120px; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 78% 15%, rgba(201,168,76,.28), transparent 45%);
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { color: #fff; font-size: 2.7rem; font-weight: 800; margin-bottom: .3em; }
.hero p { color: rgba(255,255,255,.85); font-size: 1.15rem; max-width: 30em; }
.hero-cta { display: flex; gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.hero-art { display: grid; place-items: center; }
.hero-art img { width: min(300px, 70%); filter: drop-shadow(0 20px 40px rgba(0,0,0,.4)); }

/* ── الأزرار ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 13px 24px; border-radius: 12px; font-weight: 700; font-size: 1rem;
  font-family: var(--font); border: 1px solid transparent; transition: .2s;
}
.btn-gold { background: var(--gold); color: #2C1D08; }
.btn-gold:hover { background: var(--gold-hi); transform: translateY(-2px); }
.btn-ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.3); }
.btn-ghost:hover { background: rgba(255,255,255,.2); }
.btn-outline { background: transparent; color: var(--gold-soft); border-color: var(--border); }
[data-theme="dark"] .btn-outline { color: var(--gold); }
.btn-outline:hover { background: var(--sub-bg); }

/* ── البطاقات ───────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* شريط الأسعار المرفوع فوق الهيرو */
.live-strip {
  max-width: var(--maxw); margin: -80px auto 0; padding: 0 20px; position: relative; z-index: 5;
}
.live-strip .card { padding: 0; overflow: hidden; }
.live-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.live-head h3 { margin: 0; font-size: 1.05rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--up); display: inline-block; margin-inline-end: 6px; box-shadow: 0 0 0 3px rgba(27,138,75,.18); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(27,138,75,0); } }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); }
.tile { padding: 18px 20px; text-align: center; border-inline-end: 1px solid var(--border); }
.tile:last-child { border-inline-end: none; }
.tile .label { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.tile .val { font-size: 1.5rem; font-weight: 800; color: var(--gold-soft); }
[data-theme="dark"] .tile .val { color: var(--gold); }
.tile .chg { font-size: .82rem; font-weight: 700; margin-top: 3px; }

/* ── الجداول ────────────────────────────────────────────── */
.table-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.tibr { width: 100%; border-collapse: collapse; }
table.tibr th, table.tibr td { padding: 14px 16px; text-align: start; }
/* أعمدة القيم (كل الأعمدة عدا الأول) متوسّطة ومتناسقة عبر الموقع كله */
table.tibr th:not(:first-child), table.tibr td:not(:first-child) { text-align: center; }
table.tibr th:first-child, table.tibr td:first-child { width: 40%; }
table.tibr thead th {
  background: var(--sub-bg); color: var(--gold-soft); font-size: .85rem;
  font-weight: 700; border-bottom: 1px solid var(--border);
}
[data-theme="dark"] table.tibr thead th { color: var(--gold); }
table.tibr tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
table.tibr tbody tr:last-child { border-bottom: none; }
table.tibr tbody tr:hover { background: var(--sub-bg); }
table.tibr td.num { font-weight: 700; color: var(--title); font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .8rem; font-weight: 700; }
.pill.up { background: rgba(27,138,75,.12); color: var(--up); }
.pill.down { background: rgba(209,67,67,.12); color: var(--down); }

/* ── عناوين الأقسام ─────────────────────────────────────── */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 10px; }
.section-head h2 { font-size: 1.9rem; margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { color: var(--gold-soft); font-weight: 800; font-size: .9rem; letter-spacing: .5px; }
[data-theme="dark"] .eyebrow { color: var(--gold); }

/* ── المميزات ───────────────────────────────────────────── */
.feature { text-align: center; }
.feature .ico { width: 58px; height: 58px; border-radius: 16px; background: var(--sub-bg); display: grid; place-items: center; margin: 0 auto 14px; font-size: 1.7rem; }
.feature h3 { font-size: 1.1rem; margin-bottom: .3em; }
.feature p { color: var(--muted); font-size: .95rem; margin: 0; }

/* ── قسم التطبيق ────────────────────────────────────────── */
.app-cta { background: var(--header-grad); color: #fff; border-radius: 24px; padding: 46px; display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; }
.app-cta h2 { color: #fff; font-size: 1.9rem; }
.app-cta p { color: rgba(255,255,255,.85); max-width: 34em; }
.store-badge { display: inline-flex; align-items: center; gap: 10px; background: #000; color: #fff; padding: 12px 20px; border-radius: 13px; border: 1px solid rgba(255,255,255,.2); font-weight: 700; }
.store-badge:hover { background: #111; }

/* ── الأخبار ────────────────────────────────────────────── */
.news-item { display: block; padding: 18px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-item h3 { font-size: 1.05rem; margin-bottom: 6px; transition: color .15s; }
.news-item:hover h3 { color: var(--gold-soft); }
.news-item .meta { font-size: .82rem; color: var(--muted); }

/* ── الفوتر ─────────────────────────────────────────────── */
.site-footer { background: var(--dark-gold); color: rgba(255,255,255,.75); padding: 52px 0 24px; margin-top: 40px; }
.nl-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 0 0 22px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 26px; }
.nl-strip h4 { color: #fff; font-size: 1.15rem; }
.nl-form { display: flex; gap: 10px; }
.nl-form input { padding: 12px 15px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #fff; font-family: var(--font); min-width: 220px; }
.nl-form input::placeholder { color: rgba(255,255,255,.5); }
.nl-form .btn { padding: 12px 22px; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.site-footer .logo b { color: #fff; }
.site-footer a { color: rgba(255,255,255,.72); display: block; padding: 5px 0; transition: .15s; }
.site-footer a:hover { color: var(--gold); }
.socials { display: flex; gap: 10px; }
.socials a { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.1); display: grid; place-items: center; font-size: 1.15rem; }
.socials a:hover { background: var(--gold); color: #2C1D08; }
.foot-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 34px; padding-top: 20px; font-size: .85rem; text-align: center; }
.foot-bottom .disc { opacity: .6; font-size: .8rem; margin-top: 6px; }

/* ── الحاسبات ───────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; color: var(--title); margin-bottom: 6px; font-size: .95rem; }
.field input, .field select {
  width: 100%; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--title); font-family: var(--font); font-size: 1rem;
}
.field input:focus, .field select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.result-box { background: var(--sub-bg); border-radius: 14px; padding: 20px; text-align: center; margin-top: 8px; }
.result-box .big { font-size: 2rem; font-weight: 800; color: var(--gold-soft); }
[data-theme="dark"] .result-box .big { color: var(--gold); }

/* ── حالات ──────────────────────────────────────────────── */
.state { text-align: center; padding: 40px 20px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* اختيار الدولة */
.country-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.country-chip { padding: 8px 15px; border-radius: 22px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-family: var(--font); font-weight: 600; font-size: .92rem; color: var(--body); transition: .15s; }
.country-chip:hover { border-color: var(--gold); }
.country-chip.active { background: var(--mid-gold); color: #fff; border-color: var(--mid-gold); }
[data-theme="dark"] .country-chip.active { background: var(--gold); color: #2C1D08; }

.page-head { background: var(--header-grad); color: #fff; padding: 40px 0; margin-bottom: 34px; }
.page-head h1 { color: #fff; font-size: 2.1rem; margin: 0; }
.page-head p { color: rgba(255,255,255,.82); margin: 6px 0 0; }

/* ── الموبايل ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; text-align: center; }
  .hero-art { display: none; }
  .hero h1 { font-size: 2rem; }
  .hero-cta { justify-content: center; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile:nth-child(2) { border-inline-end: none; }
  .tile:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .app-cta { grid-template-columns: 1fr; text-align: center; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
  .nav {
    position: fixed; inset: 66px 0 auto 0; flex-direction: column; gap: 0;
    background: var(--mid-gold); padding: 10px 20px 20px; display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,.3); margin: 0;
  }
  .nav.open { display: flex; }
  .nav a { width: 100%; padding: 13px; }
  .nav-toggle { display: grid; }
  .nav-download-inline { display: none; }
}
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 1.5rem; }
}
