/* ==========================================================================
   THE BESTOWALS - AUTHENTICATION STYLESHEET (css/auth.css)
   Pixel-accurate reproduction of Authentication Flow reference screenshots
   ========================================================================== */

/* --- 1. Auth Page Root & Layout --- */
body.auth-page {
  background-color: var(--color-bg-body, #faf5ee);
  color: var(--color-text-dark, #1f2937);
  font-family: var(--font-sans, 'Plus Jakarta Sans', -apple-system, sans-serif);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 40px 16px;
  box-sizing: border-box;
}

.auth-card-container {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04), 0 1px 4px rgba(0, 0, 0, 0.02);
  border: 1px solid #ede5da;
  padding: 28px 24px 32px 24px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- 2. Minimal Auth Header --- */
.auth-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin-bottom: 24px;
  min-height: 44px;
}

.auth-back-btn {
  background: none;
  border: none;
  color: #111827;
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease, transform 0.1s ease;
  z-index: 2;
}

.auth-back-btn:hover {
  background-color: #f3f4f6;
}

.auth-back-btn:active {
  transform: translateX(-2px);
}

.auth-back-btn svg {
  width: 20px;
  height: 20px;
}

.auth-logo-link {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

/* --- 3. Step Transitions & Visibility --- */
.auth-step {
  display: none;
  animation: authFadeIn 0.28s ease-out forwards;
}

.auth-step.active {
  display: block;
}

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

/* --- 4. Titles & Subtitles --- */
.auth-title-group {
  text-align: center;
  margin-bottom: 24px;
}

.auth-main-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px 0;
  line-height: 1.25;
}

.auth-subtitle {
  font-size: 13.5px;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

.auth-target-phone {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin-top: 4px;
  display: block;
}

/* --- 5. Form Elements & Inputs --- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.auth-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-input-card {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.auth-input-card:focus-within {
  border-color: #214b0f;
  box-shadow: 0 0 0 3px rgba(33, 75, 15, 0.08);
}

.auth-input-card.has-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.auth-phone-prefix {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  border-right: 1px solid #e5e7eb;
}

.auth-input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: #111827;
  padding: 2px 0;
}

.auth-input::placeholder {
  color: #9ca3af;
}

.auth-field-status-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: none;
}

.auth-field-status-icon.valid {
  display: block;
  color: #15803d;
}

.auth-inline-error {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
  display: none;
}

.auth-inline-error.active {
  display: block;
}

/* --- 6. 6-Box OTP Input Grid --- */
.otp-inputs-grid {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 16px 0;
}

.otp-box-digit {
  width: 48px;
  height: 52px;
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: #111827;
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.otp-box-digit:focus {
  border-color: #214b0f;
  box-shadow: 0 0 0 3px rgba(33, 75, 15, 0.12);
  transform: translateY(-1px);
}

.otp-box-digit.filled {
  border-color: #15803d;
  background-color: #f7faf7;
}

.otp-box-digit.error {
  border-color: #ef4444;
  background-color: #fef2f2;
}

/* OTP Timer & Resend */
.otp-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  margin-bottom: 20px;
  min-height: 22px;
}

.otp-timer-label {
  color: #6b7280;
}

.otp-countdown-val {
  color: #15803d;
  font-weight: 600;
  margin-left: 3px;
}

.otp-resend-link {
  background: none;
  border: none;
  color: #15803d;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  display: none;
}

.otp-resend-link:hover {
  color: #166534;
}

/* Dev Demo OTP Helper Box */
.demo-otp-helper {
  background: #f0fdf4;
  border: 1px dashed #86efac;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: #166534;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.demo-otp-code {
  font-weight: 800;
  letter-spacing: 1px;
  background: #dcfce7;
  padding: 2px 6px;
  border-radius: 4px;
}

/* --- 7. CTA Buttons --- */
.btn-auth-primary {
  width: 100%;
  height: 48px;
  background-color: #1c3814;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s ease, transform 0.1s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-auth-primary:hover {
  background-color: #142a0e;
  transform: translateY(-1px);
}

.btn-auth-primary:active {
  transform: translateY(0);
}

.btn-auth-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* --- 8. Terms & Privacy Note --- */
.auth-terms-note {
  font-size: 11.5px;
  color: #6b7280;
  text-align: center;
  line-height: 1.45;
  margin-top: 14px;
}

.auth-terms-note a {
  color: #15803d;
  font-weight: 600;
  text-decoration: underline;
}

.auth-terms-note a:hover {
  color: #166534;
}

/* --- 9. Switch Flow Footer Link --- */
.auth-switch-prompt {
  text-align: center;
  font-size: 13px;
  color: #4b5563;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #f3f4f6;
}

.auth-switch-link {
  color: #15803d;
  font-weight: 700;
  text-decoration: none;
  margin-left: 4px;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.auth-switch-link:hover {
  color: #166534;
  text-decoration: underline;
}

/* --- 10. Security & Privacy Footer Badges --- */
.auth-security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  margin-top: 22px;
  text-align: center;
}

.auth-security-badge svg {
  width: 15px;
  height: 15px;
  color: #15803d;
  flex-shrink: 0;
}

/* --- 11. Success Screen Illustrations --- */
.success-illustration-wrap {
  text-align: center;
  margin: 16px 0 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-badge-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: #eaf5ea;
  color: #15803d;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: successPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.success-badge-circle svg {
  width: 42px;
  height: 42px;
}

.gift-badge-circle {
  background-color: #f4ede0;
  color: #214b0f;
}

.gift-badge-circle svg {
  width: 40px;
  height: 40px;
}

@keyframes successPop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- 12. Global User Header Profile Dropdown --- */
.header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
}

.header-actions .action-btn {
  flex-shrink: 0 !important;
  position: relative !important;
}

.header-actions .action-btn.user-btn.logged-in,
.action-btn.user-btn.logged-in {
  width: auto !important;
  height: auto !important;
  min-width: auto !important;
  max-width: none !important;
  border-radius: 30px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
}

.action-btn.user-btn.logged-in:hover {
  background-color: transparent !important;
}

.user-auth-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 4px 12px 4px 6px !important;
  background-color: #f4f6f3 !important;
  border: 1.5px solid #dce4d9 !important;
  border-radius: 24px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.user-auth-pill:hover {
  background-color: #e8efe5 !important;
  border-color: #214b0f !important;
  box-shadow: 0 2px 8px rgba(33, 75, 15, 0.08) !important;
}

.user-avatar-initial {
  width: 24px !important;
  height: 24px !important;
  border-radius: 50% !important;
  background-color: #1c3814 !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.user-first-name {
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: #111827 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.user-dropdown-arrow {
  width: 13px !important;
  height: 13px !important;
  color: #6b7280 !important;
  flex-shrink: 0 !important;
}

.user-profile-dropdown {
  position: absolute;
  z-index: 10000;
  width: 250px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  padding: 14px;
  box-sizing: border-box;
  animation: authFadeIn 0.2s ease-out forwards;
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
}

.dropdown-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #1c3814;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-user-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.dropdown-user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.dropdown-user-email {
  font-size: 11.5px;
  color: #6b7280;
  margin: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.dropdown-user-phone {
  font-size: 11px;
  color: #15803d;
  font-weight: 600;
}

.dropdown-divider {
  height: 1px;
  background-color: #f3f4f6;
  margin: 8px 0;
}

.dropdown-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: all 0.15s ease;
}

.dropdown-menu-item:hover {
  background-color: #f4f6f3;
  color: #1c3814;
}

.dropdown-menu-item svg {
  width: 16px;
  height: 16px;
  color: #6b7280;
}

.dropdown-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #dc2626;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.dropdown-logout-btn:hover {
  background-color: #fef2f2;
}

.dropdown-logout-btn svg {
  width: 16px;
  height: 16px;
  color: #dc2626;
}

/* --- 13. Mobile Responsive Viewport Adaptations --- */
@media (max-width: 480px) {
  .auth-wrapper {
    padding: 12px 12px 24px 12px;
  }

  .auth-card-container {
    box-shadow: none;
    border: none;
    padding: 16px 12px 24px 12px;
    background: transparent;
  }

  .otp-box-digit {
    width: 42px;
    height: 48px;
    font-size: 18px;
  }

  .auth-main-title {
    font-size: 22px;
  }
}
