@font-face { font-family: 'NotoSansArabic'; src: url('../fonts/NotoSansArabic-Regular.ttf'); font-weight: 400; }
@font-face { font-family: 'NotoSansArabic'; src: url('../fonts/NotoSansArabic-Medium.ttf'); font-weight: 500; }
@font-face { font-family: 'NotoSansArabic'; src: url('../fonts/NotoSansArabic-SemiBold.ttf'); font-weight: 600; }
@font-face { font-family: 'NotoSansArabic'; src: url('../fonts/NotoSansArabic-Bold.ttf'); font-weight: 700; }

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

:root {
  --purple: #3B0FA0;
  --purple-dark: #1a0560;
  --gold: #C97D00;
  --alt: #F8F7FF;
  --text: #1a1a2e;
  --muted: #6b6b8a;
  --line: rgba(59, 15, 160, 0.08);
  --shadow: 0 4px 12px rgba(59, 15, 160, 0.07);
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: #fff;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }

.lang-switcher {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 16px;
  z-index: 100;
}

.lang-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #111827;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  cursor: pointer;
}

.lang-btn img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 50%;
}

.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 152px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(59, 15, 160, 0.14);
}

.lang-menu.open { display: block; }

.lang-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.lang-menu button:hover { background: rgba(59, 15, 160, 0.06); }
.nav-flag { width: 28px; height: 20px; object-fit: cover; border-radius: 3px; }

.hero {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  padding: 72px 24px 48px;
  color: #fff;
}

.hero-inner {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.hero-logo {
  width: min(240px, 64vw);
  height: auto;
  margin: 0 auto 16px;
  display: block;
}

.hero-sub {
  max-width: 460px;
  margin: 0 auto 32px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 15px;
  line-height: 1.5;
}

.hero-sub strong {
  color: var(--gold);
  font-weight: 800;
}

.track-panel {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  text-align: left;
}

.track-panel h1 {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
}

.track-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.track-box input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px 12px 44px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1.5px;
  background:
    linear-gradient(transparent, transparent),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%233B0FA0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 14px center / 20px;
}

.track-box input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple);
}

.track-box button {
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: var(--gold);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

#heroResult {
  margin-top: 16px;
  text-align: left;
}

.section {
  padding: 36px 24px;
  background: #fff;
}

.section-alt { background: var(--alt); }

.section-inner {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(59, 15, 160, 0.08);
  color: var(--purple);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  line-height: 1;
  text-transform: uppercase;
}

.section h2 {
  margin-top: 8px;
  margin-bottom: 16px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
}

.content-card {
  width: 100%;
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.section-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: left;
  white-space: pre-line;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
}

.stat-num {
  display: block;
  color: var(--purple);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.route-flags {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.route-flags img {
  width: 32px;
  height: 22px;
  object-fit: cover;
  border-radius: 3px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
}

.service-card {
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--alt);
}

.service-card .material-symbols-outlined {
  color: var(--purple);
  font-size: 28px;
}

.service-card h3 {
  margin-top: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.service-card p {
  margin-top: 4px;
  color: #8a8a9a;
  font-size: 11px;
  line-height: 1.4;
}

.city-card { padding: 24px 16px; }

.cities {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.city {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid rgba(59, 15, 160, 0.2);
  border-radius: 30px;
  background: #fff;
  color: var(--purple);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(59, 15, 160, 0.06);
}

.city .material-symbols-outlined { font-size: 18px; }

.contact-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  text-align: left;
}

.contact-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--alt);
  color: var(--text);
  text-decoration: none;
}

.contact-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(59, 15, 160, 0.08);
  color: var(--purple);
  font-size: 20px;
}

.contact-item strong {
  display: block;
  color: #8a8a9a;
  font-size: 11px;
  font-weight: 700;
}

.contact-item small {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.chevron {
  color: #a1a1aa;
  font-size: 18px;
}

.footer {
  padding: 36px 24px;
  background: var(--text);
  color: rgba(255, 255, 255, 0.54);
  text-align: center;
}

.footer-logo {
  height: 40px;
  width: auto;
  margin-bottom: 12px;
}

.footer p {
  margin-top: 4px;
  font-size: 12px;
}

.footer a {
  color: rgba(255, 255, 255, 0.54);
  text-decoration: none;
}

.result-card {
  padding: 20px;
  border: 1px solid rgba(59, 15, 160, 0.1);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tracking-code {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
}

.recipient {
  margin-top: 2px;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.city-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid currentColor;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-collected { color: #71717a; background: #f4f4f5; }
.status-in_transit { color: #1a56db; background: #e0eaff; }
.status-arrived_at_branch,
.status-ready_for_pickup { color: #0d7a6b; background: #e0f7f4; }
.status-delivered { color: #1a7a40; background: #e6f9ee; }

.timeline {
  margin-top: 20px;
}

.tl-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 58px;
  opacity: 0.4;
}

.tl-item.done { opacity: 1; }

.tl-item::before {
  content: '';
  position: absolute;
  top: 28px;
  bottom: 0;
  left: 12px;
  width: 2px;
  background: #e4e4e7;
}

.tl-item.done::before { background: var(--purple); }
.tl-item:last-child::before { display: none; }

.tl-dot {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 2px solid #e4e4e7;
  border-radius: 50%;
  background: #fff;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.tl-item.done .tl-dot {
  border-color: var(--purple);
  background: var(--purple);
}

.tl-content {
  padding-bottom: 18px;
}

.tl-label {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.tl-item:not(.done) .tl-label { color: #a1a1aa; }

.tl-date {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.result-error {
  padding: 14px 16px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 700;
}

#langPickerOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(26, 5, 96, 0.82);
}

.lang-picker-box {
  width: 100%;
  max-width: 420px;
  padding: 36px 28px 28px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(59, 15, 160, 0.3);
  text-align: center;
}

.lang-picker-logo {
  height: 44px;
  margin-bottom: 24px;
}

.lang-picker-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.lang-picker-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.lang-picker-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
}

.lang-pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  gap: 4px;
  border: 1px solid rgba(59, 15, 160, 0.15);
  border-radius: 14px;
  background: var(--alt);
  color: var(--text);
  cursor: pointer;
}

.lang-pick-img {
  width: 36px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}

.lang-pick-name {
  font-size: 15px;
  font-weight: 800;
}

.lang-pick-sub {
  color: var(--muted);
  font-size: 11px;
}

[dir="rtl"] body {
  font-family: 'NotoSansArabic', 'Inter', sans-serif;
}

[dir="rtl"] .lang-switcher {
  right: 16px;
  left: auto;
}

[dir="rtl"] .lang-menu {
  right: 0;
  left: auto;
}

[dir="rtl"] .lang-menu button,
[dir="rtl"] .track-panel,
[dir="rtl"] .section-text,
[dir="rtl"] .service-grid,
[dir="rtl"] .contact-list,
[dir="rtl"] #heroResult {
  text-align: right;
}

[dir="rtl"] .track-box input {
  padding-right: 44px;
  padding-left: 14px;
  background-position: right 14px center;
  text-align: right;
}

[dir="rtl"] .contact-item {
  grid-template-columns: auto 1fr auto;
}

[dir="rtl"] .chevron {
  transform: rotate(180deg);
}

[dir="rtl"] .tl-item::before {
  right: 12px;
  left: auto;
}

@media (min-width: 720px) {
  .hero { padding-top: 88px; }
  .track-box { grid-template-columns: 1fr auto; }
  .track-box button { padding: 0 28px; }
  .section { padding: 44px 24px; }
}

@media (max-width: 380px) {
  .service-grid { grid-template-columns: 1fr; }
}
