/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; max-width: 100vw; }
body {
  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  direction: rtl;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; font-family: inherit; }
input { font-family: inherit; }

/* ── Container ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,17,23,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 16px 0;
}
.header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #6c63ff, #3b82f6);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: white;
}
.logo-title { font-size: 18px; font-weight: 800; color: #fff; }
.logo-sub { font-size: 11px; color: #64748b; margin-top: 2px; }
.header-nav { display: flex; gap: 8px; }
.nav-link {
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: #94a3b8;
  transition: all 0.2s;
}
.nav-link:hover, .nav-link.active {
  background: rgba(108,99,255,0.15); color: #818cf8;
}

/* ── Hero ── */
.hero {
  padding: 80px 0 60px;
  background: radial-gradient(ellipse at 50% 0%, rgba(108,99,255,0.15) 0%, transparent 70%);
  text-align: center;
}
.hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800; color: #fff;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 0%, #818cf8 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-sub { font-size: 16px; color: #64748b; margin-bottom: 40px; }

/* ── Search Box ── */
.search-box {
  display: flex; gap: 0; max-width: 680px; margin: 0 auto 24px;
  background: #1e2030; border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.search-box input {
  flex: 1; padding: 18px 24px;
  background: transparent; border: none; outline: none;
  font-size: 17px; color: #fff;
  text-align: right;
}
.search-box input::placeholder { color: #475569; }
.btn-primary {
  padding: 0 32px; background: linear-gradient(135deg, #6c63ff, #3b82f6);
  color: white; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  transition: opacity 0.2s;
  min-width: 110px; justify-content: center;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; }

/* ── Loader Spinner ── */
.loader {
  width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Trending Pills ── */
.trending-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 16px; }
.trend-pill {
  padding: 6px 14px; border-radius: 20px;
  background: rgba(255,255,255,0.06); color: #94a3b8;
  font-size: 13px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.07);
  transition: all 0.2s;
}
.trend-pill:hover { background: rgba(108,99,255,0.2); color: #818cf8; border-color: rgba(108,99,255,0.3); }

/* ── Dashboard ── */
.dashboard { padding: 40px 0 80px; }

/* ── KPI Grid ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: #1e2030; border-radius: 16px;
  padding: 20px; border: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 16px;
  transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.kpi-blue { background: rgba(59,130,246,0.15); }
.kpi-green { background: rgba(16,185,129,0.15); }
.kpi-orange { background: rgba(245,158,11,0.15); }
.kpi-purple { background: rgba(139,92,246,0.15); }
.kpi-value { font-size: 28px; font-weight: 800; color: #fff; }
.kpi-label { font-size: 13px; color: #64748b; margin-top: 4px; }

/* ── Score Meters ── */
.scores-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.score-card {
  background: #1e2030; border-radius: 16px;
  padding: 20px; border: 1px solid rgba(255,255,255,0.06);
}
.score-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 15px; font-weight: 600; }
.score-badge {
  padding: 4px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
  background: rgba(239,68,68,0.15); color: #f87171;
}
.score-badge.badge-green { background: rgba(16,185,129,0.15); color: #34d399; }
.score-badge.badge-yellow { background: rgba(245,158,11,0.15); color: #fbbf24; }
.meter-track {
  height: 10px; background: rgba(255,255,255,0.07); border-radius: 10px; overflow: hidden;
  margin-bottom: 8px;
}
.meter-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, #f87171, #ef4444);
  transition: width 1s ease;
}
.meter-fill.meter-green { background: linear-gradient(90deg, #34d399, #10b981); }
.meter-labels { display: flex; justify-content: space-between; font-size: 11px; color: #475569; }

/* ── Charts ── */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card {
  background: #1e2030; border-radius: 16px;
  padding: 24px; border: 1px solid rgba(255,255,255,0.06);
}
.chart-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: #e2e8f0; }

/* ── Bottom Row ── */
.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.related-card, .freshness-card {
  background: #1e2030; border-radius: 16px;
  padding: 24px; border: 1px solid rgba(255,255,255,0.06);
}
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: #e2e8f0; }
.keyword-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.kw-pill {
  padding: 6px 14px; border-radius: 20px;
  background: rgba(108,99,255,0.1); color: #818cf8;
  font-size: 13px; cursor: pointer;
  border: 1px solid rgba(108,99,255,0.2);
  transition: all 0.2s; display: flex; align-items: center; gap: 6px;
}
.kw-pill:hover { background: rgba(108,99,255,0.25); }
.kw-freq { background: rgba(108,99,255,0.3); padding: 1px 6px; border-radius: 10px; font-size: 11px; }

/* ── Price Range ── */
.price-range-card {
  background: #1e2030; border-radius: 16px;
  padding: 24px; border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 24px;
}
.price-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.price-stat { text-align: center; }
.ps-label { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.ps-value { font-size: 24px; font-weight: 800; }
.ps-value.green { color: #34d399; }
.ps-value.blue { color: #60a5fa; }
.ps-value.orange { color: #fbbf24; }
.ps-value.red { color: #f87171; }

/* ── Tables ── */
.table-card {
  background: #1e2030; border-radius: 16px;
  padding: 24px; border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 24px; overflow-x: auto;
}
.table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 14px; background: rgba(255,255,255,0.04);
  color: #64748b; font-size: 13px; font-weight: 600;
  text-align: right; border-bottom: 1px solid rgba(255,255,255,0.07);
}
.data-table td {
  padding: 12px 14px; font-size: 14px; color: #cbd5e1;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Listings Grid ── */
.listings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.listing-card {
  background: rgba(255,255,255,0.03); border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  overflow: hidden; transition: transform 0.2s, border-color 0.2s;
}
.listing-card:hover { transform: translateY(-3px); border-color: rgba(108,99,255,0.3); }
.listing-img { width: 100%; height: 160px; object-fit: cover; background: #1e2030; }
.listing-img-placeholder { width: 100%; height: 160px; background: #1e2030; display: flex; align-items: center; justify-content: center; color: #334155; font-size: 36px; }
.listing-body { padding: 12px; }
.listing-title { font-size: 14px; font-weight: 600; color: #e2e8f0; margin-bottom: 8px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-meta { display: flex; justify-content: space-between; align-items: center; }
.listing-price { font-size: 16px; font-weight: 800; color: #34d399; }
.listing-city { font-size: 12px; color: #64748b; }
.listing-time { font-size: 11px; color: #475569; margin-top: 4px; }
.listing-link { display: block; margin-top: 8px; padding: 6px 0; text-align: center; color: #818cf8; font-size: 12px; border-top: 1px solid rgba(255,255,255,0.05); }
.listing-link:hover { color: #a5b4fc; }

/* ── Export Btn ── */
.btn-export {
  padding: 8px 16px; border-radius: 8px;
  background: rgba(16,185,129,0.1); color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
  font-size: 13px; font-weight: 600;
  transition: all 0.2s;
}
.btn-export:hover { background: rgba(16,185,129,0.2); }

/* ── Load More ── */
.load-more { text-align: center; margin-top: 20px; }
.btn-outline {
  padding: 10px 24px; border-radius: 10px;
  background: transparent; color: #818cf8;
  border: 1px solid rgba(108,99,255,0.3);
  font-size: 14px; font-weight: 600;
  transition: all 0.2s;
}
.btn-outline:hover { background: rgba(108,99,255,0.1); }

/* ── Compare Section ── */
.tab-section { padding: 60px 0; }
.section-heading { font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 32px; text-align: center; }
.compare-inputs { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto 40px; flex-wrap: wrap; }
.compare-input {
  flex: 1; padding: 14px 18px; border-radius: 12px;
  background: #1e2030; border: 1px solid rgba(255,255,255,0.1);
  color: #fff; font-size: 15px; min-width: 160px;
}
.compare-input:focus { outline: none; border-color: rgba(108,99,255,0.5); }
.vs-badge {
  font-size: 16px; font-weight: 800; color: #64748b;
  padding: 0 8px; flex-shrink: 0;
}
.compare-results { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.compare-col { background: #1e2030; border-radius: 16px; padding: 24px; border: 1px solid rgba(255,255,255,0.06); }
.compare-kw { font-size: 20px; font-weight: 800; color: #818cf8; margin-bottom: 16px; }
.compare-stat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 14px; }
.compare-stat-label { color: #64748b; }
.compare-stat-value { color: #e2e8f0; font-weight: 600; }

/* ── Trending Grid ── */
.trending-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.trending-item {
  background: #1e2030; border-radius: 12px; padding: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer; transition: all 0.2s;
  text-align: center;
}
.trending-item:hover { border-color: rgba(108,99,255,0.3); background: rgba(108,99,255,0.07); }
.trending-kw { font-size: 18px; font-weight: 700; color: #e2e8f0; margin-bottom: 6px; }
.trending-rank { font-size: 12px; color: #64748b; }

/* ── Loading Overlay ── */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.loading-box { text-align: center; }
.spinner {
  width: 60px; height: 60px;
  border: 4px solid rgba(108,99,255,0.2);
  border-top-color: #6c63ff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
.loading-text { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.loading-sub { font-size: 14px; color: #64748b; }

/* ── Share Bar (inside meter) ── */
.share-bar { height: 6px; background: rgba(108,99,255,0.3); border-radius: 3px; margin-top: 4px; }
.share-fill { height: 100%; background: #6c63ff; border-radius: 3px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .header .container { flex-direction: column; gap: 12px; }
  .hero { padding: 48px 0 40px; }
  .search-box { flex-direction: column; border-radius: 12px; }
  .btn-primary { width: 100%; padding: 16px; border-radius: 0 0 12px 12px; }
  .scores-row, .charts-row, .bottom-row { grid-template-columns: 1fr; }
  .price-stats { grid-template-columns: 1fr 1fr; }
  .compare-results { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .price-stats { grid-template-columns: 1fr 1fr; }
}
