/* ArabSEO AI - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg:       #070b14;
  --bg2:      #0d1120;
  --card:     rgba(255,255,255,0.04);
  --border:   rgba(255,255,255,0.08);
  --text:     #f1f5f9;
  --muted:    rgba(255,255,255,0.42);
  --accent:   #6366f1;
  --accent2:  #8b5cf6;
  --green:    #10b981;
  --yellow:   #f59e0b;
  --red:      #ef4444;
  --pink:     #ec4899;
  --font-en:  'Plus Jakarta Sans', sans-serif;
  --font-ar:  'Cairo', sans-serif;
  --font:     var(--font-en);
  --r:        14px;
  --shadow:   0 4px 24px rgba(0,0,0,0.4);
}

html[lang="ar"] { --font: var(--font-ar); }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.35); border-radius: 3px; }

/* ─── UTILITY ─── */
.hidden { display: none !important; }
.grad {
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── HEADER ─── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(7,11,20,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  height: 62px;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-text { font-weight: 900; font-size: 20px; font-family: var(--font); }
.logo-badge {
  background: var(--accent); border-radius: 6px;
  padding: 2px 8px; font-size: 11px; font-weight: 800;
}
.header-right { display: flex; align-items: center; gap: 14px; }

.lang-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 700;
  padding: 7px 14px; transition: 0.2s;
}
.lang-btn:hover { border-color: var(--accent); color: #a5b4fc; }

.nav-links { display: flex; gap: 4px; }
.nav-link {
  color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 600; padding: 7px 14px;
  border-radius: 8px; transition: 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--card); }
.nav-link.active { color: #a5b4fc; }

/* ─── HERO ─── */
.hero {
  max-width: 800px; margin: 0 auto;
  padding: 72px 24px 48px;
  text-align: center;
  background: radial-gradient(ellipse 70% 60% at 50% -10%, rgba(99,102,241,0.18) 0%, transparent 70%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.25);
  border-radius: 100px; padding: 6px 16px; font-size: 13px; color: #a5b4fc;
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(30px,5vw,56px); font-weight: 900;
  letter-spacing: -1.5px; line-height: 1.18; margin-bottom: 18px;
}
.hero p {
  color: var(--muted); font-size: 16px; max-width: 520px;
  margin: 0 auto 32px; line-height: 1.75;
}

/* ─── SEARCH SECTION ─── */
.search-section { padding: 0 24px 32px; max-width: 900px; margin: 0 auto; }

.search-card {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.search-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}

.search-input-wrap {
  flex: 1; min-width: 220px; position: relative;
}
.search-icon {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 18px; pointer-events: none; z-index: 1;
}
html[dir="ltr"] .search-icon { left: 14px; }
html[dir="rtl"] .search-icon { right: 14px; }

.search-inp {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-family: var(--font); font-size: 15px;
  outline: none; padding: 14px 18px; transition: 0.2s;
}
html[dir="ltr"] .search-inp { padding-left: 44px; }
html[dir="rtl"] .search-inp { padding-right: 44px; }
.search-inp:focus { border-color: rgba(99,102,241,0.5); background: rgba(99,102,241,0.06); }
.search-inp::placeholder { color: var(--muted); }

/* Autocomplete */
.autocomplete-box {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #12172a; border: 1px solid rgba(99,102,241,0.3);
  border-radius: 12px; overflow: hidden; z-index: 200;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.autocomplete-item {
  padding: 11px 16px; cursor: pointer; font-size: 14px;
  transition: background 0.15s; display: flex; align-items: center; gap: 10px;
}
.autocomplete-item:hover { background: rgba(99,102,241,0.15); }
.autocomplete-item .ac-icon { opacity: 0.4; font-size: 13px; }

.select-inp {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-family: var(--font);
  font-size: 14px; outline: none; padding: 14px 16px; cursor: pointer;
  appearance: none; min-width: 150px;
}
.select-inp option { background: #12172a; }

.btn-search {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; border-radius: var(--r); color: #fff; cursor: pointer;
  font-family: var(--font); font-size: 15px; font-weight: 700;
  padding: 14px 28px; transition: 0.2s; display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.btn-search:hover { transform: translateY(-1px); box-shadow: 0 0 24px rgba(99,102,241,0.4); }
.btn-search:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-arrow { font-size: 18px; }

/* Filters */
.filter-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.filter-label { font-size: 12.5px; color: var(--muted); }
.filter-chip {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 100px; color: var(--muted); cursor: pointer;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  padding: 5px 14px; transition: 0.2s;
}
.filter-chip:hover { border-color: rgba(99,102,241,0.4); color: var(--text); }
.filter-chip.active {
  background: rgba(99,102,241,0.2); border-color: rgba(99,102,241,0.5);
  color: #a5b4fc;
}

/* ─── RESULTS SECTION ─── */
.results-section { max-width: 1100px; margin: 0 auto; padding: 0 24px 48px; }

/* State boxes */
.state-box {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 72px 20px; text-align: center;
}
.state-icon { font-size: 56px; }
.state-text { font-size: 17px; font-weight: 600; color: rgba(255,255,255,0.5); }
.state-sub { font-size: 13px; color: rgba(255,255,255,0.25); }
.btn-retry {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); cursor: pointer; font-family: var(--font); font-size: 14px;
  padding: 10px 22px; margin-top: 8px; transition: 0.2s;
}
.btn-retry:hover { border-color: var(--accent); }

/* Spinner */
.spinner-ring {
  width: 52px; height: 52px;
  border: 3px solid rgba(99,102,241,0.2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Summary bar */
.results-summary {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap; gap: 10px;
}
.summary-left { display: flex; align-items: center; gap: 10px; }
.results-kw-label { font-size: 15px; font-weight: 700; }
.results-count-badge {
  background: rgba(99,102,241,0.2); border-radius: 100px;
  color: #a5b4fc; font-size: 12px; font-weight: 700; padding: 3px 12px;
}
.summary-right { display: flex; gap: 8px; }

.btn-export, .btn-copy-all {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 9px; color: var(--muted); cursor: pointer;
  font-family: var(--font); font-size: 12.5px; font-weight: 600;
  padding: 8px 14px; transition: 0.2s;
}
.btn-export:hover, .btn-copy-all:hover { border-color: rgba(99,102,241,0.4); color: var(--text); }

/* Source notice */
.source-notice {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); margin-bottom: 14px;
}
.source-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  box-shadow: 0 0 6px var(--green); animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ─── TABLE ─── */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--border); }

.kw-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.kw-table th {
  padding: 11px 14px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.025);
  white-space: nowrap;
}
html[dir="ltr"] .kw-table th { text-align: left; }
html[dir="rtl"] .kw-table th { text-align: right; }

.th-check { width: 40px; }

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: #a5b4fc; }
.sort-icon { opacity: 0.4; font-size: 11px; }

.kw-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.kw-table tr:last-child td { border-bottom: none; }
.kw-table tr:hover td { background: rgba(255,255,255,0.025); }

.td-keyword { font-weight: 600; min-width: 200px; }
.td-volume { color: #a5b4fc; font-weight: 700; font-size: 14px; }

/* Diff bar */
.diff-wrap { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.diff-track { flex: 1; height: 5px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.diff-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.diff-num { font-size: 12px; font-weight: 700; min-width: 28px; }

/* Intent badge */
.intent-badge {
  border-radius: 100px; padding: 3px 12px; font-size: 12px; font-weight: 700;
  white-space: nowrap;
}

/* Trend */
.trend-badge { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.trend-rising   { color: var(--green); }
.trend-declining { color: var(--red); }
.trend-stable   { color: var(--yellow); }

/* Copy btn */
.btn-copy-kw {
  background: none; border: none; color: rgba(255,255,255,0.25);
  cursor: pointer; padding: 4px 6px; border-radius: 6px;
  transition: 0.15s; font-size: 14px;
}
.btn-copy-kw:hover { color: var(--text); background: var(--card); }

/* Row selected */
.kw-table tr.selected td { background: rgba(99,102,241,0.07); }

/* ─── QUESTIONS ─── */
.questions-card {
  margin-top: 20px;
  background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.2);
  border-radius: 16px; padding: 20px;
}
.questions-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: #a5b4fc; margin-bottom: 14px;
}
.questions-list { display: flex; flex-direction: column; gap: 8px; }
.question-item {
  background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px;
  cursor: pointer; transition: 0.2s; display: flex; justify-content: space-between;
  align-items: center;
}
.question-item:hover { border-color: rgba(99,102,241,0.35); background: rgba(99,102,241,0.08); }
.q-search-icon { opacity: 0.3; font-size: 13px; }

/* ─── RELATED TAGS ─── */
.related-card {
  margin-top: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px;
}
.related-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.related-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.related-tag {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 100px; color: var(--muted); cursor: pointer;
  font-size: 12.5px; padding: 6px 14px; transition: 0.2s;
}
.related-tag:hover {
  background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4);
  color: var(--text);
}

/* ─── NOTICE ─── */
.notice-section { max-width: 900px; margin: 0 auto; padding: 0 24px 40px; }
.notice-card {
  background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.2);
  border-radius: 14px; padding: 16px 20px;
  display: flex; gap: 14px; align-items: flex-start;
}
.notice-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.notice-title { font-size: 13.5px; font-weight: 700; color: #fcd34d; margin-bottom: 5px; }
.notice-text { font-size: 12.5px; color: rgba(255,255,255,0.5); line-height: 1.7; }

/* ─── TOAST ─── */
#toast {
  position: fixed; top: 22px; left: 50%; z-index: 9999;
  transform: translateX(-50%) translateY(-20px);
  background: var(--green); color: #fff; padding: 12px 24px;
  border-radius: 12px; font-size: 14px; font-weight: 700;
  font-family: var(--font); opacity: 0; transition: 0.3s;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }
#toast.info  { background: var(--accent); }

/* ─── FOOTER ─── */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px; text-align: center;
  display: flex; justify-content: center; gap: 24px;
  color: rgba(255,255,255,0.2); font-size: 12.5px;
}

/* ─── RESPONSIVE ─── */
@media(max-width: 640px) {
  .hero { padding: 56px 16px 32px; }
  .search-row { flex-direction: column; }
  .select-inp, .btn-search { width: 100%; }
  .nav-links { display: none; }
  .results-summary { flex-direction: column; align-items: flex-start; }
}

/* ─── SEO TEXT SECTION ─── */
.seo-text-section {
  max-width: 900px; margin: 0 auto; padding: 0 24px 12px;
}
.seo-text-inner {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px; padding: 22px 26px;
}
.seo-text-inner h2 {
  font-size: 15px; font-weight: 700; color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
}
.seo-text-inner p {
  font-size: 13px; color: rgba(255,255,255,0.3); line-height: 1.75;
  margin: 0;
}

/* ─── RTL FIXES ─── */
html[dir="rtl"] .btn-arrow { transform: scaleX(-1); }
html[dir="rtl"] .source-notice { flex-direction: row-reverse; }
html[dir="rtl"] .autocomplete-box { right: 0; left: 0; }
