@font-face {
  font-family: "SF Arabic";
  src: url("../fonts/SFArabic-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --brand: #042b68;
  --accent: #04aefc;
  --accent-soft: #e8f7ff;
  --text: #202124;
  --muted: #5f6368;
  --border: #dadce0;
  --surface: #ffffff;
  --background: #ffffff;
  --danger: #b3261e;
  --success: #137333;
  --shadow: 0 2px 6px rgba(60, 64, 67, 0.12), 0 8px 24px rgba(60, 64, 67, 0.08);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  color-scheme: light;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--background);
  color: var(--text);
  font-family: Arial, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[dir="rtl"] body,
body[dir="rtl"] {
  font-family: "SF Arabic", Tahoma, Arial, sans-serif;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
button, a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid rgba(4, 174, 252, 0.45);
  outline-offset: 3px;
}

.flights-product {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.skip-link {
  position: fixed;
  z-index: 9999;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  transform: translateY(-160%);
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.skip-link:focus { transform: translateY(0); }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

/* Google-style application header */
.app-header {
  position: sticky;
  z-index: 1000;
  top: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
}

.app-header-inner {
  display: flex;
  width: min(1320px, calc(100% - 32px));
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-inline: auto;
}

.app-header-start {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.app-brand {
  display: flex;
  width: 104px;
  height: 66px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: transparent;
  line-height: 0;
}

.app-brand img {
  width: 96px;
  height: 62px;
  object-fit: contain;
  object-position: center;
}

.app-nav {
  display: flex;
  align-items: center;
}

.nav-chip {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid #c2e7ff;
  border-radius: 22px;
  background: var(--accent-soft);
  color: var(--brand);
  font-weight: 700;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.nav-chip:hover { background: #dff4ff; }
.nav-chip:active { background: #cceeff; }

.nav-chip svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.language-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
  font-weight: 700;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.language-toggle:hover {
  border-color: #bdc1c6;
  background: #f1f3f4;
}

.language-toggle:active { background: #e8eaed; }

/* Primary flight-search screen */
.search-main {
  flex: 1;
  padding: 14px 16px 40px;
}

.search-layout {
  width: min(1040px, 100%);
  margin-inline: auto;
}

.flight-hero {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 1;
  border-radius: 18px;
  background: var(--accent-soft);
}

.flight-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.flight-hero h1 {
  position: absolute;
  right: 0;
  bottom: 15px;
  left: 0;
  margin: 0;
  color: var(--brand);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[dir="rtl"] .flight-hero h1 {
  letter-spacing: 0;
}

.search-panel {
  position: relative;
  z-index: 2;
  min-width: 0;
  margin-top: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.widget-viewport,
#tpwl-search,
#tpwl-tickets {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.widget-viewport {
  overflow-x: clip;
  overscroll-behavior-inline: contain;
}

.widget-loading {
  display: grid;
  min-height: 110px;
  place-items: center;
  border-radius: 12px;
  background: #f8f9fa;
  text-align: center;
}

.widget-loading[hidden],
.widget-error[hidden],
.offline-notice[hidden] {
  display: none;
}

.loading-inner {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 20px;
  color: var(--muted);
}

.loading-inner p { margin: 0; }

.loader {
  width: 36px;
  height: 36px;
  border: 3px solid #e0e3e7;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.widget-error,
.offline-notice {
  padding: 22px;
  border: 1px solid #f2b8b5;
  border-radius: 12px;
  background: #fce8e6;
  color: var(--danger);
  text-align: center;
}

.offline-notice {
  border-color: #c2e7ff;
  background: var(--accent-soft);
  color: var(--brand);
}

.widget-error p,
.offline-notice p {
  margin: 0 0 14px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 0;
  border-radius: 22px;
  cursor: pointer;
  font-weight: 700;
}

.button-primary {
  background: var(--brand);
  color: #ffffff;
}

.results-panel {
  min-width: 0;
  margin-top: 16px;
}

.results-label {
  display: none;
  margin: 0 0 14px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 500;
}

.results-label.is-visible { display: block; }

.has-flight-results .flight-hero {
  display: none;
}

.has-flight-results .search-panel {
  margin-top: 0;
}

.app-footer {
  display: flex;
  width: min(1040px, calc(100% - 32px));
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-inline: auto;
  padding: 14px 0 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
}

.app-footer p { margin: 0; }

/* Offline and 404 */
.offline-page {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 20px;
  background: var(--background);
}

.offline-card {
  width: min(460px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.offline-card img {
  width: 112px;
  margin: 0 auto 24px;
}

.offline-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  font-weight: 400;
}

.offline-card p {
  margin: 14px 0 24px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 1600px) {
  .search-layout,
  .app-footer { width: min(1120px, calc(100% - 64px)); }
  .search-main { padding-top: 18px; }
}

@media (max-width: 700px) {
  .app-header-inner { width: calc(100% - 16px); min-height: 64px; }
  .app-header-start { gap: 8px; }
  .app-brand { width: 88px; height: 62px; }
  .app-brand img { width: 84px; height: 58px; }
  .nav-chip { min-height: 42px; padding: 7px 12px; }
  .search-main { padding: 8px 8px 32px; }
  .flight-hero { aspect-ratio: 16 / 7; border-radius: 14px; }
  .flight-hero h1 { bottom: 10px; font-size: 1.9rem; }
  .search-panel { padding: 0; border-radius: 0; }
  .search-panel { margin-top: 12px; }
  .results-panel { margin-top: 18px; }
  .app-footer { width: calc(100% - 24px); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .app-header-inner { width: calc(100% - 12px); }
  .app-brand { width: 80px; }
  .app-brand img { width: 78px; height: 56px; }
  .nav-chip { width: 44px; justify-content: center; padding-inline: 0; }
  .nav-chip span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .search-main { padding-inline: 6px; }
  .search-panel { padding: 0; border-radius: 0; }
}
