/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-hover: #F4F4F1;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text-primary: #1A1A18;
  --text-secondary: #6B6B67;
  --text-tertiary: #9B9B97;
  --accent: #1A1A18;
  --accent-fg: #FAFAF8;
  --tag-bg: #F0EFE9;
  --tag-text: #4A4A46;
  --not-found: #C5C5C0;
  --badge-free: #E8F5EF;
  --badge-free-text: #1A6B42;
  --badge-paid: #FFF3E0;
  --badge-paid-text: #8B5E00;
  --verified: #2D7A4F;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 14px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --surface: #1C1C1A;
    --surface-hover: #242422;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.15);
    --text-primary: #F0EFE9;
    --text-secondary: #9B9B97;
    --text-tertiary: #6B6B67;
    --accent: #F0EFE9;
    --accent-fg: #111110;
    --tag-bg: #2A2A28;
    --tag-text: #C5C5C0;
    --not-found: #4A4A46;
    --badge-free: #0D2B1A;
    --badge-free-text: #5DCB8E;
    --badge-paid: #2B1F0A;
    --badge-paid-text: #F0B84A;
    --verified: #5DCB8E;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-card-hover: 0 4px 14px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  }
}

/* ── Base ───────────────────────────────────────────────────────────── */
html {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

html[lang="ar"] {
  font-family: 'Noto Sans Arabic', 'Inter', system-ui, sans-serif;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  background: rgba(250,250,248,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(17,17,16,0.88); }
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E53E3E;
  flex-shrink: 0;
  animation: live-pulse 1.6s ease-out infinite;
}

@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.7); opacity: 1; }
  60%  { box-shadow: 0 0 0 6px rgba(229, 62, 62, 0); opacity: 1; }
  100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0); opacity: 1; }
}

.lang-toggle {
  display: flex;
  gap: 2px;
  background: var(--tag-bg);
  border-radius: 6px;
  padding: 3px;
}

.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
}

.lang-btn:hover { color: var(--text-primary); }

.lang-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 24px 40px;
}

.hero-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-headline {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
  white-space: pre-line;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.hero-live-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #E53E3E;
  box-shadow: 0 0 8px rgba(229, 62, 62, 0.5);
  margin-top: 7px;
  animation: hero-live 2.4s ease-out infinite;
}

@keyframes hero-live {
  0% {
    box-shadow:
      0 0 0 0   rgba(229, 62, 62, 0.70),
      0 0 0 0   rgba(229, 62, 62, 0.30),
      0 0 8px   rgba(229, 62, 62, 0.50);
  }
  65% {
    box-shadow:
      0 0 0 10px rgba(229, 62, 62, 0),
      0 0 0 22px rgba(229, 62, 62, 0),
      0 0 8px   rgba(229, 62, 62, 0.50);
  }
  100% {
    box-shadow:
      0 0 0 0   rgba(229, 62, 62, 0),
      0 0 0 0   rgba(229, 62, 62, 0),
      0 0 8px   rgba(229, 62, 62, 0.50);
  }
}

.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
}

.stat-value {
  font-size: 14px;
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

.stat-label { color: var(--text-secondary); }

/* ── Controls ───────────────────────────────────────────────────────── */
.controls {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 24px;
}

.search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

html[dir="rtl"] .search-icon { left: auto; right: 16px; }

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

html[dir="rtl"] .search-input { padding: 0 44px 0 16px; }

.search-input::placeholder { color: var(--text-tertiary); }

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,26,24,0.08);
}

@media (prefers-color-scheme: dark) {
  .search-input:focus { box-shadow: 0 0 0 3px rgba(240,239,233,0.08); }
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.region-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  flex-wrap: wrap;
}

.region-tab {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 4px;
  position: relative;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
}

.region-tab:hover {
  background: var(--tag-bg);
  color: var(--text-primary);
}

.region-tab.active {
  color: var(--text-primary);
  background: var(--tag-bg);
}

.region-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  outline: none;
  flex-shrink: 0;
}

/* ── Grid ───────────────────────────────────────────────────────────── */
.grid-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ── Card ───────────────────────────────────────────────────────────── */
.country-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.country-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

html[dir="rtl"] .card-header { flex-direction: row-reverse; }

.card-flag { font-size: 22px; line-height: 1; flex-shrink: 0; }

.card-meta { flex: 1; min-width: 0; }

html[dir="rtl"] .card-meta { text-align: right; }

.card-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-code { font-size: 13px; color: var(--text-tertiary); }

.card-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-v { background: var(--badge-free); color: var(--badge-free-text); }
.badge-p { background: var(--tag-bg); color: var(--text-tertiary); }

/* ── Service rows ───────────────────────────────────────────────────── */
.card-body { padding: 4px 0; }

.svc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 16px;
  gap: 8px;
  transition: background 0.1s;
}

.svc-row:hover { background: var(--surface-hover); }

.svc-label {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[dir="rtl"] .svc-label { text-align: right; }

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

.svc-number {
  font-size: 15px;
  font-weight: 500;
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  letter-spacing: 0.01em;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
  cursor: pointer;
}

.svc-number:hover { background: var(--tag-bg); }

.svc-number.not-found {
  color: var(--not-found);
  cursor: default;
  font-weight: 400;
}

.svc-number.copied { color: var(--verified); }

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 4px;
}

.badge-free { background: var(--badge-free); color: var(--badge-free-text); }
.badge-paid { background: var(--badge-paid); color: var(--badge-paid-text); }
.badge-24h  { background: var(--tag-bg); color: var(--tag-text); font-size: 10px; }

/* ── Show more ──────────────────────────────────────────────────────── */
.card-sep { height: 1px; background: var(--border); margin: 0 16px; }

.show-more-btn {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: inherit;
  padding: 10px 16px;
  text-align: left;
  transition: color 0.12s, background 0.12s;
}

html[dir="rtl"] .show-more-btn { text-align: right; }

.show-more-btn:hover { color: var(--text-primary); background: var(--surface-hover); }

.extra-rows {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.extra-rows.open { max-height: 1000px; }

/* ── Tooltip ────────────────────────────────────────────────────────── */
.tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) translateY(calc(-100% - 6px));
  transition: opacity 0.12s;
}

.tooltip.show { opacity: 1; }

/* ── Empty state ────────────────────────────────────────────────────── */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 80px 24px;
  text-align: center;
}

.empty-state.show { display: flex; }

.empty-ring {
  width: 32px;
  height: 32px;
  border: 2px solid var(--not-found);
  border-radius: 50%;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-sub { font-size: 14px; color: var(--text-tertiary); }

/* ── Error banner ───────────────────────────────────────────────────── */
.error-banner {
  display: none;
  max-width: 600px;
  margin: 40px auto;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.error-banner.show { display: block; }
.error-banner code {
  background: var(--tag-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--text-primary);
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

html[dir="rtl"] .site-footer { flex-direction: row-reverse; }

.footer-note, .footer-date {
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-legal {
  font-size: 13px;
}
.footer-legal a {
  color: var(--text-tertiary);
  text-decoration: none;
}
.footer-legal a:hover {
  color: var(--text-secondary);
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero { padding: 32px 16px 28px; }
  .hero-headline { font-size: 24px; }
  .hero-inner { flex-direction: column; gap: 20px; }
  .hero-stats { flex-direction: row; flex-wrap: wrap; }
  .controls { padding: 0 16px 20px; }
  .grid-wrap { padding: 0 16px 48px; }
  .country-grid { grid-template-columns: 1fr; }
  .site-header { padding: 0 16px; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .sort-select { align-self: flex-end; }
}

html[dir="rtl"] .hero-inner { flex-direction: row-reverse; }

/* ── Card header clickable ───────────────────────────────────────────── */
.card-header {
  cursor: pointer;
}
.card-header:hover .card-name {
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

/* ── Detail view ─────────────────────────────────────────────────────── */
.detail-view {
  min-height: calc(100vh - 52px - 65px);
}

.detail-topbar {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 24px 0;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.back-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

html[dir="rtl"] .back-btn svg {
  transform: scaleX(-1);
}

.detail-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.detail-content {}

/* Country header */
.detail-country-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.detail-flag {
  font-size: 56px;
  line-height: 1;
  flex-shrink: 0;
}

.detail-info { flex: 1; min-width: 0; }

.detail-name {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-calling-code {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-region-tag {
  font-size: 12px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 2px 8px;
  border-radius: 4px;
}

.detail-status {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Services table */
.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.detail-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.detail-svc-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.detail-svc-row:last-child { border-bottom: none; }
.detail-svc-row:hover { background: var(--surface-hover); }

.detail-svc-label {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
}

html[dir="rtl"] .detail-svc-label { text-align: right; }

.detail-svc-number {
  font-size: 22px;
  font-weight: 600;
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.detail-svc-number.not-found {
  font-size: 16px;
  color: var(--not-found);
  font-weight: 400;
}

.detail-copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
  white-space: nowrap;
}

.detail-copy-btn:hover {
  background: var(--tag-bg);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.detail-copy-btn.copied {
  color: var(--verified);
  border-color: var(--badge-free-text);
  background: var(--badge-free);
}

/* Call button — mobile only */
.detail-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--badge-free);
  border: 1px solid var(--badge-free-text);
  border-radius: 5px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--badge-free-text);
  text-decoration: none;
  transition: background 0.12s, transform 0.1s;
  flex-shrink: 0;
  white-space: nowrap;
}

.detail-call-btn:active {
  transform: scale(0.97);
}

/* Tel link in card grid — mobile */
.svc-number.svc-tel {
  color: var(--text-primary);
  text-decoration: none;
  display: inline-block;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.1s;
}

.svc-number.svc-tel:active {
  background: var(--badge-free);
  color: var(--badge-free-text);
}

/* Note */
.detail-note {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 12px 16px;
  background: var(--tag-bg);
  border-radius: 6px;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .detail-topbar { padding: 16px 16px 0; }
  .detail-wrap   { padding: 16px 16px 48px; }
  .detail-flag   { font-size: 40px; }
  .detail-name   { font-size: 22px; }
  .detail-svc-number { font-size: 18px; }
  .detail-svc-row { padding: 12px 16px; }
}

/* ── SEO intro (visually hidden, crawlable) ──────────────────────── */
.seo-intro {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── FAQ Section ─────────────────────────────────────────────────── */
.faq-section {
  max-width: 760px;
  margin: 48px auto 64px;
  padding: 0 24px;
}

.faq-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq-item {
  border-top: 1px solid var(--border);
  padding: 18px 0;
}

.faq-item:last-child {
  border-bottom: 1px solid var(--border);
}

.faq-q {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.faq-a {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

@media (max-width: 600px) {
  .faq-section { padding: 0 16px; margin-top: 32px; }
  .faq-title   { font-size: 17px; }
  .faq-q       { font-size: 13px; }
}
