/* DYNAMIC THEMING & GLOBAL VARIABLES */
:root {
  --primary-color: #d98f00;
  --primary-color-hover: #b07400;
  --primary-color-light: #fdf5e6;
  --background-color: #faf6f0;
  --card-bg-color: #ffffff;
  --text-color: #2b241e;
  --text-color-muted: #7a6f65;
  --border-color: #e6dcd2;
  --border-radius: 16px;
  --error-color: #dc2626;
  --error-bg: #fef2f2;
  --success-color: #10b981;
  --success-bg: #ecfdf5;
  --focus-ring: 0 0 0 3px rgba(217, 143, 0, 0.4);
}

/* GLOBAL RESET & BASE STYLES */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  /* Hide scrollbar everywhere but allow scroll when needed */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

html::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  height: 100dvh; /* Lock to exact visible viewport height */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0; /* No padding — card handles its own internal spacing */
  position: relative;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* No scrollbars, no dead space */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

/* Ambient gradient background — required for glassmorphism to work visually */
body::before, body::after {
  content: "";
  position: fixed; /* fixed so they stay put during scroll */
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
  transition: background-color 0.8s ease;
}

body::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(217, 143, 0, 0.55) 0%, rgba(184, 121, 0, 0.2) 70%);
  top: -15%;
  left: -15%;
}

body::after {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(184, 121, 0, 0.45) 0%, rgba(217, 143, 0, 0.15) 70%);
  bottom: -20%;
  right: -20%;
}

/* RTL Arabic Font Override */
html[lang="ar"] body {
  font-family: 'Cairo', sans-serif;
}

/* MAIN CONTAINER */
main {
  width: 100%;
  max-width: 440px;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  z-index: 1;
  /* Start invisible to prevent flash of untranslated content */
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* PORTAL CARD — Glassmorphism */
.portal-card {
  background: rgba(255, 255, 255, 0.42); /* Daha şeffaf: arka plan blob'ları görünsün */
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--border-radius);
  width: 100%;
  padding: 0;
  box-shadow:
    0 12px 40px rgba(166, 106, 0, 0.18),
    0 2px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  position: relative;
  overflow: visible;
  transition: all 0.3s ease;
  isolation: isolate;
}

/* Clip corners on header and body individually so card radius still applies */
.card-header-banner {
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  /* overflow: visible — dropdown must be able to render outside header bounds */
}

.card-body {
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  overflow: hidden;
}

/* Card Header Banner */
.card-header-banner {
  background: linear-gradient(135deg, #a66a00 0%, var(--primary-color) 100%);
  padding: 1.5rem 1.5rem 1.25rem 1.5rem; /* Extra top padding for language button space */
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  min-height: 98px; /* Taller header — language button sits at top-right */
  box-sizing: border-box;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.brand-logo-container {
  width: 56px;
  height: 56px;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center; /* Vertically center logo with text block */
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title-group {
  flex-grow: 1;
  text-align: left;
  min-width: 0;
  padding-right: 3rem; /* Clearance for language button at top-right */
  overflow: hidden;
  /* Align text block to bottom of header area */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 0.1rem;
}

/* RTL override for title group */
html[lang="ar"] .brand-title-group {
  text-align: right;
  padding-right: 0;
  padding-left: 3.2rem;
}

.brand-logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  margin: 4px 0 0 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-body {
  width: 100%;
  padding: 1.75rem 1.5rem 1.5rem 1.5rem;
}

/* Stepper Progress Indicator */
.stepper-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding: 0 0.25rem;
  width: 100%;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  flex: 1;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--text-color) 12%, transparent);
  background-color: color-mix(in srgb, var(--card-bg-color) 50%, transparent);
  color: var(--text-color-muted);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 2;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.step-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-color-muted);
  transition: all 0.3s ease;
}

.step-line {
  height: 2px;
  background-color: color-mix(in srgb, var(--text-color) 12%, transparent);
  flex-grow: 1;
  margin-bottom: 1.35rem; /* align with numbers vertical center */
  max-width: 45px;
  transition: all 0.3s ease;
}

/* Active step states */
.step-item.active .step-number {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(217, 143, 0, 0.2);
}

.step-item.active .step-label {
  color: var(--primary-color);
}

/* Completed states */
.step-item.completed .step-number {
  border-color: var(--success-color);
  background-color: var(--success-color);
  color: #ffffff;
}

.step-item.completed .step-label {
  color: var(--success-color);
}

.step-line.active {
  background-color: var(--primary-color);
}

.step-line.completed {
  background-color: var(--success-color);
}

.header-actions {
  position: absolute;
  top: 0.7rem;   /* Sağ ÜST köşe — metinle çakışmıyor */
  right: 0.85rem;
  margin-bottom: 0;
  z-index: 105;
  flex-shrink: 0;
}

/* RTL positioning for Arabic */
html[lang="ar"] .header-actions {
  right: auto;
  left: 0.85rem;
}

/* Enforce absolute aspect scaling for flag icons */
.dropdown-trigger img, .dropdown-item img {
  height: 12px !important;
  width: auto !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
}

/* Custom Language Dropdown Selector */
.custom-dropdown {
  position: relative;
  display: inline-block;
  z-index: 100;
}

.dropdown-trigger {
  background-color: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  min-height: 32px;
  outline: none;
}

.dropdown-trigger:hover, .dropdown-trigger:focus-visible {
  border-color: rgba(255, 255, 255, 0.5);
  background-color: rgba(255, 255, 255, 0.25);
}

.dropdown-arrow {
  stroke: #ffffff;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background-color: var(--card-bg-color); /* Tam opak — şeffaf olmayınca hover rengi doğru görünür */
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  min-width: 120px;
  overflow: hidden;
  display: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.custom-dropdown.open .dropdown-menu {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.dropdown-item {
  width: 100%;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  text-align: left;
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  outline: none;
}

/* RTL overrides for Arabic text alignment in dropdown */
html[lang="ar"] .dropdown-item {
  text-align: right;
}

/* Dropdown positions in Arabic RTL mode */
html[lang="ar"] .dropdown-menu {
  right: auto;
  left: 0;
}

.dropdown-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
}

.dropdown-item.active {
  background-color: var(--primary-color);
  color: #ffffff;
}

.brand-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  margin-bottom: 0.5rem;
  transition: transform 0.3s ease;
}

.brand-logo-img {
  max-height: 54px;
  max-width: 180px;
  object-fit: contain;
}

.brand-logo-svg {
  width: 48px;
  height: 48px;
  color: var(--primary-color);
  transition: color 0.3s;
}

.brand-logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.5px;
}

/* SIGNAL / CONNECTION RADAR ELEMENT */
.signal-indicator {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0.5rem auto 1.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s ease;
}

.signal-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.signal-wave {
  position: absolute;
  border: 1px solid var(--primary-color);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
  z-index: 1;
  transition: border-color 0.4s;
}

.wave-1 { width: 56px; height: 56px; }
.wave-2 { width: 72px; height: 72px; }
.wave-3 { width: 88px; height: 88px; }

/* Signal Animations */
.signal-indicator.state-1 .signal-wave {
  animation: wavePulse 3s infinite cubic-bezier(0.215, 0.610, 0.355, 1);
}
.signal-indicator.state-1 .wave-1 { animation-delay: 0s; }
.signal-indicator.state-1 .wave-2 { animation-delay: 0.9s; }
.signal-indicator.state-1 .wave-3 { animation-delay: 1.8s; }

.signal-indicator.state-2 .signal-wave {
  animation: waveRadar 1.4s infinite linear;
}
.signal-indicator.state-2 .wave-1 { animation-delay: 0s; }
.signal-indicator.state-2 .wave-2 { animation-delay: 0.45s; }
.signal-indicator.state-2 .wave-3 { animation-delay: 0.9s; }

.signal-indicator.loading .center-circle {
  animation: pulseScale 0.8s infinite alternate ease-in-out;
}
.signal-indicator.loading .signal-wave {
  animation: waveRadar 0.9s infinite linear !important;
}

.signal-indicator.state-3 .center-circle {
  background-color: var(--success-color);
  transform: scale(1.1);
}
.signal-indicator.state-3 .signal-wave {
  border-color: var(--success-color);
  animation: successExpand 1.2s forwards cubic-bezier(0.16, 1, 0.3, 1);
}
.signal-indicator.state-3 .wave-1 { animation-delay: 0s; }
.signal-indicator.state-3 .wave-2 { animation-delay: 0.15s; }
.signal-indicator.state-3 .wave-3 { animation-delay: 0.3s; }

@keyframes wavePulse {
  0% { transform: scale(0.55); opacity: 0.5; }
  50% { opacity: 0.25; }
  100% { transform: scale(1.15); opacity: 0; }
}

@keyframes waveRadar {
  0% { transform: scale(0.55); opacity: 0.7; }
  100% { transform: scale(1.25); opacity: 0; }
}

@keyframes pulseScale {
  0% { transform: scale(1); }
  100% { transform: scale(1.12); }
}

@keyframes successExpand {
  0% { transform: scale(0.55); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* STEP PANELS (SPA TRANSITION) */
.steps-container {
  position: relative;
  width: 100%;
}

.step-panel {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.step-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  position: relative; /* Drives card height dynamically */
}

/* TEXT STYLES */
.title-group {
  text-align: center;
  margin-bottom: 1.5rem;
}

.step-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  letter-spacing: -0.25px;
}

.step-subtitle {
  font-size: 0.92rem;
  color: var(--text-color-muted);
  line-height: 1.45;
}

.step-subtitle strong {
  color: var(--text-color);
}

/* FORMS & INPUTS */
.form-group {
  margin-bottom: 1.25rem;
}

.input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  text-align: start;
}

/* Phone Input Layout */
.phone-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  direction: ltr; /* Keeps layout order for international formats */
}

.country-select-static {
  height: 52px;
  padding: 0 0.75rem;
  border: 1.5px solid color-mix(in srgb, var(--text-color) 10%, transparent) !important;
  border-radius: var(--border-radius);
  background-color: color-mix(in srgb, var(--card-bg-color) 40%, transparent) !important;
  color: var(--text-color);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 90px; /* Wider to fit bigger flag + code */
  user-select: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.country-select-static img {
  height: 18px !important; /* Bigger flag */
  width: auto !important;
  object-fit: contain !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
  flex-shrink: 0;
}

.phone-input-wrapper {
  flex-grow: 1;
}

.text-input {
  width: 100%;
  height: 52px;
  padding: 0 1rem;
  border: 1.5px solid color-mix(in srgb, var(--text-color) 10%, transparent) !important;
  border-radius: var(--border-radius);
  background-color: color-mix(in srgb, var(--card-bg-color) 40%, transparent) !important;
  color: var(--text-color);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  text-align: start;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.text-input::placeholder {
  color: var(--text-color-muted);
  opacity: 0.6;
}

.country-select-static:focus-visible,
.text-input:focus-visible {
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

/* Dynamic OTP Digits layout */
.otp-digits-container {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  direction: ltr; /* OTP codes are numbers typed LTR globally */
}

.otp-digit {
  width: 46px;
  height: 52px;
  border: 1.5px solid color-mix(in srgb, var(--text-color) 10%, transparent) !important;
  border-radius: calc(var(--border-radius) * 0.7);
  background-color: color-mix(in srgb, var(--card-bg-color) 40%, transparent) !important;
  color: var(--text-color);
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s, background-color 0.2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.otp-digit:focus-visible {
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
  transform: scale(1.03);
}

/* TERMS & CONDITIONS CHECKBOX */
.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-color-muted);
  margin-bottom: 1.5rem;
  text-align: start;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 1.5px solid color-mix(in srgb, var(--text-color) 10%, transparent) !important;
  border-radius: 6px;
  background-color: color-mix(in srgb, var(--card-bg-color) 40%, transparent) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  margin-top: 2px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--primary-color) !important;
  background-color: color-mix(in srgb, var(--card-bg-color) 60%, transparent) !important;
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

.checkmark::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.checkbox-container input:checked ~ .checkmark::after {
  opacity: 1;
}

.checkbox-container input:focus-visible ~ .checkmark {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.terms-link {
  color: var(--primary-color);
  text-decoration: underline;
  font-weight: 600;
}

.terms-link:hover {
  color: var(--primary-color-hover);
}

/* BUTTONS */
.btn {
  width: 100%;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(217, 143, 0, 0.15);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-color-hover);
  box-shadow: 0 6px 16px rgba(217, 143, 0, 0.25);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.985);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-color-muted);
  border: 1.5px solid var(--border-color);
  margin-top: 0.75rem;
}

.btn-secondary:hover:not(:disabled) {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: var(--border-color);
  color: var(--text-color);
}

.btn-loading-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
  position: absolute;
}

.btn.loading {
  color: transparent !important;
}

.btn.loading .btn-loading-spinner {
  display: block;
}

/* RESEND & BACK ACTIONS */
.action-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.resend-container {
  font-size: 0.88rem;
  color: var(--text-color-muted);
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-resend {
  background: none;
  border: none;
  color: var(--primary-color);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.25rem 0.5rem;
}

.btn-resend:hover {
  color: var(--primary-color-hover);
}

.resend-countdown {
  font-weight: 500;
  color: var(--text-color-muted);
}

.btn-back-link {
  background: none;
  border: none;
  color: var(--text-color-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s;
}

.btn-back-link:hover {
  color: var(--text-color);
}

/* ERROR & SUCCESS ALERT BANNER */
.alert-banner {
  display: none; /* Managed by JS */
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  animation: alertSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  line-height: 1.45;
  text-align: start;
}

.alert-banner.error {
  display: flex;
  background-color: #fffaf0;
  color: #c2410c;
  border: 1.5px solid #ffedd5;
  border-left: 4px solid var(--primary-color);
}

.alert-banner.success {
  display: flex;
  background-color: #ecfdf5;
  color: #065f46;
  border: 1.5px solid #d1fae5;
  border-left: 4px solid var(--success-color);
}

.alert-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

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

/* FOOTER SYSTEM STATE & PARAMS */
.portal-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-color-muted);
  opacity: 0.8;
  width: 100%;
}

.meta-param-pill {
  display: inline-block;
  background-color: var(--primary-color-light);
  color: var(--primary-color);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.7rem;
  margin: 2px;
  border: 1px solid rgba(217, 143, 0, 0.1);
}

/* MODAL OVERLAYS (TERMS / KVKK) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(43, 36, 30, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 1.25rem;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background-color: color-mix(in srgb, var(--card-bg-color) 82%, transparent) !important;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: var(--border-radius);
  border: 1px solid color-mix(in srgb, var(--text-color) 12%, transparent) !important;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 30px 70px -10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  max-height: 82vh;
  transform: scale(0.96);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color);
  text-align: center;
  width: 100%;
}

.modal-close-btn {
  display: none !important;
}

.modal-close-btn:hover {
  background-color: var(--primary-color-light);
  color: var(--primary-color);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-color-muted);
  text-align: start;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
  display: flex;
  justify-content: flex-end;
}

/* RTL OVERRIDES FOR LOGICAL CSS PROPERTIES */
/* Managed by logical layout properties */

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

/* REDUCED MOTION SUPPORT */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .signal-wave, .center-circle, .btn-loading-spinner {
    animation: none !important;
  }
}

/* RESPONSIVE & MOBILE ADJUSTMENTS */
@media (max-width: 480px) {
  body {
    justify-content: center;
  }

  main {
    padding: 0 0.75rem;
  }

  .portal-card {
    border-radius: 14px;
  }

  /* Keep header layout the same as desktop (row) — just tighten sizing */
  .card-header-banner {
    padding: 0.9rem 1rem 0.9rem 1rem;
    min-height: 96px;
    gap: 0.75rem;
  }

  .brand-logo-container {
    width: 52px;
    height: 52px;
  }

  /* Title text shrinks but stays left-aligned like desktop */
  .brand-title-group {
    padding-right: 3rem; /* space for language btn */
    text-align: left;
  }

  html[lang="ar"] .brand-title-group {
    text-align: right;
    padding-right: 0;
    padding-left: 3rem;
  }

  .brand-logo-text {
    font-size: 1.2rem;
  }

  .brand-subtitle-text {
    font-size: 0.76rem;
  }

  .header-actions {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    transform: none;
  }

  html[lang="ar"] .header-actions {
    right: auto;
    left: 0.75rem;
  }

  .card-body {
    padding: 1.25rem;
  }

  .otp-digit {
    width: 40px;
    height: 48px;
    font-size: 1.25rem;
  }

  .otp-digits-container {
    gap: 0.35rem;
  }
}

/* Very narrow devices (iPhone SE, Galaxy A series ~360px) */
@media (max-width: 360px) {
  main {
    padding: 0 0.6rem;
  }

  .card-header-banner {
    padding: 1.25rem 0.75rem 0.75rem 0.75rem;
  }

  .brand-logo-container {
    width: 40px;
    height: 40px;
  }

  .brand-logo-text {
    font-size: 1rem;
  }

  .brand-subtitle-text {
    font-size: 0.64rem;
  }

  .brand-title-group {
    padding-right: 0 !important;
    padding-left: 0 !important;
  }

  .header-actions {
    top: 8px;
    right: 8px;
  }

  .card-body {
    padding: 1rem;
  }

  .otp-digit {
    width: 34px;
    height: 44px;
    font-size: 1.1rem;
  }

  .otp-digits-container {
    gap: 0.25rem;
  }
}

/* Tight height — keyboard active or landscape (allow scroll when keyboard pushes up) */
@media (max-height: 600px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    justify-content: flex-start;
  }

  main {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .card-header-banner {
    padding: 0.75rem 1.25rem;
    min-height: 58px;
  }

  .brand-logo-container {
    width: 36px;
    height: 36px;
  }

  .card-body {
    padding: 1rem 1.25rem;
  }

  .stepper-container {
    margin-bottom: 1rem;
  }
}

/* Firebase Invisible reCAPTCHA Badge floating container */
#recaptcha-container {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 99999;
}
.grecaptcha-badge {
  z-index: 99999 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15) !important;
}
