/* === UNIFIED AUTH PAGE === */
:root {
  --primary: #D4AF37;
  --primary-dark: #B8941F;
  --accent: #FF8C42;
  --text-primary: #1A1A2E;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --white: #FFFFFF;
  --success: #25D366;
  --error: #E55A2B;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #FFF9F0 0%, #FFE8CC 30%, #FFF4E6 60%, #FFE8CC 100%);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Back button */
.back-home {
  position: fixed;
  top: 20px;
  left: 20px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
}

.back-home:hover {
  transform: translateX(-4px);
  box-shadow: var(--shadow-lg);
}

/* Main container */
.auth-container {
  background: var(--white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl), 0 0 40px rgba(212, 175, 55, 0.08);
  padding: 48px 50px;
  max-width: 750px;
  width: 100%;
  border: 2px solid rgba(212, 175, 55, 0.15);
  animation: scaleIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Logo section */
.logo-section {
  text-align: center;
  margin-bottom: 32px;
}

.logo-wrapper {
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #F4D03F, #D4AF37, #B8941F);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 15px 30px rgba(212, 175, 55, 0.35), 0 25px 60px rgba(212, 175, 55, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.logo-wrapper img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.logo-wrapper i {
  font-size: 48px;
  color: white;
}

.app-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

/* Alert messages */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  display: none;
}

.alert.alert-success {
  background: rgba(37, 211, 102, 0.1);
  color: var(--success);
  border: 1px solid rgba(37, 211, 102, 0.2);
}

.alert.alert-error {
  background: rgba(229, 90, 43, 0.1);
  color: var(--error);
  border: 1px solid rgba(229, 90, 43, 0.2);
}

.alert.alert-info {
  background: rgba(212, 175, 55, 0.1);
  color: var(--primary-dark);
  border: 1px solid rgba(212, 175, 55, 0.2);
}

/* Auth buttons container */
.auth-methods {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

/* Primary button (SMS) */
.btn-primary-auth {
  width: 100%;
  height: 56px;
  background: linear-gradient(135deg, #D4AF37, #B8941F);
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.35);
}

.btn-primary-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(212, 175, 55, 0.45);
}

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

.btn-primary-auth i {
  font-size: 20px;
}

/* Secondary buttons (Google, Email) */
.btn-secondary-auth {
  width: 100%;
  height: 56px;
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.btn-secondary-auth:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
  transform: translateY(-2px);
}

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

.btn-secondary-auth img {
  width: 22px;
  height: 22px;
}

.btn-secondary-auth i {
  font-size: 20px;
  color: var(--text-secondary);
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-light);
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gray-300), transparent);
}

.divider span {
  padding: 0 16px;
  font-weight: 500;
}

/* Footer */
.auth-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* =====================================
   SMS VERIFICATION MODAL
   ===================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-2xl);
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
}

/* Form styles */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: 14px;
  color: var(--text-secondary);
  font-size: 16px;
}

.form-input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 16px;
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.form-input:focus-visible {
  outline: 2px solid #D4AF37;
  outline-offset: 2px;
}

.form-input::placeholder {
  color: var(--gray-300);
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

/* Phone input with country selector */
.phone-input-group {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.country-select-wrapper {
  position: relative;
  flex-shrink: 0;
}

.country-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  min-height: 52px;
  padding: 0 32px 0 14px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.country-select:hover {
  border-color: var(--gray-200);
}

.country-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.country-select:focus-visible {
  outline: 2px solid #D4AF37;
  outline-offset: 2px;
}

.country-select-wrapper::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-secondary);
  pointer-events: none;
}

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

.phone-input-group .form-input {
  padding-left: 44px;
}

/* Code input */
.code-input-wrapper {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.code-digit {
  width: 50px;
  height: 60px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.code-digit:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.code-digit:focus-visible {
  outline: 2px solid #D4AF37;
  outline-offset: 2px;
}

/* Button styles for modals */
.btn-submit {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, #D4AF37, #B8941F);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
}

.btn-submit:hover {
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.35);
}

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

.btn-back {
  width: 100%;
  height: 48px;
  background: var(--gray-100);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: var(--gray-200);
}

/* Resend code */
.resend-section {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

/* =====================================
   REGISTRATION FORM (after SMS/Google verification)
   ===================================== */
.registration-form {
  display: none;
}

.registration-form.active {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.5;
}

.checkbox-label input {
  margin-top: 3px;
  cursor: pointer;
}

.checkbox-label a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

/* =====================================
   EMAIL LOGIN MODAL
   ===================================== */
.password-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.password-toggle:hover {
  color: var(--primary);
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 16px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-secondary);
}

/* =====================================
   LOADING SPINNER
   ===================================== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* =====================================
   RESPONSIVE
   ===================================== */
@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .auth-container {
    padding: 28px 20px;
  }

  .back-home {
    top: 12px;
    left: 12px;
    padding: 8px 14px;
    font-size: 13px;
  }

  .logo-wrapper {
    width: 80px;
    height: 80px;
  }

  .logo-wrapper img,
  .logo-wrapper i {
    width: 48px;
    height: 48px;
    font-size: 40px;
  }

  .app-title {
    font-size: 24px;
  }

  .btn-primary-auth,
  .btn-secondary-auth {
    height: 52px;
    font-size: 15px;
  }

  .modal {
    padding: 24px 20px;
  }

  .code-digit {
    width: 44px;
    height: 54px;
    font-size: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-input {
    font-size: 16px !important; /* Prevent iOS zoom */
  }
}
