/* AVIS design system: light, calm, Apple-style surfaces with AVIS red as the single accent */

:root {
  color-scheme: light;
  --strong: #171a20;
  --on-strong: #ffffff;
  --footer: #393c41;
  --glass: rgba(255, 255, 255, 0.92);
  --fill-hover: #e8e8ed;
  --hero-bg: linear-gradient(180deg, #ffffff 0%, #f4f4f4 62%, #e9eaec 100%);
  --red: #d7001e;
  --red-hover: #b80019;
  --red-soft: #fff0f1;
  --ink: #171a20;
  --ink-2: #393c41;
  --text: #171a20;
  --muted: #5c5e62;
  --subtle: #5c5e62;
  --line: rgba(23, 26, 32, 0.12);
  --line-strong: rgba(23, 26, 32, 0.3);
  --bg: #f4f4f4;
  --surface: #ffffff;
  --fill: #f4f4f4;
  --success: #15803d;
  --success-soft: #e8f7ee;
  --warning: #9a5b00;
  --warning-soft: #fff4dc;
  --danger: #c4161c;
  --danger-soft: #fdeceb;
  --info: #0a5bd6;
  --info-soft: #e8f0fe;
  --radius: 4px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  /* Calibri is installed with Windows and Office. Carlito is its metric-compatible open fallback. */
  --font: Calibri, Carlito, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Calibri Light', Calibri, Carlito, 'Segoe UI', system-ui, sans-serif;
  --font-ar: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --focus: 0 0 0 4px rgba(215, 0, 30, 0.22);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Dark theme follows the system setting; AVIS red stays the same. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --strong: #3a3d44;
    --footer: #0b0b0c;
    --glass: rgba(28, 28, 30, 0.86);
    --fill-hover: #3a3a3c;
    --hero-bg: linear-gradient(180deg, #1c1c1e 0%, #000000 100%);
    --ink: #f5f5f7;
    --ink-2: #d1d1d6;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --subtle: #98989d;
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.28);
    --bg: #000000;
    --surface: #1c1c1e;
    --fill: #2c2c2e;
    --success: #32d74b;
    --success-soft: rgba(50, 215, 75, 0.16);
    --warning: #ffd60a;
    --warning-soft: rgba(255, 214, 10, 0.14);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.16);
    --info: #6cb0ff;
    --info-soft: rgba(10, 132, 255, 0.18);
    --red-soft: rgba(215, 0, 30, 0.2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --focus: 0 0 0 4px rgba(255, 69, 58, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --strong: #3a3d44;
  --footer: #0b0b0c;
  --glass: rgba(28, 28, 30, 0.86);
  --fill-hover: #3a3a3c;
  --hero-bg: linear-gradient(180deg, #1c1c1e 0%, #000000 100%);
  --ink: #f5f5f7;
  --ink-2: #d1d1d6;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --subtle: #98989d;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.28);
  --bg: #000000;
  --surface: #1c1c1e;
  --fill: #2c2c2e;
  --success: #32d74b;
  --success-soft: rgba(50, 215, 75, 0.16);
  --warning: #ffd60a;
  --warning-soft: rgba(255, 214, 10, 0.14);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.16);
  --info: #6cb0ff;
  --info-soft: rgba(10, 132, 255, 0.18);
  --red-soft: rgba(215, 0, 30, 0.2);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --focus: 0 0 0 4px rgba(255, 69, 58, 0.35);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 18px; /* Calibri has a smaller x-height than the previous font, so body text is larger */
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[lang='ar'] body {
  line-height: 1.8;
  letter-spacing: 0;
}

html[lang='ar'] body,
html[lang='ar'] input,
html[lang='ar'] select,
html[lang='ar'] textarea,
html[lang='ar'] button {
  font-family: var(--font-ar);
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

/* Text fields keep their own focus ring. */
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: none;
}

[hidden] {
  display: none !important;
}

.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: 8px;
  min-height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: 4px;
  font-weight: 700; /* Calibri has no medium weight, so buttons use bold */
  font-size: 16px;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.12s var(--ease), box-shadow 0.2s var(--ease);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--red);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--red-hover);
}

.btn-dark {
  background: var(--strong);
  color: #fff;
}

.btn-dark:hover:not(:disabled) {
  background: #393c41;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--fill);
}

.btn-ghost {
  background: transparent;
  color: var(--info);
  padding: 0 10px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--fill);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #a31218;
}

.btn-sm {
  min-height: 36px;
  padding: 0 16px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---------- Form fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.field-label .optional {
  font-weight: 400;
  color: var(--subtle);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  background: var(--fill);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 17px; /* 16px+ stops iOS from zooming in on focus */
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236e6e73' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-inline-end: 40px;
}

html[dir='rtl'] .select {
  background-position: left 16px center;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted); /* at least 4.5:1 on the field colour */
}

.input:hover,
.select:hover,
.textarea:hover {
  background: var(--fill-hover);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--red);
  box-shadow: var(--focus);
}

.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field-error {
  font-size: 14px;
  font-weight: 500;
  color: var(--danger);
  min-height: 0;
}

.field-hint {
  font-size: 14px;
  color: var(--muted);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.checkbox {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
}

.checkbox input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--red);
  flex: none;
}

/* ---------- Badges / status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--fill);
  color: var(--muted);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-confirmed {
  background: var(--success-soft);
  color: var(--success);
}

.badge-rejected {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-cancelled {
  background: var(--fill);
  color: var(--muted);
}

.badge-info {
  background: var(--info-soft);
  color: var(--info);
}

/* ---------- Toasts ---------- */

.toast-stack {
  position: fixed;
  inset-inline-end: 24px;
  bottom: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  font-size: 15px;
  animation: toast-in 0.25s var(--ease);
}

.toast-success::before {
  content: '';
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  background: #30d158 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") no-repeat center / 11px;
}

.toast-error {
  background: rgba(196, 22, 28, 0.94);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.2s var(--ease);
}

.modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  padding: 32px;
  animation: pop-in 0.25s var(--ease);
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

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

/* ---------- Display type: Calibri Light for headings and key figures ---------- */
/* Calibri Light has only a regular weight, so headings use 400 instead of bold. */

h1,
h2,
h3,
.price strong,
.summary-total strong,
.mobile-bar-total strong,
.kpi-value,
#ref-code {
  font-family: var(--font-display);
  font-weight: 400;
}

html[lang='ar'] h1,
html[lang='ar'] h2,
html[lang='ar'] h3,
html[lang='ar'] .price strong,
html[lang='ar'] .summary-total strong,
html[lang='ar'] .mobile-bar-total strong,
html[lang='ar'] .kpi-value,
html[lang='ar'] #ref-code {
  font-family: var(--font-ar);
  font-weight: 600;
}
