/* Auth pages (login/signup) - scoped styles.
   IMPORTANT: everything here is scoped under .auth-container. The previous
   inline <style> blocks in the views used a universal `*` reset and global
   `body { display: flex; min-height: 100vh }` rules, which fought the site
   layout (nav bar became a flex item, page clipped on mobile) and caused
   iOS Safari to auto-zoom on the 14px inputs. */

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

.auth-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  /* Fill the viewport below the site nav; svh keeps mobile browser chrome
     (Safari toolbar) from pushing the card under the fold. */
  min-height: calc(100vh - 64px);
  min-height: calc(100svh - 64px);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: authSlideUp 0.4s ease-out;
}

@keyframes authSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-header {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  padding: 48px 32px;
  text-align: center;
  color: white;
}

.auth-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.auth-subtitle {
  font-size: 14px;
  opacity: 0.95;
  margin: 0;
}

.auth-content {
  padding: 40px 32px;
}

.auth-continuity-note {
  text-align: center;
  font-size: 13px;
  color: #555;
  margin: -12px 0 20px 0;
}

.value-proposition {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 32px;
  gap: 16px;
}

.value-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  animation: authFadeIn 0.6s ease-out;
}

@keyframes authFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.value-icon {
  font-size: 24px;
  line-height: 1;
}

.value-text {
  font-size: 12px;
  color: #666;
  font-weight: 600;
}

.auth-form-primary,
.auth-form {
  width: 100%;
}

.auth-container .btn {
  width: 100%;
  min-height: 48px; /* comfortable touch target */
  padding: 14px 16px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: none;
}

.btn-reddit {
  background: #ff4500;
  color: white;
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3);
}

.btn-reddit:hover {
  background: #e63d00;
  box-shadow: 0 6px 20px rgba(255, 69, 0, 0.4);
  transform: translateY(-2px);
}

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

.btn-primary {
  background: #667eea;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  background: #5568d3;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  transform: translateY(-2px);
}

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

.auth-container .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.divider {
  display: flex;
  align-items: center;
  margin: 32px 0;
  gap: 12px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: #eee;
}

.divider-text {
  color: #999;
  font-size: 12px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.form-label {
  display: block;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.form-link {
  font-size: 12px;
  color: #667eea;
  text-decoration: none;
  transition: color 0.2s;
}

.form-link:hover {
  color: #5568d3;
}

/* 16px minimum: iOS Safari auto-zooms the page when a focused input is
   below 16px, which was leaving mobile users stuck zoomed in after login. */
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.2s;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: rgba(102, 126, 234, 0.02);
}

.password-strength {
  margin-top: 8px;
  height: 4px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
}

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

.strength-text {
  font-size: 12px;
  color: #999;
  margin-top: 6px;
}

.error-message {
  background: #fee;
  border: 2px solid #f44336;
  color: #c62828;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  animation: authShake 0.4s ease;
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.auth-footer {
  text-align: center;
  margin: 24px 0 0 0;
  color: #666;
  font-size: 14px;
}

.auth-link {
  color: #667eea;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-link:hover {
  color: #5568d3;
}

.auth-notice-success {
  background: #d1e7dd;
  color: #0f5132;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
}

html.dark-mode .auth-notice-success {
  background: #0f3d26;
  color: #75b798;
}

/* Dark theme */
html.dark-mode .auth-card {
  background: #1e1e1e;
}

html.dark-mode .auth-content,
html.dark-mode .auth-footer {
  color: #d5d5d5;
}

html.dark-mode .auth-continuity-note {
  color: #aaa;
}

html.dark-mode .value-text {
  color: #aaa;
}

html.dark-mode .form-label {
  color: #e0e0e0;
}

html.dark-mode .form-input {
  background: #2a2a2a;
  border-color: #444;
  color: #f5f5f5;
}

html.dark-mode .form-input::placeholder {
  color: #888;
}

html.dark-mode .divider-line {
  background: #333;
}

html.dark-mode .error-message {
  background: #3d1f1f;
}

/* Mobile */
@media (max-width: 480px) {
  .auth-container {
    padding: 12px;
    align-items: flex-start; /* tall card must scroll from the top, never clip */
  }

  .auth-card {
    border-radius: 12px;
  }

  .auth-header {
    padding: 36px 24px;
  }

  .auth-title {
    font-size: 28px;
  }

  .auth-content {
    padding: 28px 20px;
  }

  .value-proposition {
    gap: 8px;
    margin-bottom: 24px;
  }

  .value-icon {
    font-size: 20px;
  }

  .value-text {
    font-size: 11px;
  }

  .divider {
    margin: 24px 0;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .auth-footer {
    margin-top: 16px;
    font-size: 13px;
  }

  .password-strength {
    margin-top: 6px;
  }

  .strength-text {
    margin-top: 4px;
  }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 1024px) {
  .auth-card {
    max-width: 450px;
  }
}

/* Desktop */
@media (min-width: 1025px) {
  .auth-card {
    max-width: 460px;
    transition: transform 0.3s ease;
  }

  .auth-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
  }

  .auth-container .btn:hover {
    transform: translateY(-3px);
  }

  .auth-container .btn:active {
    transform: translateY(-1px);
  }
}
