/* ============================================================
   TOTO Iraq — Frontend Stylesheet
   ============================================================ */

/* ── Web Fonts ─────────────────────────────────────────────── */
@font-face {
  font-family: "Bahij Janna";
  src: url("../fonts/Bahij-Janna-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Bahij Janna";
  src: url("../fonts/Bahij-Janna-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/* ── English font override ─────────────────────────────────── */
[lang="en"],
[lang="en"] * {
  font-family: 'Inter', sans-serif !important;
}

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --toto-blue:        #224599;
  --toto-blue-dark:   #193574;
  --toto-blue-light:  #f0f3fa;
  --toto-blue-hover:  #1a3680;
  --toto-black:       #100F0D;
  --toto-gray-bg:     #f5f5f5;
  --toto-gray-border: #d3d2d2;
  --toto-gray-text:   #6b7280;
  --toto-error:       #b3261e;
  --toto-success:     #224599;
  --toto-white:       #ffffff;
  --toto-card-shadow: 0 24px 70px rgba(16, 15, 13, 0.1);
  --toto-radius:      2px;
  --toto-radius-sm:   2px;
  --toto-transition:  0.18s ease;

  /* Font stacks */
  --font-arabic:  "Bahij Janna", "Noto Sans Arabic", Arial, sans-serif;
  --font-english: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

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

body {
  font-family: var(--font-arabic);
  font-size: 15px;
  line-height: 1.6;
  color: var(--toto-black);
  background: var(--toto-gray-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea, button {
  font-family: inherit;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: var(--toto-white);
  border-bottom: 1px solid var(--toto-gray-border);
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-img {
  height: 38px;
  width: auto;
}

/* ── Language Switcher ─────────────────────────────────────── */
.lang-switcher {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.lang-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  border-radius: 2px;
  border: 1.5px solid var(--toto-gray-border);
  font-size: 15px;
  font-weight: 600;
  color: var(--toto-gray-text);
  background: transparent;
  transition: all var(--toto-transition);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  min-width: 56px;
  text-align: center;
}

.lang-link:hover {
  border-color: var(--toto-blue);
  color: var(--toto-blue);
  background: var(--toto-blue-light);
}

.lang-link.active {
  border-color: var(--toto-blue);
  color: var(--toto-white);
  background: var(--toto-blue);
  font-weight: 600;
}

/* ── Page Shell ────────────────────────────────────────────── */
.page-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 62px);
}

/* ── Visual Panel ──────────────────────────────────────────── */
.visual-panel {
  position: relative;
  overflow: hidden;
  min-height: 500px;
}

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

.visual-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(16, 15, 13, 0.72) 0%,
    rgba(34, 69, 153, 0.55) 60%,
    rgba(34, 69, 153, 0.35) 100%
  );
}

.visual-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: 3rem 2.5rem;
  color: var(--toto-white);
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.78;
  margin-bottom: 0.75rem;
}

.visual-headline {
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}

.visual-body {
  font-size: 17px;
  line-height: 1.75;
  opacity: 0.9;
  margin-bottom: 2rem;
  max-width: 42ch;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.875rem;
  border-radius: 2px;
  border: 1.5px solid rgba(255,255,255,0.45);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--toto-white);
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(4px);
  letter-spacing: 0.02em;
}

/* ── Form Panel ────────────────────────────────────────────── */
.form-panel {
  background: var(--toto-white);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 5%;
  overflow-y: auto;
}

/* ── Form Card (no box — fills the panel width) ────────────── */
.form-card {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  width: 100%;
  max-width: 100%;
}

.form-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--toto-black);
  margin-bottom: 2rem;
  line-height: 1.3;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--toto-blue);
}

/* ── Field ─────────────────────────────────────────────────── */
.field {
  margin-bottom: 1.25rem;
}

.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--toto-black);
  margin-bottom: 0.4rem;
}

.required {
  color: var(--toto-blue);
  margin-inline-start: 2px;
}

.field-hint {
  font-size: 12px;
  color: var(--toto-gray-text);
  margin-bottom: 0.5rem;
}

.field-input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--toto-gray-border);
  border-radius: 2px;
  font-size: 14.5px;
  color: var(--toto-black);
  background: var(--toto-white);
  transition: border-color var(--toto-transition), box-shadow var(--toto-transition);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.field-input:focus {
  border-color: var(--toto-blue);
  box-shadow: 0 0 0 3px rgba(34, 69, 153, 0.12);
}

.field-input.error {
  border-color: var(--toto-error);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.10);
}

.field-input::placeholder {
  color: #b0b7c4;
}

.field-select {
  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 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  padding-left: 2.25rem;
  cursor: pointer;
}

[dir="rtl"] .field-select {
  background-position: right 0.75rem center;
  padding-left: 0.875rem;
  padding-right: 2.25rem;
}

.field-error {
  display: block;
  font-size: 12px;
  color: var(--toto-error);
  margin-top: 0.3rem;
  min-height: 16px;
}

/* ── Phone wrapper ─────────────────────────────────────────── */
.phone-wrapper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--toto-gray-border);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color var(--toto-transition), box-shadow var(--toto-transition);
}

.phone-wrapper:focus-within {
  border-color: var(--toto-blue);
  box-shadow: 0 0 0 3px rgba(34, 69, 153, 0.12);
}

.phone-wrapper.error {
  border-color: var(--toto-error);
}

.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--toto-blue-light);
  color: var(--toto-blue);
  font-size: 14px;
  font-weight: 600;
  border-inline-end: 1.5px solid var(--toto-gray-border);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.phone-input {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  flex: 1;
}

/* ── Choice Grid (checkboxes) ──────────────────────────────── */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

/* ── Choice Stack (radios) ─────────────────────────────────── */
.choice-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Choice Card ───────────────────────────────────────────── */
.choice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 12px 16px;
  border: 1px solid var(--toto-gray-border);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  position: relative;
  user-select: none;
  background: var(--toto-white);
}

.choice-card:hover {
  border-color: var(--toto-blue);
  background: var(--toto-blue-light);
}

.choice-card:has(.choice-input:checked) {
  border-color: var(--toto-blue);
  background: var(--toto-blue-light);
  box-shadow: inset 0 0 0 1px var(--toto-blue);
}

.choice-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* ── Checkmark ─────────────────────────────────────────────── */
.checkmark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #999;
  border-radius: 1px;
  color: transparent;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  margin-inline-start: auto;
}

.choice-card:has(.choice-input:checked) .checkmark {
  color: var(--toto-white);
  background: var(--toto-blue);
  border-color: var(--toto-blue);
}

/* ── Choice Copy (text inside card) ───────────────────────── */
.choice-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.choice-copy b {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--toto-black);
  line-height: 1.3;
}

.choice-copy small {
  font-size: 11px;
  color: var(--toto-gray-text);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.choice-card:has(.choice-input:checked) .choice-copy b {
  color: var(--toto-blue);
}

/* ── Radio Mark ────────────────────────────────────────────── */
.radio-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--toto-gray-border);
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--toto-white);
  transition: all var(--toto-transition);
}

.choice-card:has(.choice-input:checked) .radio-mark {
  border-color: var(--toto-blue);
}

.choice-card:has(.choice-input:checked) .radio-mark::after {
  content: '';
  display: block;
  width: 9px;
  height: 9px;
  background: var(--toto-blue);
  border-radius: 50%;
}


/* ── Delivery Box ──────────────────────────────────────────── */
.delivery-box {
  border: 1.5px solid var(--toto-blue-light);
  border-radius: var(--toto-radius-sm);
  padding: 0.875rem 1rem;
  background: var(--toto-blue-light);
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  animation: slideDown 0.2s ease;
}

.delivery-box[hidden] {
  display: none;
}

.delivery-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--toto-blue);
  margin-bottom: 0.5rem;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Captcha ───────────────────────────────────────────────── */
.captcha-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* ── Primary Button ────────────────────────────────────────── */
.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--toto-blue);
  color: var(--toto-white);
  border: none;
  border-radius: var(--toto-radius-sm);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background var(--toto-transition), transform var(--toto-transition), box-shadow var(--toto-transition);
  margin-top: 0.25rem;
  cursor: pointer;
}

.primary-button:hover:not(:disabled) {
  background: var(--toto-blue-dark);
  box-shadow: 0 4px 14px rgba(34, 69, 153, 0.28);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.primary-button:disabled,
.primary-button.form-loading {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Loading Spinner ───────────────────────────────────────── */
/* display is intentionally NOT set here — the HTML [hidden] attribute controls
   visibility. Setting display:inline-block on .btn-spinner would override [hidden]
   and keep the spinner always visible. */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--toto-white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-spinner:not([hidden]) {
  display: inline-block;
}

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

/* ── Secondary Button ──────────────────────────────────────── */
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.5rem;
  background: transparent;
  color: var(--toto-blue);
  border: 1.5px solid var(--toto-blue);
  border-radius: var(--toto-radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--toto-transition);
  cursor: pointer;
}

.secondary-button:hover {
  background: var(--toto-blue);
  color: var(--toto-white);
}

/* ── Privacy Note ──────────────────────────────────────────── */
.privacy-note {
  font-size: 11.5px;
  color: var(--toto-gray-text);
  text-align: center;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ── Success State ─────────────────────────────────────────── */
.success-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  gap: 1rem;
  animation: fadeIn 0.4s ease;
}

.success-state[hidden] {
  display: none;
}

.success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 2px;
  background: var(--toto-blue-light);
  color: var(--toto-blue);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  border: 2px solid var(--toto-blue);
}

.success-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--toto-black);
}

.success-body {
  font-size: 14px;
  color: var(--toto-gray-text);
  max-width: 32ch;
  line-height: 1.6;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Notification bar ──────────────────────────────────────── */
.notification-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--toto-radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

.notification-bar.success {
  background: #eaf7f0;
  color: #1a6640;
  border: 1px solid #b2e4ca;
}

.notification-bar.error {
  background: #fdf3f2;
  color: var(--toto-error);
  border: 1px solid #f4c0bb;
}

.notification-bar.info {
  background: var(--toto-blue-light);
  color: var(--toto-blue);
  border: 1px solid #c2cef0;
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--toto-black);
  color: rgba(255,255,255,0.65);
  padding: 1rem 2rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: 12px;
  opacity: 0.5;
  white-space: nowrap;
}

.footer-center {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 12px;
  opacity: 0.6;
}

.footer-sep {
  opacity: 0.3;
}

.footer-logo {
  filter: brightness(0) invert(1);
  opacity: 0.7;
  height: 22px;
  width: auto;
}

/* ── Fieldset reset ────────────────────────────────────────── */
fieldset {
  border: none;
  padding: 0;
  min-width: 0;        /* prevent fieldset intrinsic size overflow */
  display: flow-root;  /* contain any internal floats */
}

legend {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 0.4rem;
  float: none;         /* never float — was causing RTL overflow */
}

/* ── Responsive — Tablet ───────────────────────────────────── */
@media (max-width: 1024px) {
  .form-panel {
    padding: 2.5rem 2.5rem;
  }
  .visual-content {
    padding: 2rem 1.75rem;
  }
  .visual-headline {
    font-size: 1.9rem;
  }
}

/* ── Responsive — Mobile ───────────────────────────────────── */
@media (max-width: 768px) {
  .site-header {
    padding: 0.625rem 1rem;
  }

  .page-shell {
    grid-template-columns: 1fr;
    min-height: unset;
  }

  .visual-panel {
    min-height: 280px;
    max-height: 350px;
  }

  .visual-content {
    padding: 1.5rem 1.25rem;
    justify-content: flex-end;
  }

  .visual-headline {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .visual-body {
    font-size: 15px;
    margin-bottom: 1.25rem;
  }

  .eyebrow {
    font-size: 11px;
  }

  .badge {
    font-size: 11.5px;
    padding: 0.275rem 0.65rem;
  }

  .form-panel {
    padding: 1.75rem 1.25rem;
  }

  .form-card {
    padding: 0;
  }

  .form-title {
    font-size: 1.15rem;
    margin-bottom: 1.125rem;
  }

  .choice-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .primary-button {
    padding: 0.8rem 1rem;
    font-size: 14px;
  }

  .site-footer {
    padding: 1rem;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .footer-center {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}

@media (max-width: 400px) {
  .choice-grid {
    grid-template-columns: 1fr;
  }
  .lang-link {
    padding: 0.275rem 0.55rem;
    font-size: 12px;
  }
}

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .site-header, .visual-panel, .site-footer, .lang-switcher { display: none; }
  .page-shell { display: block; }
  .form-panel { padding: 0; }
  .form-card  { box-shadow: none; border: 1px solid #ccc; }
}
