@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');

/* ==========================================================================
   REDESIGN — أدوات AI بالعربي
   Layers on top of each page's existing inline styles.
   Load order: inline <style> -> redesign.css -> theme.css
   (theme.css still loads last, so its light-theme overrides keep working).
   Brand: navy + gold. Font: Cairo (Arabic-first). RTL preserved.
   ========================================================================== */

:root {
  --gold: #facc15;
  --gold-2: #fde047;
  --gold-deep: #eab308;
  --gold-soft: rgba(250, 204, 21, .12);
  --navy: #0b0f1e;
  --navy-2: #0d1530;
  --surface: #121a2e;
  --surface-2: #16203a;
  --border: #22304d;
  --text: #eef2f7;
  --muted: #a9b6cc;
  --faint: #7e8daa;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .45);
  --r-lg: 20px;
  --r-md: 14px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--navy);
  color: var(--text);
  line-height: 1.9;
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Hero header: navy + gold glow (replaces purple/blue/cyan) --- */
header {
  background:
    radial-gradient(900px 380px at 85% -10%, rgba(250, 204, 21, .16), transparent 60%),
    radial-gradient(700px 380px at 8% 115%, rgba(124, 58, 237, .20), transparent 60%),
    linear-gradient(180deg, #0d1530 0%, #0b0f1e 100%);
  border-bottom: 1px solid rgba(250, 204, 21, .22);
  padding: 64px 0 52px;
}
header h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.1rem);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0;
}
header h1 span { color: var(--gold); }
header p { font-size: 1.15rem; color: #cbd5e1; max-width: 640px; margin-inline: auto; }
header .site-title {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 900;
}
header .site-title span { color: var(--gold); }

.hero-eyebrow {
  display: inline-block;
  font-size: .85rem;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid rgba(250, 204, 21, .45);
  background: var(--gold-soft);
  border-radius: 999px;
  padding: 5px 16px;
  margin-bottom: 16px;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}
.hero-chips span {
  font-size: .88rem;
  font-weight: 700;
  color: #dbe4f0;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  padding: 5px 14px;
}

/* ---------- Sticky glass nav + brand mark ------------------------------- */
nav.mainnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 30, .88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
nav.mainnav .wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 4px;
}
nav.mainnav a {
  padding: 7px 13px;
  border-radius: 10px;
  transition: background .18s ease, color .18s ease;
}
nav.mainnav a:hover { background: var(--gold-soft); color: var(--gold); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--text) !important;
  margin-inline-end: 10px;
  text-decoration: none;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #111827;
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .5px;
}
.theme-toggle {
  padding: 7px 14px;
  font-size: .88rem;
  border: 1px solid rgba(255, 255, 255, .25);
  transition: border-color .18s ease, background .18s ease;
}
.theme-toggle:hover { border-color: var(--gold); background: var(--gold-soft); }

/* ---------- Breadcrumb (tool / article pages) ---------------------------- */
.crumbs { font-size: .9rem; color: var(--faint); padding: 16px 0 0; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--gold); }
.crumbs span.sep { margin: 0 6px; color: var(--faint); }
.crumbs .here { color: var(--text); font-weight: 700; }

/* ---------- Toolbar: search + filter chips ------------------------------ */
.toolbar { margin: 32px 0 10px; }
.toolbar input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 18px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.toolbar input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, .18);
}
.toolbar input::placeholder { color: var(--faint); }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 18px;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.active {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: var(--gold);
  color: #111827;
}

/* ---------- Cards: elevated, gold hover accent -------------------------- */
.grid { gap: 20px; }
.card {
  background: linear-gradient(180deg, #141d33, #101828);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(250, 204, 21, .8), transparent);
  opacity: 0;
  transition: opacity .2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(250, 204, 21, .5);
  box-shadow: var(--shadow-lg);
}
.card:hover::before { opacity: 1; }
.card.featured {
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, #221d0b, #141d33 55%);
  box-shadow: 0 10px 30px rgba(250, 204, 21, .10);
}
.card h2 { font-size: 1.3rem; font-weight: 800; line-height: 1.5; }
.card p { color: #c3cede; }
.card ul li::marker { color: var(--gold); }

/* Badges: quiet outline for the repeated "official link" badge; gold stays
   reserved for the genuinely featured / special cards. */
.badge {
  font-size: .78rem;
  padding: 4px 12px;
  letter-spacing: 0;
}
.badge.direct {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
}

/* ---------- Buttons: gold primary, ghost secondary ---------------------- */
.btn {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #111827;
  border-radius: var(--r-md);
  padding: 13px 18px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(250, 204, 21, .18);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.btn:hover {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(250, 204, 21, .28);
}
.btn.ghost {
  background: transparent;
  border: 1px solid #475569;
  color: #e2e8f0;
  box-shadow: none;
}
.btn.ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-soft);
  filter: none;
}
.channel { transition: border-color .18s ease, background .18s ease; }
.channel:hover { border-color: var(--gold); background: rgba(250, 204, 21, .12); }

/* ---------- Section titles ---------------------------------------------- */
.section-title {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 900;
  margin: 44px 0 6px;
}
.section-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  border-radius: 2px;
  background: var(--gold);
  margin-top: 10px;
}
.section-sub { color: var(--muted); }

/* ---------- Code box ----------------------------------------------------- */
.codebox {
  background: var(--surface-2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.codebox b { font-size: 1.6rem; }

/* ---------- Article typography ------------------------------------------ */
article { padding: 36px 0; }
article h1 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 900;
  line-height: 1.5;
}
article h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: var(--gold);
  margin-top: 12px;
}
/* Gold side-rule instead of all-gold heading text: calmer, more editorial. */
article h2 {
  color: #f8fafc;
  border-right: 4px solid var(--gold);
  padding-right: 14px;
  font-weight: 800;
}
article > p:first-of-type { font-size: 1.12rem; color: #e2e8f0; }
.meta {
  color: var(--faint);
  font-size: .92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0 4px;
}
.meta b { color: var(--muted); font-weight: 700; }
article li::marker { color: var(--gold); }
.warn { border-radius: var(--r-md); }
.related { border-top: 1px solid var(--border); }
.related li::marker { color: var(--gold); }
.related a { text-decoration: none; }
.related a:hover { color: var(--gold); text-decoration: underline; }
figure img { box-shadow: var(--shadow); }

/* ---------- Footer: structured, 3 columns ------------------------------- */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 44px;
  background: #0a0e1c;
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 26px;
}
.foot-brand .brand { margin-bottom: 10px; }
.foot-brand p { color: var(--muted); font-size: .95rem; max-width: 340px; }
.foot-col h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}
.foot-col nav { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.foot-col nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem;
  margin: 0;
}
.foot-col nav a:hover { color: var(--gold); }
.foot-bottom {
  border-top: 1px solid var(--border-soft, #1c2942);
  padding-top: 20px;
}
.foot-bottom p { margin-bottom: 8px; }

/* ---------- Responsive ---------------------------------------------------- */
@media (max-width: 900px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  header { padding: 48px 0 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .card { padding: 20px; }
  nav.mainnav .wrap { gap: 2px 2px; }
  .brand { font-size: .98rem; }
  .foot-grid { grid-template-columns: 1fr; gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   MOBILE UX — Dec 2026 (keeps navy/gold identity + dark/light themes).
   Bigger tap targets, full-width search on small screens, roomier spacing.
   ========================================================================== */
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  /* Tap targets: at least ~44px tall for thumbs. */
  nav.mainnav a { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 14px; }
  .theme-toggle { min-height: 44px; }
  .chip { min-height: 44px; padding: 10px 18px; }
  .toolbar { flex-direction: column; }
  .toolbar input { flex: 1 1 100%; min-width: 0; width: 100%; font-size: 1.05rem; padding: 14px 18px; }
  .toolbar .chip { text-align: center; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  .btn { min-height: 48px; display: flex; align-items: center; justify-content: center; }
  article .btn { display: inline-flex; }
  article { padding: 28px 0; }
  article p, article li { font-size: 1.02rem; }
  footer nav a { padding: 6px 0; }
  .codebox button { min-height: 44px; padding: 10px 20px; }
  .hero-chips { gap: 6px; }
  .channel { padding: 12px 20px; }
}
@media (max-width: 380px) {
  header h1 { font-size: 1.7rem; }
  .card { padding: 18px; }
}

/* ==========================================================================
   LIGHT THEME — mirrors theme.css conventions. Only properties theme.css
   does not already cover are set here; where both files set the same
   property, the higher-specificity selectors below win over theme.css.
   ========================================================================== */
html[data-theme="light"] body { background: #f1f5f9; }
html[data-theme="light"] header {
  background:
    radial-gradient(900px 380px at 85% -10%, rgba(250, 204, 21, .35), transparent 60%),
    linear-gradient(180deg, #fffbeb 0%, #f8fafc 100%);
  border-bottom: 1px solid #e7e5d3;
}
html[data-theme="light"] header h1 { color: #0f172a; }
html[data-theme="light"] header p { color: #475569; }
html[data-theme="light"] header .site-title { color: #0f172a; }
html[data-theme="light"] .hero-eyebrow {
  background: #fefce8;
  border-color: #eab308;
  color: #854d0e;
}
html[data-theme="light"] .hero-chips span {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #334155;
}
html[data-theme="light"] nav.mainnav {
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid #e2e8f0;
}
html[data-theme="light"] nav.mainnav a:hover { background: #fefce8; color: #a16207; }
html[data-theme="light"] .brand { color: #0f172a !important; }
html[data-theme="light"] .theme-toggle { border-color: #cbd5e1; color: #0f172a; }
html[data-theme="light"] .theme-toggle:hover { border-color: var(--gold-deep); background: #fefce8; }
html[data-theme="light"] .crumbs { color: #64748b; }
html[data-theme="light"] .crumbs a { color: #475569; }
html[data-theme="light"] .crumbs a:hover { color: #a16207; }
html[data-theme="light"] .crumbs .here { color: #0f172a; }
/* Higher specificity than theme.css so gold stays the primary accent. */
html[data-theme="light"] .toolbar .chip.active {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: var(--gold);
  color: #111827;
}
html[data-theme="light"] .card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .08);
}
html[data-theme="light"] .card:hover {
  border-color: rgba(234, 179, 8, .65);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .14);
}
html[data-theme="light"] .card.featured {
  background: linear-gradient(180deg, #fefce8, #ffffff);
  border-color: var(--gold);
}
html[data-theme="light"] .badge.direct { border-color: #cbd5e1; color: #64748b; }
html[data-theme="light"] .section-title { color: #0f172a; }
html[data-theme="light"] article h1 { color: #0f172a; }
html[data-theme="light"] article h2 { border-right-color: var(--gold-deep); }
html[data-theme="light"] article > p:first-of-type { color: #1e293b; }
html[data-theme="light"] .meta { color: #64748b; }
html[data-theme="light"] footer { background: #ffffff; }
html[data-theme="light"] .foot-col h3 { color: #0f172a; }
html[data-theme="light"] .foot-col nav a { color: #475569; }
html[data-theme="light"] .foot-col nav a:hover { color: #a16207; }
html[data-theme="light"] .foot-bottom { border-top-color: #e2e8f0; }

/* ==========================================================================
   DEV ROUND — Dec 2026 (keeps navy/gold identity + dark/light themes).
   "جديد" badge, comparison-table polish, anchor offset under sticky nav.
   ========================================================================== */
/* Gold "جديد" badge for freshly added tools/articles. */
.badge.new {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #111827;
  border: 1px solid var(--gold);
}
/* Comparison tables: zebra rows + readable links; smaller cells on mobile. */
.tablewrap table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .025); }
.tablewrap table a { color: #c4b5fd; text-decoration: none; }
.tablewrap table a:hover { color: var(--gold); text-decoration: underline; }
/* Anchor headings should not hide under the sticky nav when jumped to. */
article h2, .section-title { scroll-margin-top: 76px; }
@media (max-width: 600px) {
  .tablewrap th, .tablewrap td { padding: 8px 10px; font-size: .92rem; }
}
html[data-theme="light"] .tablewrap table tbody tr:nth-child(even) td { background: rgba(15, 23, 42, .03); }
html[data-theme="light"] .tablewrap th { background: #fefce8; color: #854d0e; }
html[data-theme="light"] .tablewrap th, html[data-theme="light"] .tablewrap td { border-color: #e2e8f0; }
html[data-theme="light"] .tablewrap td { color: #334155; }
html[data-theme="light"] .tablewrap table a { color: #6d28d9; }
html[data-theme="light"] .tablewrap table a:hover { color: #a16207; }

/* BATCH 2 (2026-12-04): "أدوات قريبة" + أزرار مشاركة + تضمين فيديو — مضاف لصفحات الأدوات */
.near-tools { margin-top: 36px; border-top: 1px solid #1f2937; padding-top: 22px; }
.near-tools h2 { font-size: 1.3rem; margin-bottom: 12px; color: #facc15; }
.near-tools ul { padding-right: 22px; margin-bottom: 12px; }
.near-tools li { margin-bottom: 8px; }
.near-tools a { color: #c4b5fd; }
.share { margin-top: 28px; border-top: 1px solid #1f2937; padding-top: 18px; }
.share p { font-weight: 700; margin-bottom: 10px; }
.share a { display: inline-block; margin: 0 0 8px 10px; padding: 8px 16px; border-radius: 999px; border: 1px solid #475569; color: #e2e8f0; text-decoration: none; font-weight: 700; }
.share a:hover { color: #facc15; border-color: #facc15; }
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; margin: 18px 0; }
.video-embed iframe { position: absolute; top: 0; right: 0; width: 100%; height: 100%; border: 0; border-radius: 12px; }
html[data-theme="light"] .near-tools, html[data-theme="light"] .share { border-top-color: #e2e8f0; }
html[data-theme="light"] .near-tools a { color: #6d28d9; }
html[data-theme="light"] .share a { border-color: #cbd5e1; color: #1e293b; }
html[data-theme="light"] .share a:hover { color: #a16207; border-color: #a16207; }
