/* ============================================================
   TCHIN TCHIN — Auth Page Styles
   Styles specific to standalone auth pages (login, register,
   password reset, OTP verification).
   These pages have a distinct visual style from the in-app pages
   (gradient buttons, glass morphism nav, two-panel layout).
   Loaded via base_auth.html.
   ============================================================ */


/* ===================== RESET & BASE ===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
}

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

html, body {
  height: 100%;
  background-color: var(--color-cream);
  color: var(--color-anthracite);
  margin: 0;
}


/* ===================== GLASS NAVIGATION ===================== */
.glass-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 1rem 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
}

.glass-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.glass-nav-logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-orange);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.glass-nav-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.glass-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.glass-nav-link {
  color: var(--color-orange);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
}


/* ===================== TWO-PANEL LAYOUT ===================== */
.auth-main {
  display: flex;
  height: calc(100vh - 70px);
  margin-top: 70px;
  overflow: hidden;
}

.auth-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  overflow-y: auto;
}

.auth-form-inner {
  max-width: 440px;
  width: 100%;
}

.auth-image-panel {
  flex: 1;
  display: none;
  position: relative;
  overflow: hidden;
}

.auth-image-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ===================== QUOTE CARD (image panel overlay) ===================== */
.auth-quote-overlay {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  right: 2rem;
}

.quote-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  color: white;
}

html[data-theme="dark"] .quote-card {
  background: rgba(42, 42, 46, 0.85);
  border: 1px solid rgba(160, 160, 160, 0.3);
}

.quote-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  font-style: italic;
  line-height: 1.5;
  margin: 0;
  color: white;
}

html[data-theme="dark"] .quote-text {
  color: #EAEAEA;
}

.quote-author {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
}

html[data-theme="dark"] .quote-author {
  color: rgba(234, 234, 234, 0.7);
}


/* ===================== AUTH BUTTONS ===================== */
.auth-btn-primary {
  background: linear-gradient(135deg, var(--color-orange), #ff8a4d);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.875rem 2rem;
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 107, 44, 0.3);
  width: 100%;
  text-align: center;
  display: inline-block;
  text-decoration: none;
}

.auth-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 44, 0.4);
}

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

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


/* ===================== AUTH INPUTS ===================== */
.auth-input {
  background-color: var(--color-cream);
  border: 2px solid var(--color-light-gray);
  border-radius: 12px;
  padding: 0.875rem;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--color-anthracite);
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.auth-input:focus {
  outline: none;
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.1);
}

.auth-input::placeholder {
  color: var(--color-warm-gray);
}

/* Dark mode input overrides */
html[data-theme="dark"] .auth-input {
  background-color: var(--white);
  border-color: var(--border);
  color: var(--text-primary);
}

html[data-theme="dark"] .auth-input::placeholder {
  color: var(--text-hint);
}

html[data-theme="dark"] .auth-input:-webkit-autofill,
html[data-theme="dark"] .auth-input:-webkit-autofill:hover,
html[data-theme="dark"] .auth-input:-webkit-autofill:focus,
html[data-theme="dark"] .auth-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--white, #2A2A2E) inset !important;
  -webkit-text-fill-color: var(--text-primary, #F0F0F0) !important;
  box-shadow: 0 0 0 30px var(--white, #2A2A2E) inset !important;
  border-color: var(--border, #4A4A50) !important;
  transition: background-color 5000s ease-in-out 0s;
}


/* ===================== PILL TABS (email/phone toggle) ===================== */
.pill-tab {
  background-color: var(--color-light-gray);
  border: 2px solid transparent;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  text-align: center;
}

.pill-tab.active {
  background: linear-gradient(135deg, var(--color-orange), #ff8a4d);
  color: white;
  border-color: var(--color-orange);
}

.pill-tab:not(.active):hover {
  border-color: var(--color-orange);
  color: var(--color-orange);
}

html[data-theme="dark"] .pill-tab {
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: transparent;
}

html[data-theme="dark"] .pill-tab.active {
  background: linear-gradient(135deg, var(--color-orange), #ff8a4d);
  color: #FFFFFF;
}


/* ===================== PHONE INPUT GROUP ===================== */
.phone-country-code {
  flex: 0 0 180px;
  border-radius: 12px 0 0 12px;
  border-right: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23FF6B2C' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

html[data-theme="dark"] .phone-country-code {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23FF8347' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.phone-input-joined {
  border-radius: 0 12px 12px 0;
  flex: 1;
}


/* ===================== PASSWORD TOGGLE ===================== */
.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--color-warm-gray);
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}

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


/* ===================== PASSWORD STRENGTH BAR ===================== */
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--color-light-gray);
  margin-top: 8px;
  overflow: hidden;
}

.strength-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0;
}

.strength-bar-fill.weak {
  width: 33%;
  background: var(--color-error, #e74c3c);
}

.strength-bar-fill.medium {
  width: 66%;
  background: var(--color-warning, #f39c12);
}

.strength-bar-fill.strong {
  width: 100%;
  background: var(--color-success, #27ae60);
}

.password-strength-text {
  font-size: 0.8rem;
  margin-top: 4px;
}

.password-strength-text.weak {
  color: var(--color-error, #e74c3c);
}

.password-strength-text.medium {
  color: var(--color-warning, #f39c12);
}

.password-strength-text.strong {
  color: var(--color-success, #27ae60);
}


/* ===================== ERROR / SUCCESS MESSAGES ===================== */
.auth-error {
  color: var(--color-error);
  font-size: 0.85rem;
  margin-top: 4px;
  display: none;
}

.auth-error.visible {
  display: block;
}

.auth-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-anthracite);
}


/* ===================== SUCCESS / ERROR CARDS ===================== */
.success-card {
  background: var(--color-cream);
  border: 1px solid var(--color-success);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

html[data-theme="dark"] .success-card {
  background: var(--cream);
}

html[data-theme="dark"] .success-card h2 {
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .success-card p {
  color: var(--text-secondary) !important;
}

.error-card {
  background: var(--color-cream);
  border: 1px solid var(--color-error);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

html[data-theme="dark"] .error-card {
  background: var(--cream);
}

html[data-theme="dark"] .error-card h2 {
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .error-card p {
  color: var(--text-secondary) !important;
}

.success-icon-bg {
  width: 64px;
  height: 64px;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

html[data-theme="dark"] .success-icon-bg {
  background: #1e5e3e !important;
}

.error-icon-bg {
  width: 64px;
  height: 64px;
  background: #fee2e2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

html[data-theme="dark"] .error-icon-bg {
  background: #5e1e1e !important;
}


/* ===================== AUTH DIVIDER ===================== */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-light-gray);
}

.auth-divider span {
  color: var(--color-warm-gray);
  font-size: 0.85rem;
}


/* ===================== OTP DIGITS ===================== */
.otp-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.otp-hidden-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 1.5rem;
  z-index: 2;
  cursor: pointer;
}

.otp-digit {
  width: 48px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-serif);
  border: 2px solid #d0d0d0;
  border-radius: 12px;
  background: var(--color-cream);
  color: var(--color-anthracite);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* In verify_otp.html, .otp-digit are display <div>s (not inputs).
   Clicks should pass through them to the hidden <input> underneath.
   Scoped to .otp-wrapper to avoid breaking register.html where
   .otp-digit are actual <input> elements. */
.otp-wrapper .otp-digit {
  pointer-events: none;
  user-select: none;
}

html[data-theme="dark"] .otp-digit {
  background: var(--white);
  border-color: var(--border);
  color: var(--text-primary);
}

/* For register.html where .otp-digit are <input> elements:
   provide a visible focus ring so users know which box is active. */
input.otp-digit:focus {
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.15);
  outline: none;
}

/* For verify_otp.html where .otp-digit are <div> display boxes:
   .filled and .active classes are toggled by JS (syncDigits). */
.otp-digit.filled {
  border-color: var(--color-orange);
}

.otp-digit.active {
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.15);
}

.otp-digit .cursor-blink {
  width: 2px;
  height: 24px;
  background: var(--color-orange);
  animation: blink 1s step-end infinite;
}

.resend-link {
  color: var(--color-orange);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

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

.resend-link.disabled {
  color: var(--color-warm-gray);
  cursor: not-allowed;
}

.resend-link.disabled:hover {
  text-decoration: none;
}


/* ===================== SUCCESS OVERLAY (OTP) ===================== */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 50;
}

html[data-theme="dark"] .success-overlay {
  background: rgba(26, 26, 30, 0.95);
}

html[data-theme="dark"] .success-overlay h2 {
  color: var(--text-primary);
}

html[data-theme="dark"] .success-overlay p {
  color: var(--text-secondary);
}

.success-overlay.show {
  display: flex;
}


/* ===================== ANIMATIONS ===================== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes checkmark {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes gentle-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}


/* ===================== LOGIN MOBILE HERO ===================== */
.login-mobile-hero {
  display: none;
}

.login-hero-emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: gentle-bounce 2s ease-in-out infinite;
}

.login-hero-tagline {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--color-orange);
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.3px;
}


/* ===================== PAGE WRAPPER (iOS overflow fix) ===================== */
.page-wrapper {
  width: 100%;
  overflow-x: hidden;
  position: relative;
}


/* ===================== RESPONSIVE — MOBILE ===================== */
@media (max-width: 700px) {
  html {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100%;
  }

  body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100%;
    max-width: 100vw !important;
    width: 100vw !important;
    display: block !important;
    position: relative;
  }

  .page-wrapper {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .glass-nav {
    padding: 0.75rem 1rem !important;
  }

  .glass-nav-logo {
    font-size: 1.25rem !important;
  }

  .glass-nav-logo img {
    width: 24px !important;
    height: 24px !important;
  }

  .auth-main {
    display: block !important;
    padding-top: 60px !important;
    overflow: visible !important;
    height: auto;
    margin-top: 0;
  }

  .auth-form-panel {
    padding: 1.5rem 1.25rem 2rem !important;
    align-items: flex-start !important;
    overflow: visible !important;
    min-height: calc(100vh - 60px);
  }

  .auth-form-inner {
    max-width: 100% !important;
  }

  .auth-form-inner h1 {
    font-size: 1.6rem !important;
    text-align: center;
  }

  .auth-form-inner h1 + p {
    text-align: center;
  }

  .auth-image-panel {
    display: none !important;
  }

  .pill-tab {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
  }

  .auth-input {
    padding: 0.8rem;
    font-size: 0.95rem;
    border-radius: 10px;
  }

  .phone-country-code {
    flex: 0 0 140px !important;
    font-size: 0.9rem;
  }

  .auth-btn-primary {
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
  }

  .auth-divider {
    margin: 1.25rem 0;
  }

  .login-mobile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem 0 0.5rem;
  }
}

/* Small phones */
@media (max-width: 380px) {
  .auth-form-panel {
    padding: 1.25rem 1rem 2rem !important;
  }

  .auth-form-inner h1 {
    font-size: 1.5rem !important;
  }

  .phone-country-code {
    flex: 0 0 120px !important;
    font-size: 0.85rem;
    padding-right: 24px;
  }
}
