/* --- SHARED AUTH STYLES (login + signup) --- */

/* ============================================
   ChatGPT-inspired clean auth design
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.light-theme {
  background: #f7f7f8;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(16, 163, 127, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(200, 169, 81, 0.05) 0%, transparent 50%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.login-center-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  padding: 24px 16px;
}

.container {
  background: #fff;
  color: #0d0d0d;
  padding: 2.5em 2em 2em;
  border-radius: 16px;
  border: 1px solid #e5e5e5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  text-align: center;
  min-width: 320px;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Chat intro / header --- */
.chat-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.75em;
}

.chat-intro .avatar img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 1em;
  background: #fff;
  padding: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-intro .title {
  font-size: 1.6em;
  color: #0d0d0d;
  font-weight: 700;
  margin-bottom: 0.15em;
  letter-spacing: -0.01em;
}

.chat-intro .author {
  font-size: 0.85em;
  color: #6e6e80;
  margin-bottom: 0.15em;
  font-weight: 500;
}

.chat-intro .subtitle {
  color: #6e6e80;
  font-size: 0.95em;
  margin-bottom: 0.25em;
  text-align: center;
  max-width: 320px;
  line-height: 1.45;
}

/* --- Welcome text --- */
.welcome-text {
  color: #6e6e80;
  font-size: 0.9em;
  line-height: 1.45;
}

/* --- Form --- */
form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.form-group {
  width: 100%;
  margin-bottom: 0;
}

/* --- Input fields --- */
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  margin: 0.35em 0;
  border-radius: 10px;
  font-size: 1rem;
  background: #f4f4f4;
  color: #0d0d0d;
  outline: none;
  border: 1px solid #d9d9e3;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  font-family: inherit;
}

input:focus {
  background: #fff;
  border-color: #10a37f;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12);
}

input::placeholder {
  color: #8e8ea0;
  font-weight: 400;
}

/* --- Input group for password + toggle --- */
.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  margin: 0.35em 0;
  position: relative;
}

.input-group input {
  border-radius: 10px 0 0 10px;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.input-group input:focus {
  z-index: 1;
}

#togglePassword {
  background: #f4f4f4;
  border: 1px solid #d9d9e3;
  border-left: none;
  border-radius: 0 10px 10px 0;
  padding: 0 12px;
  cursor: pointer;
  color: #8e8ea0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#togglePassword:hover {
  background: #ececf1;
  color: #6e6e80;
}

#togglePassword .material-icons {
  font-size: 20px;
}

/* Focus state for the toggle when input is focused */
.input-group input:focus ~ #togglePassword,
.input-group:focus-within #togglePassword {
  border-color: #10a37f;
  background: #fff;
}

/* --- Submit button --- */
button[type="submit"] {
  background: #10a37f;
  color: #fff;
  border: none;
  border-radius: 10px;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  font-weight: 600;
  letter-spacing: 0;
  width: 100%;
  margin-top: 0.5em;
  box-shadow: none;
  font-family: inherit;
}

button[type="submit"]:hover {
  background: #0d8a6b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 163, 127, 0.2);
}

button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: none;
}

/* --- PWA Install button --- */
#pwaInstallBtn {
  border-radius: 10px;
  height: 48px;
  font-weight: 600;
  font-size: 1rem;
  font-family: inherit;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

#pwaInstallBtn:hover {
  transform: translateY(-1px);
}

#pwaInstallBtn:active {
  transform: translateY(0);
}

/* --- Error message --- */
.error {
  color: #ef4444;
  margin: 0.25em 0 0.5em;
  font-size: 0.9em;
  width: 100%;
  text-align: left;
  line-height: 1.4;
  border-left: 3px solid #ef4444;
  padding-left: 10px;
}

.error:empty {
  display: none;
  margin: 0;
  border: none;
  padding: 0;
}

/* --- Links --- */
a {
  color: #10a37f;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

a:hover {
  color: #0d8a6b;
  text-decoration: underline;
}

/* --- Mobile adjustments --- */
@media (max-width: 500px) {
  .login-center-wrapper {
    padding: 16px;
    padding-top: env(safe-area-inset-top, 16px);
    padding-bottom: env(safe-area-inset-bottom, 16px);
    padding-left: env(safe-area-inset-left, 16px);
    padding-right: env(safe-area-inset-right, 16px);
  }
  .container {
    width: 100%;
    max-width: 100%;
    padding: 2em 1.5em 1.5em;
    border-radius: 14px;
  }
  .chat-intro .avatar img {
    width: 68px;
    height: 68px;
  }
  .chat-intro .title {
    font-size: 1.4em;
  }
  .chat-intro .subtitle {
    max-width: 90vw;
  }
  /* Prevent iOS auto-zoom on input focus */
  input[type="email"],
  input[type="password"],
  input[type="text"] {
    font-size: 16px;
  }
  button[type="submit"] {
    font-size: 1rem;
  }
}

/* Extra-small screens */
@media (max-width: 360px) {
  .container {
    padding: 1.75em 1.25em 1.25em;
  }
}

/* ============================================================
   DARK THEME SUPPORT — auth pages
   Previously hard-coded light. Now respects body.dark-theme so users
   whose OS / app preference is dark see dark auth pages too.
   ============================================================ */
body.dark-theme {
  background: #1e1c18;
  color: #ece6d8;
}
body.dark-theme .container,
body.dark-theme .login-center-wrapper {
  background: transparent;
  color: #ece6d8;
}
body.dark-theme .chat-intro .title,
body.dark-theme .chat-intro .author,
body.dark-theme .chat-intro .subtitle,
body.dark-theme .welcome-text {
  color: #ece6d8;
}
body.dark-theme input[type="email"],
body.dark-theme input[type="password"],
body.dark-theme input[type="text"] {
  background: #2a2722;
  color: #ece6d8;
  border-color: rgba(236, 230, 216, 0.16);
}
body.dark-theme input:focus {
  background: #35322b;
  border-color: #10a37f;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.18);
}
body.dark-theme input::placeholder {
  color: rgba(236, 230, 216, 0.45);
}
body.dark-theme #togglePassword {
  background: #2a2722;
  border-color: rgba(236, 230, 216, 0.16);
  color: rgba(236, 230, 216, 0.65);
}
body.dark-theme #togglePassword:hover {
  background: #35322b;
  color: #ece6d8;
}
body.dark-theme .input-group input:focus ~ #togglePassword,
body.dark-theme .input-group:focus-within #togglePassword {
  background: #35322b;
}
body.dark-theme a {
  color: #10a37f;
}
body.dark-theme .form-error,
body.dark-theme .error-text {
  color: #ff8b8b;
}

/* Early-applied theme via inline <script> at top of body
   (set by login.html / signup.html before body renders). */
