/* TownConnect AI - Authentication Stylesheet (Mobile-First) */

:root {
  --tc-primary: #075E54;
  --tc-secondary: #128C7E;
  --tc-accent: #25D366;
  --tc-bg: #f0f2f5;
  --tc-card-bg: #ffffff;
  --tc-text: #111b21;
  --tc-muted: #667781;
  --tc-border: #e9edef;
  --tc-input-border: #d1d7db;
  --tc-error: #ea0038;
  --tc-error-bg: #fde8ec;
  --tc-success: #00a884;
  --tc-success-bg: #e7f8f5;
  --tc-radius: 12px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: var(--font-family);
  background-color: var(--tc-bg);
  color: var(--tc-text);
  line-height: 1.5;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  min-height: 100vh;
}

/* Top decorative header band on desktop */
.auth-bg-band {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--tc-primary) 0%, var(--tc-secondary) 100%);
  z-index: 0;
}

/* Main Card */
.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--tc-card-bg);
  border-radius: var(--tc-radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  padding: 32px 28px;
  margin: auto 0;
}

/* Header & Branding */
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(7, 94, 84, 0.2));
  transition: transform 0.2s ease;
}

.auth-logo:hover {
  transform: scale(1.05);
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--tc-primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--tc-muted);
  line-height: 1.4;
  word-break: break-word;
}

/* Alerts */
.alert-box {
  display: none;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.2s ease;
}

.alert-box.show {
  display: flex;
}

.alert-box.error {
  background-color: var(--tc-error-bg);
  color: var(--tc-error);
  border: 1px solid #f8c2cd;
}

.alert-box.success {
  background-color: var(--tc-success-bg);
  color: var(--tc-success);
  border: 1px solid #b7ede2;
}

/* Form Groups */
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--tc-text);
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--tc-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 42px;
  font-size: 15px;
  font-family: inherit;
  color: var(--tc-text);
  background-color: #fafafa;
  border: 1.5px solid var(--tc-input-border);
  border-radius: 8px;
  outline: none;
  transition: all 0.2s ease;
}

.form-input.no-icon {
  padding-left: 14px;
}

.form-input:focus {
  background-color: #ffffff;
  border-color: var(--tc-secondary);
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.15);
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--tc-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.password-toggle:hover {
  color: var(--tc-primary);
}

.field-error {
  font-size: 12px;
  color: var(--tc-error);
  margin-top: 4px;
  display: none;
}

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

/* Terms Checkbox */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 22px;
  font-size: 13px;
  color: var(--tc-muted);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--tc-primary);
  margin-top: 2px;
  cursor: pointer;
}

.checkbox-group a {
  color: var(--tc-secondary);
  text-decoration: none;
  font-weight: 500;
}

.checkbox-group a:hover {
  text-decoration: underline;
}

/* Links & Helper Row */
.form-helper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.helper-link {
  font-size: 13px;
  color: var(--tc-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.helper-link:hover {
  color: var(--tc-primary);
  text-decoration: underline;
}

/* Submit Button */
.btn-submit {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--tc-primary) 0%, var(--tc-secondary) 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(7, 94, 84, 0.25);
  transition: all 0.2s ease;
}

.btn-submit:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(7, 94, 84, 0.3);
}

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

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.btn-submit.loading .spinner {
  display: inline-block;
}

.btn-submit.loading .btn-text {
  opacity: 0.8;
}

/* Footer Switcher */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--tc-border);
  font-size: 14px;
  color: var(--tc-muted);
}

.auth-footer a {
  color: var(--tc-secondary);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}

.auth-footer a:hover {
  color: var(--tc-primary);
  text-decoration: underline;
}

/* Forgot Password Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  border-radius: var(--tc-radius);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  text-align: center;
  animation: popIn 0.25s ease;
}

.modal-icon {
  width: 48px;
  height: 48px;
  background: #e7f8f5;
  color: var(--tc-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--tc-primary);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: var(--tc-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-btn {
  width: 100%;
  height: 42px;
  background: var(--tc-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

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

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

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
  body {
    padding: 0;
    background-color: var(--tc-card-bg);
  }
  .auth-bg-band {
    display: none;
  }
  .auth-container {
    box-shadow: none;
    padding: 24px 20px;
    margin: 0;
    max-width: 100%;
    border-radius: 0;
  }
}
