/* ==========================================================================
   Availio — Global design tokens & shared layout
   Brand: Navy #1A2D4E · Orange #ED9A2A · Light #F8F9FB
   ========================================================================== */

:root {
  /* Brand */
  --color-navy: #1a2d4e;
  --color-navy-soft: #243a5c;
  --color-navy-deep: #122038;
  --color-navy-muted: #4a5d7a;
  --color-orange: #ed9a2a;
  --color-orange-hover: #d8891f;
  --color-orange-soft: rgba(237, 154, 42, 0.14);
  --color-sky: #3d6b9e;
  --color-mint: #2a9d8f;

  --color-white: #ffffff;
  --color-bg: #f3f6fb;
  --color-bg-warm: #faf6f0;
  --color-border: #dce3ef;
  --color-text: #1a2d4e;
  --color-text-muted: #5a6b85;
  --color-danger: #c0392b;
  --color-success: #1e7a46;

  /* Typography — Outfit (EN) · Cairo/Tajawal (AR). Avoids generic Inter. */
  --font-en: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-ar: "Cairo", "Tajawal", system-ui, sans-serif;
  --font: var(--font-en);

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  --leading-tight: 1.2;
  --leading-normal: 1.6;

  /* Layout */
  --container: 1120px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(26, 45, 78, 0.05);
  --shadow: 0 10px 30px rgba(26, 45, 78, 0.1);
  --shadow-btn: 0 6px 16px rgba(237, 154, 42, 0.28);
  --nav-height: 92px;
  --transition: 0.2s ease;
}

html[lang="ar"] {
  --font: var(--font-ar);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(ellipse 90% 50% at 0% -10%, rgba(237, 154, 42, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(61, 107, 158, 0.14), transparent 50%),
    linear-gradient(180deg, #eef3fa 0%, var(--color-bg) 28%, #f7f9fc 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Brand marks must keep fixed height (global img height:auto would shrink them) */
.nav-brand img,
.dash-brand img,
.store-brand img,
.footer-brand img,
.auth-card .nav-brand img {
  height: auto;
  max-width: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-navy);
}

p {
  margin: 0;
  color: var(--color-text-muted);
}

button,
input,
textarea,
select {
  font: inherit;
}

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.45rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
    border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  text-align: center;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #f0a83a 0%, var(--color-orange) 55%, #e08a1c 100%);
  color: var(--color-white);
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f2b14a 0%, var(--color-orange-hover) 60%, #c97a16 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(237, 154, 42, 0.35);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-navy);
  border-color: rgba(26, 45, 78, 0.16);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-navy);
  background: #fff;
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--color-navy);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(26, 45, 78, 0.06);
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #25d366;
  color: #fff;
  border: 1px solid #1ebe57;
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.28);
}

.btn-whatsapp:hover:not(:disabled) {
  background: #1ebe57;
  color: #fff;
  transform: translateY(-1px);
}

.btn-whatsapp--nav {
  min-height: 2.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
}

.btn-whatsapp--nav svg {
  flex-shrink: 0;
}

.whatsapp-fab {
  position: fixed;
  z-index: 220;
  inset-inline-end: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3.25rem;
  padding: 0.65rem 1rem 0.65rem 0.85rem;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(37, 211, 102, 0.4);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.whatsapp-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(37, 211, 102, 0.45);
  color: #fff;
}

.whatsapp-fab svg {
  width: 1.45rem;
  height: 1.45rem;
  flex-shrink: 0;
}

body.has-site-tabbar .whatsapp-fab {
  bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

html[dir="rtl"] .whatsapp-fab {
  inset-inline-end: auto;
  inset-inline-start: 1rem;
}

@media (max-width: 899px) {
  .btn-whatsapp--nav .btn-whatsapp-label {
    display: none;
  }

  .btn-whatsapp--nav {
    width: 2.35rem;
    height: 2.35rem;
    min-width: 2.35rem;
    padding: 0;
  }

  .whatsapp-fab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .whatsapp-fab {
    width: 3.35rem;
    height: 3.35rem;
    min-height: 3.35rem;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}

.btn-block {
  width: 100%;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Navbar (marketing + auth)
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(220, 227, 239, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  gap: 1rem;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-brand img {
  height: 72px !important;
  width: auto !important;
  max-width: 360px !important;
  object-fit: contain;
}

@media (max-width: 600px) {
  :root {
    --nav-height: 80px;
  }

  .nav-brand img {
    height: 52px !important;
    width: auto !important;
    max-width: 230px !important;
  }
}

@media (max-width: 899px) {
  :root {
    --nav-height: 56px;
  }

  .nav {
    gap: 0.5rem;
  }

  .nav-brand {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .nav-brand img {
    height: 34px !important;
    width: auto !important;
    max-width: min(150px, 40vw) !important;
  }

  .nav-actions {
    gap: 0.35rem;
    flex: 0 0 auto;
    max-width: 58%;
    justify-content: flex-end;
  }

  .nav-actions .lang-toggle {
    min-width: 4.1rem;
    height: 2.2rem;
  }

  .nav-actions .btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.75rem;
    min-height: 2.2rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
  }

  .nav-actions .btn-ghost,
  .nav-actions .btn-primary {
    border-radius: 999px;
  }
}

.nav-links {
  display: none;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-navy-muted);
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-navy);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.lang-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 0;
  min-width: 4.75rem;
  height: 2.35rem;
  padding: 0.15rem;
  border: 1px solid rgba(26, 45, 78, 0.14);
  border-radius: 999px;
  background: rgba(26, 45, 78, 0.06);
  color: var(--color-navy);
  cursor: pointer;
  box-shadow: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.lang-toggle:hover {
  border-color: rgba(237, 154, 42, 0.55);
  transform: none;
}

.lang-toggle:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 2px;
}

.lang-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.lang-opt.is-active {
  background: var(--color-navy);
  color: #fff;
  box-shadow: 0 1px 4px rgba(26, 45, 78, 0.22);
}

html[dir="rtl"] .lang-opt[data-lang-opt="ar"].is-active,
html[lang="ar"] .lang-opt[data-lang-opt="ar"].is-active {
  font-family: var(--font-ar);
  letter-spacing: 0;
  font-size: 0.78rem;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-navy);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 2px;
  background: currentColor;
}

.nav-toggle span::before {
  top: -6px;
}

.nav-toggle span::after {
  top: 6px;
}

.nav-mobile {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0 1.25rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-white);
}

.nav-mobile.is-open {
  display: flex;
}

body.nav-open {
  overflow: hidden;
}

.nav-mobile a {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-navy);
  padding: 0.5rem 0;
}

@media (min-width: 900px) {
  .nav-links {
    display: flex;
  }

  .nav-toggle {
    display: none;
  }

  .nav-mobile {
    display: none !important;
  }

  .nav-actions .btn-primary {
    display: inline-flex;
  }
}

@media (max-width: 899px) {
  .nav-actions .btn-primary {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Phone app bottom tab bar (marketing site)
   -------------------------------------------------------------------------- */

.site-tabbar {
  display: none;
}

@media (max-width: 899px) {
  body.has-site-tabbar {
    padding-bottom: calc(4.15rem + env(safe-area-inset-bottom, 0px));
  }

  body.has-site-tabbar .site-footer {
    padding-bottom: 1.25rem;
  }

  body.has-site-tabbar .nav-toggle,
  body.has-site-tabbar .nav-mobile {
    display: none !important;
  }

  .site-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(26, 45, 78, 0.08);
    padding: 0.28rem 0.15rem calc(0.28rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 28px rgba(26, 45, 78, 0.07);
  }

  .site-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-height: 3.2rem;
    padding: 0.15rem 0.1rem;
    border: 0;
    background: transparent;
    color: var(--color-text-muted);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.58rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    border-radius: 0.7rem;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, transform 0.15s ease;
  }

  .site-tab:active {
    transform: scale(0.96);
  }

  .site-tab-icon {
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.65rem;
    color: inherit;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .site-tab-icon svg {
    display: block;
  }

  .site-tab-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.1rem;
  }

  .site-tab[aria-current="page"] {
    color: var(--color-navy);
  }

  .site-tab[aria-current="page"] .site-tab-icon {
    color: var(--color-orange);
    background: rgba(237, 154, 42, 0.14);
  }

  html[dir="rtl"] .site-tab-label {
    font-family: var(--font-ar);
    font-size: 0.55rem;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  background: var(--color-navy);
  color: rgba(255, 255, 255, 0.85);
  padding: 3rem 0 1.5rem;
  margin-top: auto;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.85);
}

.site-footer a:hover {
  color: var(--color-orange);
}

.footer-grid {
  display: grid;
  gap: 2rem;
}

.footer-brand img {
  height: 52px !important;
  width: auto !important;
  max-width: 240px !important;
  object-fit: contain;
  background: var(--color-white);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.footer-brand p {
  margin-top: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-sm);
  max-width: 28ch;
}

.footer-col h3 {
  color: var(--color-white);
  font-size: var(--text-sm);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-col ul {
  display: grid;
  gap: 0.5rem;
}

.footer-col a {
  font-size: var(--text-sm);
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.footer-social a:hover {
  border-color: var(--color-orange);
  color: var(--color-orange);
}

.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

@media (min-width: 700px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
  }
}

/* --------------------------------------------------------------------------
   Forms (shared)
   -------------------------------------------------------------------------- */

.form-group {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-navy);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-navy);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px var(--color-orange-soft);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.form-error,
.form-success {
  font-size: var(--text-sm);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.form-error {
  background: rgba(192, 57, 43, 0.08);
  color: var(--color-danger);
}

.form-success {
  background: rgba(30, 122, 70, 0.08);
  color: var(--color-success);
}

/* --------------------------------------------------------------------------
   Page shell (marketing)
   -------------------------------------------------------------------------- */

.page-main {
  min-height: calc(100dvh - var(--nav-height) - env(safe-area-inset-top, 0px));
}

.page-hero {
  padding: 3.5rem 0 2.5rem;
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-white) 100%);
}

.page-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 0.75rem;
}

.page-hero p {
  max-width: 52ch;
  font-size: var(--text-lg);
}

.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--color-bg);
}

.section-header {
  max-width: 40rem;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   Auth pages
   -------------------------------------------------------------------------- */

.auth-page {
  min-height: calc(100dvh - var(--nav-height) - env(safe-area-inset-top, 0px));
  display: grid;
  place-items: center;
  padding: 2rem 0 3rem;
  background:
    radial-gradient(ellipse 50% 40% at 20% 20%, rgba(237, 154, 42, 0.14), transparent 60%),
    radial-gradient(ellipse 45% 35% at 90% 80%, rgba(61, 107, 158, 0.16), transparent 55%),
    linear-gradient(180deg, #e9eef7 0%, var(--color-bg) 100%);
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  padding: 0.35rem 0.15rem;
  color: var(--color-navy);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 2.4rem;
  -webkit-tap-highlight-color: transparent;
}

.auth-back:hover {
  color: var(--color-orange);
}

.auth-back-icon {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: rgba(26, 45, 78, 0.08);
  color: inherit;
  flex-shrink: 0;
}

html[dir="rtl"] .auth-back-icon {
  transform: scaleX(-1);
}

.auth-shell {
  width: min(100%, 420px);
  padding: 0 1rem;
}

.auth-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(220, 227, 239, 0.95);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 2rem 1.6rem;
  backdrop-filter: blur(8px);
}

.auth-card h1 {
  font-size: var(--text-2xl);
  margin-bottom: 0.35rem;
}

.auth-card > p {
  margin-bottom: 1.5rem;
  font-size: var(--text-sm);
}

.auth-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.auth-footer a {
  color: var(--color-orange);
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}
