/* ===== Trọ Ổn — Auth Modal =====
   Modal đăng nhập / đăng ký, dùng design token từ tokens.css.
   Kích hoạt bằng class .auth-modal--open trên body.
*/

/* ---- Overlay ---- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(22, 36, 31, .6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
  padding: 24px;
}
.auth-modal--open .auth-overlay {
  opacity: 1;
  visibility: visible;
}

/* ---- Modal container ---- */
.auth-modal {
  background: var(--card, #FFFFFF);
  border-radius: var(--radius-lg, 22px);
  box-shadow: var(--shadow-lg, 0 24px 70px rgba(22,36,31,.18));
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px 32px 28px;
  position: relative;
  transform: translateY(20px) scale(.97);
  transition: transform .3s ease;
}
.auth-modal--open .auth-modal {
  transform: translateY(0) scale(1);
}

/* ---- Close button ---- */
.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line, #E4DDCC);
  border-radius: 50%;
  background: var(--card, #FFFFFF);
  color: var(--muted, #6B7768);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, color .15s;
}
.auth-close:hover {
  background: var(--primary-tint, #E4EFEE);
  color: var(--ink, #16241F);
}

/* ---- Header ---- */
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header .logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--ink, #16241F);
  margin-bottom: 8px;
}
.auth-header .logo .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent, #E8A33D);
}
.auth-header h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--ink, #16241F);
}
.auth-header p {
  font-size: 14px;
  color: var(--muted, #6B7768);
  margin: 0;
}

/* ---- Tab switcher (Đăng nhập / Đăng ký) ---- */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--line, #E4DDCC);
  border-radius: 999px;
  overflow: hidden;
}
.auth-tab {
  flex: 1;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted, #6B7768);
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: center;
}
.auth-tab:hover {
  color: var(--ink, #16241F);
}
.auth-tab.active {
  background: var(--primary, #0F5257);
  color: #FFFFFF;
}

/* ---- Form ---- */
.auth-form {
  display: block;
}
.auth-form.hidden {
  display: none;
}
.auth-form .field {
  margin-bottom: 16px;
}
.auth-form .field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft, #3E4C46);
  margin-bottom: 5px;
}
.auth-form .field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line, #E4DDCC);
  border-radius: var(--radius-sm, 8px);
  font-size: 14.5px;
  font-family: inherit;
  background: var(--bg, #FAF7F1);
  color: var(--ink, #16241F);
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.auth-form .field input:focus {
  outline: 0;
  border-color: var(--primary, #0F5257);
  box-shadow: 0 0 0 3px rgba(15, 82, 87, .12);
}
.auth-form .field input::placeholder {
  color: var(--muted, #6B7768);
  opacity: .6;
}

/* ---- Password wrapper (icon mắt) ---- */
.password-wrap {
  position: relative;
}
.password-wrap input {
  padding-right: 40px !important;
}
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--muted, #6B7768);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
}
.password-toggle:hover {
  color: var(--ink, #16241F);
}

/* ---- Submit button ---- */
.auth-submit {
  width: 100%;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent, #E8A33D);
  color: #241705;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  margin-top: 4px;
}
.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(232, 163, 61, .35);
}
.auth-submit:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---- Loading spinner on button ---- */
.auth-submit .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #241705;
  border-radius: 50%;
  animation: auth-spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ---- Divider (hoặc) ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted, #6B7768);
  font-size: 12.5px;
  font-weight: 500;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line, #E4DDCC);
}

/* ---- Social buttons ---- */
.auth-social {
  display: grid;
  gap: 10px;
}
.auth-social button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--line, #E4DDCC);
  border-radius: 999px;
  background: var(--card, #FFFFFF);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink, #16241F);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.auth-social button:hover {
  background: var(--primary-tint, #E4EFEE);
  border-color: var(--primary, #0F5257);
}
.auth-social button .social-icon {
  font-size: 18px;
}

/* ---- Footer text ---- */
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted, #6B7768);
}
.auth-footer a {
  color: var(--primary, #0F5257);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-footer a:hover {
  color: var(--primary-dark, #0A3A3D);
}

/* ---- Error / Success message ---- */
.auth-message {
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
}
.auth-message.show {
  display: block;
}
.auth-message.error {
  background: #FDEDED;
  color: var(--danger, #B23B3B);
  border: 1px solid #F5C6C6;
}
.auth-message.success {
  background: #DFF3E3;
  color: #1E7A3D;
  border: 1px solid #C3E6CB;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .auth-modal {
    padding: 28px 20px 24px;
    max-width: 100%;
    border-radius: var(--radius-md, 14px);
  }
  .auth-header h2 {
    font-size: 20px;
  }
  .auth-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  .auth-modal {
    border-radius: var(--radius-lg, 22px) var(--radius-lg, 22px) 0 0;
    max-height: 92vh;
  }
  .auth-modal--open .auth-modal {
    transform: translateY(0) scale(1);
  }
}

/* ---- Scrollbar inside modal ---- */
.auth-modal::-webkit-scrollbar {
  width: 6px;
}
.auth-modal::-webkit-scrollbar-track {
  background: transparent;
}
.auth-modal::-webkit-scrollbar-thumb {
  background: var(--line, #E4DDCC);
  border-radius: 3px;
}