/* ════════════════════════════════════════════════
   WAMEED — Mobile-First, No Hero
   ════════════════════════════════════════════════ */

:root {
  --topbar-h:    calc(54px + env(safe-area-inset-top));
  --topicnav-h:  44px;
  --chrome-h:    calc(var(--topbar-h) + var(--topicnav-h));
  --drawer-w:    380px;
  --r:           12px;
  --r-sm:        8px;
  --ease:        cubic-bezier(.4,0,.2,1);
  --font-en-display: "DM Serif Display", Georgia, serif;
  --font-en-body:    "DM Sans", system-ui, sans-serif;
  --font-ar-display: "Cairo", system-ui, sans-serif;
  --font-ar-body:    "Tajawal", system-ui, sans-serif;
}

/* ── Themes ─────────────────────────────────────── */
html[data-theme="dark"] {
  --bg:          #07090f;
  --surface:     #0e1420;
  --surface-2:   #141c2c;
  --surface-3:   #1a2438;
  --border:      #1c2a3e;
  --border-2:    #223044;
  --text:        #e2ebff;
  --text-2:      #8fa4c4;
  --muted:       #46586e;
  --accent:      #f5c842;
  --accent-2:    #38bdf8;
  --accent-hot:  #ff5f5f;
  --accent-rgb:  245,200,66;
  --accent2-rgb: 56,189,248;
  --shadow:      0 16px 48px rgba(0,0,0,.6);
  --shadow-sm:   0 4px 14px rgba(0,0,0,.4);
  --ring:        0 0 0 3px rgba(245,200,66,.28);
}

html[data-theme="light"] {
  --bg:          #f0f4fb;
  --surface:     #ffffff;
  --surface-2:   #e8eef8;
  --surface-3:   #d8e2f0;
  --border:      #c8d4e8;
  --border-2:    #d4e0f0;
  --text:        #0b1422;
  --text-2:      #4a5870;
  --muted:       #8898b4;
  --accent:      #b87a00;
  --accent-2:    #0066aa;
  --accent-hot:  #d63030;
  --accent-rgb:  184,122,0;
  --accent2-rgb: 0,102,170;
  --shadow:      0 8px 24px rgba(11,20,34,.12);
  --shadow-sm:   0 2px 8px rgba(11,20,34,.08);
  --ring:        0 0 0 3px rgba(184,122,0,.22);
}

/* ── Reset ──────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-en-body);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
html[lang="ar"] body { font-family: var(--font-ar-body); }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
a { color: inherit; }

/* ════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--topbar-h);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: 8px;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); min-width: 0; flex-shrink: 1; overflow: hidden; }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; }
.brand-name {
  font-family: var(--font-en-display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: .3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[lang="ar"] .brand-name { font-family: var(--font-ar-display); font-weight: 800; font-size: 1.05rem; }

.topbar-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, transform .12s;
  min-height: 36px;
}
.chip:hover  { background: var(--surface-2); transform: translateY(-1px); }
.chip:active { transform: scale(.96); }
.chip:focus  { outline: none; box-shadow: var(--ring); }
.chip-icon   { font-size: .88rem; line-height: 1; }
.chip--account { border-color: rgba(var(--accent-rgb),.4); }
.chip--account:hover { background: rgba(var(--accent-rgb),.08); }
.chip--icon-only { padding: 0; width: 34px; justify-content: center; }
.chip--icon-only .chip-icon { margin: 0; }

@media (max-width: 600px) {
  .chip-label { display: none; }
  .chip { padding: 6px 9px; }
}

/* ════════════════════════════════════════════════
   TOPIC NAV
   ════════════════════════════════════════════════ */
.topic-nav {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  z-index: 190;
  height: var(--topicnav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.topic-nav::-webkit-scrollbar { display: none; }
.topic-nav-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  min-width: max-content;
}

.topic-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  height: 100%;
  min-height: 44px;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: .84rem;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
html[lang="ar"] .topic-btn { font-family: var(--font-ar-body); font-size: .9rem; font-weight: 700; }
.topic-btn:hover  { color: var(--text); }
.topic-btn.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 700; }

/* ════════════════════════════════════════════════
   NEW ARTICLES BANNER
   ════════════════════════════════════════════════ */
.new-articles-banner {
  position: sticky;
  top: var(--chrome-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--accent);
  color: #0b1422;
  font-size: .82rem;
  font-weight: 700;
  animation: slideDown .3s var(--ease);
}
html[lang="ar"] .new-articles-banner { font-family: var(--font-ar-body); font-size: .88rem; }
@keyframes slideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: none; opacity: 1; } }

.banner-icon { font-size: .85rem; }
.new-articles-banner button {
  padding: 4px 12px;
  border-radius: 999px;
  border: none;
  background: rgba(0,0,0,.18);
  color: inherit;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .04em;
  transition: background .15s;
  min-height: 28px;
}
.new-articles-banner button:hover { background: rgba(0,0,0,.28); }

/* ════════════════════════════════════════════════
   MAIN & NEWS SECTION
   ════════════════════════════════════════════════ */
main {
  padding-top: calc(var(--chrome-h) + 20px);
  padding-bottom: 40px;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

.news-section { padding-top: 4px; }

.news-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.news-section-title {
  font-family: var(--font-en-display);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: -.01em;
}
html[lang="ar"] .news-section-title { font-family: var(--font-ar-display); font-weight: 800; font-size: 1.2rem; letter-spacing: 0; }

.news-section-hint { font-size: .75rem; color: var(--muted); font-weight: 500; }
html[lang="ar"] .news-section-hint { font-family: var(--font-ar-body); font-size: .8rem; }

/* ── News Grid — mobile-first ── */
.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.news-grid--visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 540px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (min-width: 900px) {
  .news-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
@media (min-width: 1200px) {
  .news-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
}

/* ── News Card ── */
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  min-height: 100px;
  border-inline-start: 3px solid var(--cat-color, var(--accent));
}
.news-card:hover  { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--border-2); border-inline-start-color: var(--cat-color, var(--accent)); }
.news-card:active { transform: scale(.99); }

.news-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, color-mix(in oklab, var(--cat-color, var(--accent)) 8%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.news-card:hover::before { opacity: 1; }

.nc-top {
  display: flex;
  align-items: center;
}

.nc-category {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cat-color, var(--accent));
}
html[lang="ar"] .nc-category { font-family: var(--font-ar-body); letter-spacing: 0; font-size: .72rem; }

.nc-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cat-color, var(--accent));
  flex-shrink: 0;
  opacity: .85;
}

.nc-title {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.52;
  color: var(--text);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html[lang="ar"] .nc-title { font-family: var(--font-ar-body); font-size: 1rem; font-weight: 700; line-height: 1.65; }

@media (min-width: 540px) {
  .nc-title { -webkit-line-clamp: 4; }
}

.nc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.nc-source {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}
html[lang="ar"] .nc-source { font-family: var(--font-ar-body); font-size: .74rem; }

.nc-time {
  font-size: .66rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.nc-time--fresh {
  color: var(--accent);
  font-weight: 700;
}
html[lang="ar"] .nc-time { font-family: var(--font-ar-body); font-size: .7rem; }

/* ── Skeleton ── */
.news-card--skeleton { pointer-events: none; cursor: default; }
.skeleton {
  border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-tag   { height: 12px; width: 55px; }
.sk-title { height: 16px; width: 95%; margin-top: 4px; }
.sk-title--short { width: 70%; }
.sk-meta  { height: 11px; width: 40%; margin-top: 6px; }

/* ── Animations ── */
.fade-in { animation: fadeUp .3s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.glow { box-shadow: 0 0 0 2px rgba(var(--accent-rgb),.35), var(--shadow-sm); border-color: rgba(var(--accent-rgb),.5); }

.news-card--highlight { animation: cardHighlight 2.2s var(--ease) both; }
@keyframes cardHighlight {
  0%   { box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.75); border-color: var(--accent); }
  45%  { box-shadow: 0 0 0 6px rgba(var(--accent-rgb),.3); }
  100% { box-shadow: none; border-color: var(--border); }
}

/* ════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 max(12px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-brand { font-size: .78rem; color: var(--text-2); display: flex; align-items: center; }
.footer-legal { font-size: .72rem; color: var(--muted); }
html[lang="ar"] .footer-legal { font-family: var(--font-ar-body); }
@media (max-width: 480px) { .footer-inner { flex-direction: column; text-align: center; } }

/* ════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal-close {
  position: absolute;
  top: 14px; inset-inline-end: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--surface-3); }

.signup-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  width: 100%;
  max-width: 700px;
  overflow: hidden;
}
.signup-left {
  background: linear-gradient(145deg, var(--surface-2), var(--surface-3));
  padding: 40px 28px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (max-width: 560px) { .signup-box { flex-direction: column; } .signup-left { padding: 24px 20px 16px; } }

.auth-logo { width: 40px; height: 40px; border-radius: 11px; }
.auth-logo--center { display: block; margin: 0 auto 14px; }

.signup-headline {
  font-family: var(--font-en-display);
  font-size: 1.65rem;
  line-height: 1.1;
  font-weight: 400;
}
html[lang="ar"] .signup-headline { font-family: var(--font-ar-display); font-weight: 900; }

.signup-tagline { font-size: .82rem; color: var(--text-2); line-height: 1.5; }
.signup-features { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.signup-features li { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-2); }
.sf-icon { font-size: .95rem; }

.signup-right { flex: 1; padding: 40px 28px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 560px) { .signup-right { padding: 16px 20px 28px; } }

.login-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 44px 36px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (max-width: 440px) { .login-box { padding: 32px 20px; } }

.login-headline {
  font-family: var(--font-en-display);
  font-size: 1.3rem;
  font-weight: 400;
  text-align: center;
}
html[lang="ar"] .login-headline { font-family: var(--font-ar-display); font-weight: 900; }

.auth-error  { color: #e05050; font-size: .78rem; min-height: 1.2em; }
.auth-status { color: var(--accent-2); font-size: .78rem; min-height: 1.2em; }
.auth-fields { display: flex; flex-direction: column; gap: 9px; }

.auth-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: max(.9rem, 16px);
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.auth-input::placeholder { color: var(--muted); }

.btn-continue {
  padding: 13px;
  border-radius: var(--r-sm);
  border: none;
  background: var(--accent);
  color: #0b1422;
  font-size: .9rem;
  font-weight: 700;
  min-height: 44px;
  transition: opacity .15s, transform .12s;
}
.btn-continue:hover { opacity: .9; transform: translateY(-1px); }
.btn-continue:active { transform: scale(.98); }
.btn-continue--full { width: 100%; }
.btn-continue--logout { background: transparent; border: 1px solid rgba(224,80,80,.4); color: #e05050; margin-top: 6px; }

.auth-divider { display: flex; align-items: center; gap: 10px; font-size: .73rem; color: var(--muted); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.auth-icons-row { display: flex; gap: 8px; }
.auth-icons-row--center { justify-content: center; }

.auth-icon-btn {
  flex: 1;
  max-width: 130px;
  padding: 10px;
  min-height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.auth-icon-btn:hover { background: var(--surface-3); }

.auth-switch, .auth-terms, .auth-forgot { font-size: .76rem; color: var(--text-2); text-align: center; }
.auth-terms a, .auth-link { color: var(--accent-2); text-decoration: none; border: none; background: none; font: inherit; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════
   PREFS DRAWER
   ════════════════════════════════════════════════ */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
}
.drawer-overlay.hidden { display: none; }

.prefs-drawer {
  position: fixed;
  top: 0; bottom: 0;
  inset-inline-end: 0;
  z-index: 310;
  width: var(--drawer-w);
  max-width: 95vw;
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform .28s var(--ease);
}
.prefs-drawer.hidden { transform: translateX(100%); display: flex; }
html[lang="ar"] .prefs-drawer.hidden { transform: translateX(-100%); }

.drawer-header {
  padding: 16px 20px 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  position: relative;
}

.drawer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}
.drawer-user-avatar {
  font-size: 1.4rem;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  border-radius: 50%;
  flex-shrink: 0;
}
.drawer-user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drawer-user-name  { font-size: .88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-user-email { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.drawer-title { font-family: var(--font-en-display); font-size: 1.2rem; font-weight: 400; }
html[lang="ar"] .drawer-title { font-family: var(--font-ar-display); font-weight: 800; }
.drawer-subtitle { font-size: .78rem; color: var(--muted); margin-top: 2px; }
html[lang="ar"] .drawer-subtitle { font-family: var(--font-ar-body); }

.drawer-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top)); inset-inline-end: 16px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: .88rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.drawer-close:hover { background: var(--surface-3); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  -webkit-overflow-scrolling: touch;
}

.pref-section-label {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
  margin-bottom: 2px;
}
html[lang="ar"] .pref-section-label { font-family: var(--font-ar-body); letter-spacing: 0; font-size: .76rem; }

.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.category-card { cursor: pointer; }
.category-card input { display: none; }
.cc-inner {
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: all .15s;
}
.cc-icon  { font-size: .95rem; flex-shrink: 0; }
.cc-name  { font-size: .7rem; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="ar"] .cc-name { font-family: var(--font-ar-body); font-size: .72rem; }
.cc-check { display: none; }
.category-card input:checked ~ .cc-inner { background: rgba(var(--accent-rgb),.12); border-color: rgba(var(--accent-rgb),.45); }
.category-card input:checked ~ .cc-inner .cc-name  { color: var(--text); }

.region-chips, .source-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.region-chip, .source-pill-toggle { cursor: pointer; }
.region-chip input, .source-pill-toggle input { display: none; }

.region-chip span, .source-pill-toggle span {
  display: inline-flex; align-items: center;
  padding: 5px 11px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: .74rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all .15s;
  white-space: nowrap;
}
html[lang="ar"] .region-chip span, html[lang="ar"] .source-pill-toggle span { font-family: var(--font-ar-body); font-size: .78rem; }
.region-chip input:checked ~ span { background: rgba(var(--accent-rgb),.1); border-color: rgba(var(--accent-rgb),.4); color: var(--text); }
.source-pill-toggle input:checked ~ span { background: rgba(var(--accent2-rgb),.1); border-color: rgba(var(--accent2-rgb),.4); color: var(--text); }

.display-prefs { display: flex; flex-direction: column; gap: 9px; }
.display-pref-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.display-pref-label { font-size: .8rem; color: var(--text-2); font-weight: 500; }
html[lang="ar"] .display-pref-label { font-family: var(--font-ar-body); }
.pref-select {
  padding: 7px 11px;
  min-height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .8rem;
  font-family: inherit;
  outline: none;
  min-width: 120px;
}
.pref-select:focus { border-color: var(--accent); box-shadow: var(--ring); }

.drawer-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 7px; }
.btn-save {
  padding: 12px; border-radius: var(--r-sm); border: none;
  background: var(--accent); color: #0b1422;
  font-size: .86rem; font-weight: 700; min-height: 44px;
  transition: opacity .15s;
}
.btn-save:hover { opacity: .88; }
.btn-signout {
  padding: 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-2); font-size: .82rem; font-weight: 600; min-height: 40px;
  transition: background .15s;
}
.btn-signout:hover { background: var(--surface-2); }
html[lang="ar"] .btn-save, html[lang="ar"] .btn-signout { font-family: var(--font-ar-body); }
.prefs-status { font-size: .74rem; color: var(--accent); text-align: center; min-height: 1em; }

/* ════════════════════════════════════════════════
   ARTICLE MODAL
   ════════════════════════════════════════════════ */
.article-modal-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.article-modal-overlay.hidden { display: none; }

@media (min-width: 600px) {
  .article-modal-overlay { align-items: center; padding: 16px; }
}

.article-modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: sheetUp .25s var(--ease) both;
  max-height: 85vh;
  overflow-y: auto;
}
@media (min-width: 600px) {
  .article-modal {
    border-radius: 18px;
    max-width: 520px;
    padding: 36px 32px;
    animation: modalPop .22s var(--ease) both;
  }
}
@keyframes sheetUp  { from { transform: translateY(100%); } to { transform: none; } }
@keyframes modalPop { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }

.article-modal-close {
  position: absolute;
  top: 14px; inset-inline-end: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.article-modal-close:hover { background: var(--surface-3); }

.article-modal-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.article-modal-source {
  font-size: .7rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
html[lang="ar"] .article-modal-source { font-family: var(--font-ar-body); letter-spacing: 0; }
.article-modal-category {
  font-size: .68rem; font-weight: 600; color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
html[lang="ar"] .article-modal-category { font-family: var(--font-ar-body); font-size: .74rem; }

.article-modal-title {
  font-family: var(--font-en-display);
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.35;
}
html[lang="ar"] .article-modal-title { font-family: var(--font-ar-display); font-weight: 900; font-size: 1.2rem; line-height: 1.5; }

.article-modal-time { font-size: .76rem; color: var(--muted); }
html[lang="ar"] .article-modal-time { font-family: var(--font-ar-body); }

.article-modal-read {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #0b1422;
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  min-height: 48px;
  transition: opacity .15s;
  margin-top: 4px;
}
.article-modal-read:hover { opacity: .9; }
html[lang="ar"] .article-modal-read { font-family: var(--font-ar-body); }

.article-modal-footer { font-size: .7rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; text-align: center; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ════════════════════════════════════════════════
   SHARE SECTION
   ════════════════════════════════════════════════ */
.share-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.share-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
html[lang="ar"] .share-label { font-family: var(--font-ar-body); letter-spacing: 0; font-size: .78rem; }

.share-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s, transform .12s, border-color .15s;
  min-height: 36px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.share-btn:hover  { background: var(--surface-3); color: var(--text); transform: translateY(-1px); }
.share-btn:active { transform: scale(.95); }

.share-btn--native {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1422;
  font-weight: 700;
  padding: 9px 18px;
}
.share-btn--native:hover { opacity: .88; background: var(--accent); }

.share-btn--whatsapp:hover { background: #25d366; border-color: #25d366; color: #fff; }
.share-btn--x:hover        { background: #000;    border-color: #000;    color: #fff; }
html[data-theme="dark"] .share-btn--x:hover { background: #e7e9ea; border-color: #e7e9ea; color: #000; }
.share-btn--fb:hover       { background: #1877f2; border-color: #1877f2; color: #fff; }

.share-btn--copy { min-width: 80px; }
.share-btn--copied {
  background: rgba(56,189,248,.12) !important;
  border-color: var(--accent-2) !important;
  color: var(--accent-2) !important;
}
html[lang="ar"] .share-btn { font-family: var(--font-ar-body); font-size: .82rem; }

/* ── Footer legal links ── */
.footer-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-links a { font-size: .72rem; color: var(--text-2); text-decoration: none; transition: color .15s; }
.footer-links a:hover { color: var(--accent); }
.footer-links span { color: var(--muted); font-size: .65rem; }

/* ════════════════════════════════════════════════
   WEATHER TAB
   ════════════════════════════════════════════════ */
#weatherSection {
  padding-top: 4px;
  display: flex;
  justify-content: center;
}

.weather-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeUp .3s var(--ease) both;
}

.wc-location { display: flex; align-items: center; gap: 7px; }
.wc-loc-dot  { font-size: .9rem; flex-shrink: 0; }
.wc-loc-name { font-size: .88rem; font-weight: 600; color: var(--text-2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="ar"] .wc-loc-name { font-family: var(--font-ar-body); }

.wc-refresh {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .2s;
  flex-shrink: 0;
}
.wc-refresh:hover { background: var(--surface-3); transform: rotate(180deg); }

.wc-hero { display: flex; align-items: center; gap: 18px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.wc-weather-icon { font-size: 4rem; line-height: 1; flex-shrink: 0; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.wc-hero-right { display: flex; flex-direction: column; gap: 3px; }
.wc-temp { font-family: var(--font-en-display); font-size: 3.2rem; font-weight: 400; line-height: 1; color: var(--text); letter-spacing: -.02em; }
.wc-unit { font-size: 1.4rem; color: var(--text-2); }
.wc-condition { font-size: .88rem; font-weight: 600; color: var(--accent); letter-spacing: .02em; }
html[lang="ar"] .wc-condition { font-family: var(--font-ar-body); font-size: .92rem; }

.wc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 400px) { .wc-stats { grid-template-columns: repeat(2, 1fr); } }
.ws-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px; display: flex; flex-direction: column; gap: 3px; text-align: center; }
.ws-stat-label { font-size: .62rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
html[lang="ar"] .ws-stat-label { font-family: var(--font-ar-body); letter-spacing: 0; font-size: .68rem; text-transform: none; }
.ws-stat-val { font-size: .92rem; font-weight: 700; color: var(--text); }

.wc-forecast-header { font-size: .65rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
html[lang="ar"] .wc-forecast-header { font-family: var(--font-ar-body); letter-spacing: 0; font-size: .72rem; text-transform: none; }
.wc-forecast { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.wc-forecast::-webkit-scrollbar { display: none; }

.wf-hour { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); min-width: 58px; transition: background .15s; }
.wf-hour--now { border-color: rgba(var(--accent-rgb),.45); background: rgba(var(--accent-rgb),.07); }
.wf-label { font-size: .65rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
html[lang="ar"] .wf-label { font-family: var(--font-ar-body); letter-spacing: 0; font-size: .7rem; }
.wf-hour--now .wf-label { color: var(--accent); }
.wf-icon  { font-size: 1.2rem; line-height: 1; }
.wf-temp  { font-size: .82rem; font-weight: 700; color: var(--text); }

.wc-attribution { font-size: .68rem; color: var(--muted); text-align: center; border-top: 1px solid var(--border); padding-top: 10px; }
.wc-attribution a { color: var(--text-2); text-decoration: none; }
.wc-attribution a:hover { color: var(--accent); }

.weather-card--loading { gap: 12px; }
.ws-skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.6s ease-in-out infinite; }
.ws-skeleton--loc       { height: 16px; width: 40%; }
.ws-skeleton--temp      { height: 64px; width: 55%; margin: 6px 0; }
.ws-skeleton--condition { height: 14px; width: 35%; }
.ws-skeleton-row        { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 4px; }
.ws-skeleton--stat      { height: 52px; }

.weather-error { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; max-width: 360px; margin: 0 auto; }
.we-icon  { font-size: 2.8rem; opacity: .5; }
.we-title { font-size: .96rem; font-weight: 700; color: var(--text); }
html[lang="ar"] .we-title { font-family: var(--font-ar-body); }
.we-sub   { font-size: .8rem; color: var(--text-2); }
html[lang="ar"] .we-sub { font-family: var(--font-ar-body); }
.we-retry {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-height: 40px;
  transition: background .15s;
}
.we-retry:hover { background: var(--surface-3); }
html[lang="ar"] .we-retry { font-family: var(--font-ar-body); }

/* ════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════ */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 20px;
  text-align: center;
  animation: fadeUp .25s var(--ease) both;
}

.empty-icon {
  font-size: 2.8rem;
  line-height: 1;
  opacity: .35;
  margin-bottom: 4px;
}

.empty-title {
  font-family: var(--font-en-display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-2);
  letter-spacing: -.01em;
}
html[lang="ar"] .empty-title { font-family: var(--font-ar-display); font-weight: 800; font-size: 1rem; }

.empty-sub {
  font-size: .82rem;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.6;
}
html[lang="ar"] .empty-sub { font-family: var(--font-ar-body); font-size: .86rem; }

/* ════════════════════════════════════════════════
   READ / UNREAD CARD STATE
   ════════════════════════════════════════════════ */
.nc-read {
  opacity: .58;
  border-inline-start-color: var(--muted) !important;
}
.nc-read:hover { opacity: .85; }
.nc-read .nc-title { color: var(--text-2); }
.nc-read::before { display: none; }

.nc-read-badge {
  margin-inline-start: auto;
  font-size: .6rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
  letter-spacing: .04em;
  flex-shrink: 0;
  user-select: none;
}

/* ════════════════════════════════════════════════
   PULL TO REFRESH
   FIX: added transform transition + translateY(0) on visible
   ════════════════════════════════════════════════ */
.pull-indicator {
  position: fixed;
  top: var(--chrome-h);
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  z-index: 180;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 20px 20px;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  opacity: 0;
  /* FIX: add transform to transition so it slides down smoothly */
  transition: opacity .2s ease, transform .2s ease;
  will-change: transform, opacity;
}

/* FIX: slide down into view when visible */
.pull-indicator.ptr--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ptr-icon {
  font-size: 1rem;
  line-height: 1;
  display: inline-block;
  transition: transform .15s ease;
  color: var(--text-2);
}

.pull-indicator.ptr--ready .ptr-icon,
.pull-indicator.ptr--ready .ptr-label {
  color: var(--accent);
}

.pull-indicator.ptr--refreshing .ptr-icon {
  animation: ptrSpin .7s linear infinite;
}
@keyframes ptrSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.ptr-label {
  font-size: .74rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  transition: color .15s;
}
html[lang="ar"] .ptr-label { font-family: var(--font-ar-body); font-size: .78rem; }

/* ══════════════════════════════════════════════
   SEARCH BAR
══════════════════════════════════════════════ */
.search-bar {
  position: fixed;
  top: var(--chrome-h);
  left: 0; right: 0;
  z-index: 185;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  animation: slideDown .18s var(--ease) both;
}
.search-bar.hidden { display: none; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.search-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg, var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 40px;
}
.search-icon { font-size: .85rem; opacity: .5; }
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .9rem;
  font-family: var(--font-en-body);
  caret-color: var(--accent);
}
html[lang="ar"] .search-input { font-family: var(--font-ar-body); direction: rtl; }
.search-input::placeholder { color: var(--muted); }
.search-clear {
  background: none; border: none;
  color: var(--text-2); cursor: pointer;
  font-size: .8rem; padding: 2px 4px; border-radius: 4px;
}
.search-clear:hover { color: var(--text); }
.search-clear.hidden { display: none; }
/* push main down when search is open */
body:has(#searchBar:not(.hidden)) main {
  padding-top: calc(var(--chrome-h) + 56px + 20px);
}

/* ══════════════════════════════════════════════
   ARTICLE MODAL — BOOKMARK BUTTON (top-left)
══════════════════════════════════════════════ */
.modal-bm-btn {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: .88rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .12s;
  line-height: 1;
}
.modal-bm-btn:hover  { background: var(--surface-3); transform: scale(1.08); }
.modal-bm-btn:active { transform: scale(.94); }
.modal-bm-btn--saved {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
}

/* ══════════════════════════════════════════════
   BOOKMARKS MODAL
══════════════════════════════════════════════ */
.bm-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .18s ease both;
}
.bm-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.bm-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 680px;
  max-height: 82vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: sheetUp .22s var(--ease) both;
}
.bm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.bm-title { font-size: 1rem; font-weight: 700; color: var(--text); }
html[lang="ar"] .bm-title { font-family: var(--font-ar-body); }
.bm-close {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 50%; width: 30px; height: 30px; cursor: pointer;
  color: var(--text-2); font-size: .82rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.bm-close:hover { background: var(--surface-3); color: var(--text); }

.bm-grid {
  overflow-y: auto;
  padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr; gap: 10px;
}
@media (min-width: 540px) { .bm-grid { grid-template-columns: repeat(2, 1fr); } }

.bm-empty {
  text-align: center; color: var(--text-2);
  font-size: .88rem; padding: 40px 16px;
  grid-column: 1/-1; line-height: 1.6;
}
html[lang="ar"] .bm-empty { font-family: var(--font-ar-body); font-size: .92rem; }

.bm-remove-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--surface-2); border: none; border-radius: 6px;
  width: 22px; height: 22px; font-size: .72rem; cursor: pointer;
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s; z-index: 2;
}
.news-card:hover .bm-remove-btn,
.news-card:focus-within .bm-remove-btn { opacity: 1; }
@media (hover: none) { .bm-remove-btn { opacity: .7; } }

.bm-card--removing { animation: shrinkOut .22s ease both; pointer-events: none; }
@keyframes shrinkOut { to { transform: scale(.9); opacity: 0; } }
