/* =============================================
   RAWABET — AI & Tech News  |  style.css v2
   ============================================= */

/* ── Variables ── */
:root {
  --primary: #7c6fff;
  --primary-dark: #5b52cc;
  --primary-glow: rgba(124,111,255,0.25);
  --accent: #06d6a0;
  --accent2: #f72585;
  --bg: #080812;
  --bg2: #0e0e1c;
  --bg3: #13132a;
  --bg4: #1a1a35;
  --card: #111128;
  --card-hover: #161634;
  --border: rgba(255,255,255,0.07);
  --border-active: rgba(124,111,255,0.4);
  --text: #f0f0ff;
  --text-2: #b0b0d0;
  --text-3: #6a6a90;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 2px 20px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px rgba(124,111,255,0.12);
  --font-latin: 'Inter', system-ui, sans-serif;
  --font-arabic: 'Tajawal', 'Inter', system-ui, sans-serif;
  --transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-arabic);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }
svg { display: block; }

/* ── LTR Languages ── */
html[dir="ltr"] body { font-family: var(--font-latin); }
html[dir="ltr"] .ticker-track { direction: ltr; }

/* ══════════════════════════════════════════════
   TICKER BAR
══════════════════════════════════════════════ */
.ticker-wrap {
  background: linear-gradient(90deg, var(--primary-dark) 0%, #3d3599 100%);
  display: flex;
  align-items: center;
  height: 38px;
  overflow: hidden;
  position: relative;
  z-index: 200;
}
.ticker-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  white-space: nowrap;
  background: rgba(0,0,0,0.25);
  height: 100%;
  border-left: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}
html[dir="rtl"] .ticker-label { border-left: none; border-right: 1px solid rgba(255,255,255,0.15); }
.ticker-label svg { width: 12px; height: 12px; color: #fff; animation: pulse-dot 1.4s ease infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}
.ticker-track-outer {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  cursor: default;
}
.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
}
.ticker-inner {
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: tickerScroll 40s linear infinite;
  will-change: transform;
}
.ticker-track-outer:hover .ticker-inner {
  animation-play-state: paused;
}
@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}
.ticker-item a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}
.ticker-item a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.ticker-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════ */
header {
  background: rgba(8, 8, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
}
header.scrolled {
  background: rgba(8, 8, 18, 0.97);
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-mark svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 2px 8px rgba(124,111,255,0.4));
  transition: filter 0.3s;
}
.logo:hover .logo-mark svg {
  filter: drop-shadow(0 4px 16px rgba(124,111,255,0.7));
}
.logo-text-wrap { display: flex; flex-direction: column; gap: 1px; }
.logo-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.3px;
}
.logo-sub {
  font-size: 0.68rem;
  color: var(--primary);
  font-weight: 500;
  opacity: 0.85;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 4px;
  flex-wrap: nowrap;
}
.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-3);
  transition: var(--transition);
  white-space: nowrap;
}
.lang-btn:hover { color: var(--text-2); background: rgba(255,255,255,0.05); }
.lang-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(124,111,255,0.4);
}
.flag-icon { width: 18px; height: 12px; border-radius: 2px; }

/* ══════════════════════════════════════════════
   HERO
══════════════════════════════════════════════ */
.hero {
  position: relative;
  padding: 90px 28px 70px;
  text-align: center;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,111,255,0.12) 0%, transparent 70%);
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle 1px at 20% 40%, rgba(124,111,255,0.6) 0%, transparent 0%) 0 0 / 60px 60px,
    radial-gradient(circle 1px at 80% 70%, rgba(124,111,255,0.4) 0%, transparent 0%) 0 0 / 80px 80px;
  pointer-events: none;
  opacity: 0.5;
}

/* Background shapes */
.hero-bg-shapes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}
.shape-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(124,111,255,0.08) 0%, transparent 70%);
  top: -200px; left: 50%;
  transform: translateX(-50%);
}
.shape-2 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(6,214,160,0.06) 0%, transparent 70%);
  bottom: -100px; right: 10%;
}
.shape-3 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(247,37,133,0.05) 0%, transparent 70%);
  top: 20%; left: 5%;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(124,111,255,0.12);
  border: 1px solid rgba(124,111,255,0.3);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 22px;
  letter-spacing: 0.3px;
}
.hero-badge svg { color: var(--primary); }

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.18;
  color: var(--text);
  margin-bottom: 18px;
  letter-spacing: -1px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  color: var(--text-2);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.75;
}

/* Stats Row */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 36px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 0;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 36px;
}
.stat-item {
  flex: 1;
  text-align: center;
}
.stat-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 500;
}
.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* Search Bar */
.search-bar {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}
.search-icon-wrap {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  right: 18px;
  color: var(--text-3);
  pointer-events: none;
  transition: color 0.2s;
}
html[dir="ltr"] .search-icon-wrap { right: auto; left: 18px; }
.search-icon-wrap svg { width: 18px; height: 18px; }
.search-bar input {
  width: 100%;
  padding: 15px 50px 15px 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
html[dir="ltr"] .search-bar input { padding: 15px 20px 15px 50px; }
.search-bar input::placeholder { color: var(--text-3); }
.search-bar input:focus {
  border-color: var(--border-active);
  background: var(--bg4);
  box-shadow: 0 0 0 3px rgba(124,111,255,0.1);
}
.search-bar input:focus ~ .search-icon-wrap, .search-bar:focus-within .search-icon-wrap {
  color: var(--primary);
}
.search-clear {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  left: 18px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg4);
  border: 1px solid var(--border);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: var(--transition);
}
html[dir="ltr"] .search-clear { left: auto; right: 18px; }
.search-clear:hover { background: var(--card-hover); color: var(--text); }
.search-clear svg { width: 12px; height: 12px; }
.search-bar.has-text .search-clear { display: flex; }

/* ══════════════════════════════════════════════
   CATEGORIES BAR
══════════════════════════════════════════════ */
.categories-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  z-index: 90;
}
.categories-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  overflow-x: auto;
  scrollbar-width: none;
}
.categories-inner::-webkit-scrollbar { display: none; }
.cat-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 0;
  width: max-content;
  min-width: 100%;
}
.cat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-3);
  background: transparent;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}
.cat-btn:hover {
  color: var(--text-2);
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
}
.cat-btn.active {
  color: var(--primary);
  background: rgba(124,111,255,0.1);
  border-color: rgba(124,111,255,0.3);
}
.cat-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ══════════════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════════════ */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 28px 60px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-icon {
  width: 18px; height: 18px;
  color: var(--primary);
}
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.article-count {
  font-size: 0.78rem;
  color: var(--text-3);
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 50px;
}

/* ══════════════════════════════════════════════
   FEATURED CARD
══════════════════════════════════════════════ */
.featured-section { margin-bottom: 56px; }
.featured-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  transition: var(--transition);
  min-height: 320px;
}
.featured-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.featured-media {
  position: relative;
  overflow: hidden;
  background: var(--bg4);
  min-height: 260px;
}
.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.featured-card:hover .featured-media img { transform: scale(1.04); }
.featured-media-placeholder {
  width: 100%;
  height: 100%;
  min-height: 260px;
  background: linear-gradient(135deg, var(--bg4) 0%, var(--bg3) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.featured-media-placeholder svg {
  opacity: 0.2;
}
.featured-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 50px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
html[dir="ltr"] .featured-tag { right: auto; left: 16px; }
.featured-body {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
}
.featured-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.source-chip {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.source-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }
.featured-date-small { font-size: 0.72rem; color: var(--text-3); }
.featured-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.featured-desc {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.featured-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.featured-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-3);
}
.featured-meta svg { width: 13px; height: 13px; }
.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  padding: 10px 22px;
  border-radius: 50px;
  font-size: 0.84rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.read-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,111,255,0.4);
}
.read-btn svg { width: 14px; height: 14px; }

/* ══════════════════════════════════════════════
   NEWS GRID
══════════════════════════════════════════════ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}
.news-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  position: relative;
}
.news-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(124,111,255,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.22s;
  pointer-events: none;
}
.news-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-active);
  box-shadow: var(--shadow-card), 0 0 30px rgba(124,111,255,0.1);
}
.news-card:hover::before { opacity: 1; }

.card-media {
  position: relative;
  overflow: hidden;
  height: 190px;
  background: var(--bg4);
  flex-shrink: 0;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.news-card:hover .card-media img { transform: scale(1.05); }
.card-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--bg4) 0%, var(--bg3) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-placeholder svg { opacity: 0.15; }

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.card-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-source {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-date {
  font-size: 0.7rem;
  color: var(--text-3);
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.card-read-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: gap 0.2s;
}
.news-card:hover .card-read-link { gap: 8px; }
.card-read-link svg { width: 12px; height: 12px; }

/* ══════════════════════════════════════════════
   LOADING STATE
══════════════════════════════════════════════ */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
  gap: 18px;
}
.loading-ring svg {
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-3); font-size: 0.9rem; }

/* ══════════════════════════════════════════════
   NO RESULTS
══════════════════════════════════════════════ */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
  gap: 16px;
}
.no-results p {
  color: var(--text-3);
  font-size: 0.95rem;
}
.hidden { display: none !important; }

/* ══════════════════════════════════════════════
   ERROR BANNER
══════════════════════════════════════════════ */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(247,37,133,0.07);
  border: 1px solid rgba(247,37,133,0.2);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 28px;
  font-size: 0.85rem;
  color: #f78fba;
  line-height: 1.6;
}
.error-banner svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: #f72585; }

/* ══════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════ */
footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 36px 28px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 4px;
}
.footer-logo svg { color: var(--primary); }
footer p {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.8;
}

/* ══════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .featured-card { grid-template-columns: 1fr; }
  .featured-media { min-height: 200px; }
  .featured-body { padding: 24px 22px; }
  .featured-title { font-size: 1.2rem; }
  .hero { padding: 64px 20px 48px; }
}
@media (max-width: 640px) {
  .header-inner { padding: 0 16px; }
  .lang-btn { padding: 5px 8px; font-size: 0.72rem; }
  .flag-icon { display: none; }
  .hero h1 { font-size: 1.7rem; letter-spacing: -0.5px; }
  .hero p { font-size: 0.92rem; }
  main { padding: 28px 16px 48px; }
  .news-grid { grid-template-columns: 1fr; gap: 14px; }
  .hero-stats { max-width: 100%; }
  .categories-inner { padding: 0 12px; }
}
