/* ============================================================================
   AUTH PAGES - Shared styles for login, register, and success pages
   Matches the main site theme (auto = light/dark via prefers-color-scheme)
   ============================================================================ */

/* Default: Light theme (matches light.css) */
:root {
  --auth-bg: #eee;
  --auth-card: #fff;
  --auth-text: #333;
  --auth-text-light: #666;
  --auth-text-muted: #999;
  --auth-border: #ddd;
  --auth-input-bg: #fff;
  --auth-input-border: #ccc;
  --auth-accent: #d43f57;
  --auth-accent-hover: #b8344a;
  --auth-error-bg: #fee;
  --auth-error-text: #c33;
  --auth-success-bg: #efe;
  --auth-success-text: #3a3;
  --auth-shadow: rgba(0, 0, 0, 0.08);
  --auth-oauth-hover: #f5f5f5;
  --auth-github-bg: #24292e;
  --auth-twitter-bg: #000;
  --auth-spinner-track: #eee;
}

/* Dark theme (explicit — matches dark.css) */
body.auth-dark {
  --auth-bg: #1a1a1a;
  --auth-card: #2b2b2b;
  --auth-text: #e0e0e0;
  --auth-text-light: #a0a0a0;
  --auth-text-muted: #777;
  --auth-border: #4a4a4a;
  --auth-input-bg: #333;
  --auth-input-border: #555;
  --auth-accent: #ff6b7f;
  --auth-accent-hover: #ff8a9a;
  --auth-error-bg: #3a1c1c;
  --auth-error-text: #f88;
  --auth-success-bg: #1c3a1c;
  --auth-success-text: #8f8;
  --auth-shadow: rgba(0, 0, 0, 0.3);
  --auth-oauth-hover: #383838;
  --auth-github-bg: #333;
  --auth-twitter-bg: #222;
  --auth-spinner-track: #444;
}

/* Auto: follow browser preference */
@media (prefers-color-scheme: dark) {
  body:not(.auth-light) {
    --auth-bg: #1a1a1a;
    --auth-card: #2b2b2b;
    --auth-text: #e0e0e0;
    --auth-text-light: #a0a0a0;
    --auth-text-muted: #777;
    --auth-border: #4a4a4a;
    --auth-input-bg: #333;
    --auth-input-border: #555;
    --auth-accent: #ff6b7f;
    --auth-accent-hover: #ff8a9a;
    --auth-error-bg: #3a1c1c;
    --auth-error-text: #f88;
    --auth-success-bg: #1c3a1c;
    --auth-success-text: #8f8;
    --auth-shadow: rgba(0, 0, 0, 0.3);
    --auth-oauth-hover: #383838;
    --auth-github-bg: #333;
    --auth-twitter-bg: #222;
    --auth-spinner-track: #444;
  }
}

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

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--auth-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 0;
  color: var(--auth-text);
}

/* ============================================================================
   CARD
   ============================================================================ */
.container,
.message {
  background: var(--auth-card);
  border-radius: 8px;
  box-shadow: 0 4px 20px var(--auth-shadow);
  max-width: 400px;
  width: 100%;
  padding: 40px;
}

.message {
  text-align: center;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */
h1 {
  text-align: center;
  color: var(--auth-text);
  margin-bottom: 8px;
  font-size: 1.6em;
  font-weight: 700;
}

.subtitle {
  text-align: center;
  color: var(--auth-text-light);
  margin-bottom: 30px;
  font-size: 0.9em;
}

.message h1 {
  color: var(--auth-accent);
  margin: 0 0 10px 0;
}

.message p {
  color: var(--auth-text-light);
  margin: 0;
}

/* ============================================================================
   FORM
   ============================================================================ */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--auth-text);
  font-weight: 600;
  font-size: 0.85em;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--auth-input-border);
  border-radius: 4px;
  font-size: 0.95em;
  font-family: inherit;
  transition: border-color 0.2s;
  background: var(--auth-input-bg);
  color: var(--auth-text);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--auth-accent);
}

button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: var(--auth-accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button[type="submit"]:hover {
  background: var(--auth-accent-hover);
}

button[type="submit"]:active {
  transform: translateY(1px);
}

/* ============================================================================
   MESSAGES
   ============================================================================ */
.error {
  background: var(--auth-error-bg);
  color: var(--auth-error-text);
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 0.9em;
}

.success {
  background: var(--auth-success-bg);
  color: var(--auth-success-text);
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 0.9em;
}

.note {
  font-size: 0.8em;
  color: var(--auth-text-muted);
  margin-top: 5px;
}

/* ============================================================================
   LINKS
   ============================================================================ */
.forgot-link {
  text-align: right;
  margin-top: 8px;
  margin-bottom: -8px;
  font-size: 0.85em;
}

.forgot-link a {
  color: var(--auth-text-muted);
  text-decoration: none;
}

.forgot-link a:hover {
  color: var(--auth-accent);
  text-decoration: underline;
}

.register-link,
.login-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9em;
  color: var(--auth-text-light);
}

.register-link a,
.login-link a {
  color: var(--auth-accent);
  text-decoration: none;
  font-weight: 600;
}

.register-link a:hover,
.login-link a:hover {
  text-decoration: underline;
}

/* ============================================================================
   DIVIDER
   ============================================================================ */
.divider {
  text-align: center;
  margin: 24px 0;
  color: var(--auth-text-muted);
  font-size: 0.85em;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--auth-border);
}

.divider::before { left: 0; }
.divider::after { right: 0; }

/* ============================================================================
   OAUTH BUTTONS
   ============================================================================ */
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oauth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--auth-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--auth-text);
  font-weight: 500;
  font-size: 0.9em;
  transition: background 0.2s;
}

.oauth-button:hover {
  background: var(--auth-oauth-hover);
}

.oauth-button.google {
  background: var(--auth-card);
}

.oauth-button.github {
  background: var(--auth-github-bg);
  color: white;
  border-color: var(--auth-github-bg);
}

.oauth-button.twitter {
  background: var(--auth-twitter-bg);
  color: white;
  border-color: var(--auth-twitter-bg);
}

/* ============================================================================
   SPINNER (success page)
   ============================================================================ */
.spinner {
  border: 3px solid var(--auth-spinner-track);
  border-top: 3px solid var(--auth-accent);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
  margin: 20px auto 0;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============================================================================
   LANGUAGE SWITCH (auth pages)
   ============================================================================ */
.lang-switch {
  text-align: center;
  margin-top: 20px;
}

.lang-switch select {
  padding: 6px 12px;
  border: 1px solid var(--auth-border);
  border-radius: 4px;
  background: var(--auth-card);
  color: var(--auth-text-light);
  font-size: 0.85em;
  font-family: inherit;
  cursor: pointer;
}

.lang-switch select:focus {
  outline: none;
  border-color: var(--auth-accent);
}
