/* ============================================================
   AUTH MODAL — Sign In / Sign Up
   Palette matches main site: beige / brown / gold
   ============================================================ */

/* ── Overlay ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 13, 8, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.auth-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Card ── */
.auth-card {
  background: #FAF6F1;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  position: relative;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1),
              opacity 0.3s ease;
  opacity: 0;
  box-shadow: 0 24px 60px rgba(20, 13, 8, 0.3);
  max-height: 92vh;
  overflow-y: auto;
}

.auth-overlay.active .auth-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Close button */
.auth-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #7A6B5D;
  border-radius: 50%;
  transition: background 0.2s;
}

.auth-close:hover { background: #EDE5D8; color: #3A2D23; }

/* ── Header ── */
.auth-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.auth-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C4A265 0%, #D4B987 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  font-style: italic;
  color: white;
  font-weight: 400;
}

.auth-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.7rem;
  font-weight: 400;
  color: #3A2D23;
  margin-bottom: 0.3rem;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: #7A6B5D;
  font-weight: 300;
}

/* ── Social Buttons ── */
.auth-social {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.auth-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #D4C5B2;
  background: #FFFFFF;
  color: #3A2D23;
  letter-spacing: 0.01em;
}

.auth-social-btn:hover {
  border-color: #C4A265;
  box-shadow: 0 2px 12px rgba(196, 162, 101, 0.15);
  transform: translateY(-1px);
}

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

.auth-social-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.auth-social-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.auth-social-btn.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #D4C5B2;
  border-top-color: #C4A265;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
  margin-left: 0.5rem;
}

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

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  color: #B8A08A;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #EDE5D8;
}

/* ── Form ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-label {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5C4033;
  font-weight: 400;
}

.auth-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid #D4C5B2;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #FFFFFF;
  color: #3A2D23;
  transition: all 0.2s ease;
  outline: none;
}

.auth-input::placeholder { color: #B8A08A; }

.auth-input:focus {
  border-color: #C4A265;
  box-shadow: 0 0 0 3px rgba(196, 162, 101, 0.12);
}

.auth-input.error {
  border-color: #D97070;
  box-shadow: 0 0 0 3px rgba(217, 112, 112, 0.1);
}

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap .auth-input { padding-right: 2.8rem; }

.auth-password-toggle {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #B8A08A;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.auth-password-toggle:hover { color: #5C4033; }

.auth-field-error {
  font-size: 0.78rem;
  color: #C0504D;
  display: none;
}

.auth-field-error.show { display: block; }

/* Forgot password link */
.auth-forgot {
  font-size: 0.8rem;
  color: #C4A265;
  text-align: right;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-forgot:hover { color: #5C4033; text-decoration: underline; }

/* ── Submit Button ── */
.auth-submit-btn {
  width: 100%;
  padding: 0.9rem;
  background: #C4A265;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.25s ease;
  margin-top: 0.25rem;
  position: relative;
  overflow: hidden;
}

.auth-submit-btn:hover {
  background: #D4B987;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(196, 162, 101, 0.35);
}

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

.auth-submit-btn:disabled {
  opacity: 0.65;
  pointer-events: none;
}

.auth-submit-btn.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Switch view ── */
.auth-switch {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.875rem;
  color: #7A6B5D;
}

.auth-switch a,
.auth-switch button {
  color: #C4A265;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  transition: color 0.2s;
}

.auth-switch a:hover,
.auth-switch button:hover { color: #5C4033; text-decoration: underline; }

/* ── Global error/success banner ── */
.auth-alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
  animation: authFadeIn 0.25s ease;
}

.auth-alert.show { display: flex; align-items: center; gap: 0.6rem; }

.auth-alert.error {
  background: #FEF2F2;
  color: #C0504D;
  border: 1px solid #FECACA;
}

.auth-alert.success {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #BBF7D0;
}

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

/* ── Terms ── */
.auth-terms {
  font-size: 0.75rem;
  color: #B8A08A;
  text-align: center;
  margin-top: 1rem;
  line-height: 1.5;
}

.auth-terms a { color: #C4A265; text-decoration: underline; }

/* ── User Avatar (navbar) ── */
.auth-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  position: relative;
}

.auth-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.6);
  background: #C4A265;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: all 0.3s ease;
}

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

.auth-user-name {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #C4A265; /* Trùng màu Gold với icon Trái tim */
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.navbar.scrolled .auth-user-name { 
  color: #C4A265; /* Vẫn giữ màu Gold khi cuộn trang */
  text-shadow: none;
}

.auth-user-btn:hover .auth-avatar { 
  border-color: #C4A265;
  transform: scale(1.05);
}

.auth-user-btn:hover .auth-user-name {
  color: #D4B987; /* Sáng hơn một chút khi hover để tạo hiệu ứng */
}

/* ── Dropdown menu (user) ── */
.auth-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #FAF6F1;
  border: 1px solid #EDE5D8;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(20, 13, 8, 0.15);
  min-width: 180px;
  z-index: 2000;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: all 0.2s ease;
}

.auth-dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.auth-dropdown-header {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #EDE5D8;
}

.auth-dropdown-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: #3A2D23;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-dropdown-email {
  font-size: 0.75rem;
  color: #B8A08A;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  color: #3A2D23;
  cursor: pointer;
  transition: background 0.15s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.auth-dropdown-item:hover { background: #EDE5D8; }

.auth-dropdown-item.danger { color: #C0504D; }
.auth-dropdown-item.danger:hover { background: #FEF2F2; }

.auth-dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }

/* ── Password Strength ── */
.auth-strength {
  margin-top: 0.4rem;
  display: none;
}

.auth-strength.show { display: block; }

.auth-strength-bar {
  height: 3px;
  border-radius: 2px;
  background: #EDE5D8;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

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

.auth-strength-label {
  font-size: 0.72rem;
  color: #B8A08A;
}

.strength-weak   .auth-strength-fill { width: 33%; background: #D97070; }
.strength-medium .auth-strength-fill { width: 66%; background: #E6B84A; }
.strength-strong .auth-strength-fill { width: 100%; background: #5BAD7A; }
.strength-weak   .auth-strength-label { color: #D97070; }
.strength-medium .auth-strength-label { color: #E6B84A; }
.strength-strong .auth-strength-label { color: #5BAD7A; }

/* ── Forgot password view ── */
.auth-back-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #7A6B5D;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0;
  margin-bottom: 1.2rem;
  transition: color 0.2s;
}

.auth-back-btn:hover { color: #3A2D23; }
.auth-back-btn svg { width: 14px; height: 14px; }

/* ── Nav slot (wrapper for sign-in trigger or user avatar) ── */
.auth-nav-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* On the split nav (index.html), the slot is inside nav-utilities */
.nav-utilities .auth-nav-slot { display: contents; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .auth-card {
    padding: 1.8rem 1.4rem;
    border-radius: 12px;
  }

  .auth-title { font-size: 1.4rem; }
}
