/* Forge Auth & Standalone Page Theme
   Shared by: login, register, forgot-password, reset-password,
   verify-email, accept-invite, 404, 500, terms, privacy, takedown */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,400&display=swap');

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

body {
  background: #0f0f1a;
  color: #c8d0e0;
  font-family: 'Crimson Pro', serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    radial-gradient(ellipse at 30% 80%, rgba(201, 120, 40, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 20%, rgba(201, 168, 76, 0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(15, 15, 26, 0.9) 0%, transparent 80%);
}

/* Floating ember particles */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 85%, rgba(230, 140, 50, 0.35), transparent),
    radial-gradient(1px 1px at 28% 30%, rgba(201, 168, 76, 0.2), transparent),
    radial-gradient(1px 1px at 45% 70%, rgba(230, 160, 60, 0.25), transparent),
    radial-gradient(1.5px 1.5px at 62% 15%, rgba(201, 168, 76, 0.18), transparent),
    radial-gradient(1px 1px at 78% 55%, rgba(230, 140, 50, 0.22), transparent),
    radial-gradient(1px 1px at 88% 80%, rgba(201, 168, 76, 0.15), transparent),
    radial-gradient(2px 2px at 35% 92%, rgba(230, 120, 40, 0.2), transparent),
    radial-gradient(1px 1px at 55% 8%, rgba(201, 168, 76, 0.12), transparent),
    radial-gradient(1px 1px at 8% 45%, rgba(230, 160, 60, 0.15), transparent),
    radial-gradient(1.5px 1.5px at 92% 35%, rgba(201, 140, 50, 0.18), transparent);
  pointer-events: none;
  z-index: 0;
  animation: emberDrift 20s ease-in-out infinite alternate;
}

@keyframes emberDrift {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

/* ---- Layout ---- */

.forge-container {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

.forge-card {
  background: linear-gradient(165deg, #161822, #0d0f17);
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-top: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 100px rgba(201, 140, 50, 0.03),
    inset 0 1px 0 rgba(201, 168, 76, 0.08);
}

/* ---- Forge Icon (SVG anvil) ---- */

.forge-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.forge-icon svg {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 0 12px rgba(201, 168, 76, 0.25))
          drop-shadow(0 0 30px rgba(201, 140, 50, 0.1));
}

/* ---- Brand ---- */

.forge-title {
  font-family: 'Cinzel Decorative', serif;
  color: #c9a84c;
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 0.25rem;
  letter-spacing: 0.04em;
}

.forge-subtitle {
  text-align: center;
  color: #6a7585;
  font-size: 0.95rem;
  margin-bottom: 2rem;
  font-style: italic;
  letter-spacing: 0.01em;
}

/* ---- Form Elements ---- */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  color: #8a90a0;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  background: #0a0c14;
  border: 1px solid #252a38;
  border-radius: 8px;
  color: #c8d0e0;
  padding: 0.8rem 1rem;
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-input::placeholder {
  color: #3a4050;
}

.form-input:focus {
  border-color: #c9a84c;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.form-input.input-error {
  border-color: #cf6679;
  box-shadow: 0 0 0 3px rgba(207, 102, 121, 0.1);
}

.field-hint {
  color: #454b5e;
  font-size: 0.8rem;
  margin-top: 0.3rem;
  font-style: italic;
}

/* ---- Buttons ---- */

.forge-btn {
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: linear-gradient(135deg, #c9a84c, #a88a38);
  color: #0d0f17;
  border: none;
  border-radius: 8px;
  font-family: 'Cinzel Decorative', serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.03em;
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.forge-btn:hover {
  background: linear-gradient(135deg, #ddb856, #c9a84c);
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.3);
  transform: translateY(-1px);
}

.forge-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 12px rgba(201, 168, 76, 0.2);
}

.forge-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.forge-btn .btn-text {
  transition: opacity 0.2s;
}

.forge-btn .btn-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.2s;
}

.forge-btn.loading .btn-text {
  opacity: 0;
}

.forge-btn.loading .btn-loading {
  opacity: 1;
}

/* ---- Spinner ---- */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(13, 15, 23, 0.3);
  border-top-color: #0d0f17;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(201, 168, 76, 0.15);
  border-top-color: #c9a84c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-bottom: 1.25rem;
}

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

/* ---- Messages ---- */

.forge-error {
  background: rgba(207, 102, 121, 0.08);
  border: 1px solid rgba(207, 102, 121, 0.25);
  border-radius: 8px;
  color: #cf6679;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
  animation: slideDown 0.3s ease;
}

.forge-error.visible {
  display: flex;
}

.forge-error .error-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}

.forge-msg {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
  animation: slideDown 0.3s ease;
}

.forge-msg.error {
  background: rgba(207, 102, 121, 0.08);
  border: 1px solid rgba(207, 102, 121, 0.25);
  color: #cf6679;
}

.forge-msg.success {
  background: rgba(76, 175, 80, 0.08);
  border: 1px solid rgba(76, 175, 80, 0.25);
  color: #66bb6a;
}

.forge-msg.visible {
  display: flex;
}

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

/* ---- State Sections (verify-email etc.) ---- */

.state-section {
  text-align: center;
  animation: slideDown 0.3s ease;
}

.state-section .state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.state-section .state-icon.success { color: #66bb6a; }
.state-section .state-icon.error { color: #cf6679; }

.state-section .state-title {
  font-family: 'Cinzel Decorative', serif;
  color: #c9a84c;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.state-section .state-text {
  color: #8a90a0;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.state-section .loading-text {
  color: #6a7585;
  font-size: 1rem;
  font-style: italic;
}

/* Success state (register, accept-invite) */
.success-section {
  text-align: center;
  animation: slideDown 0.3s ease;
}

.success-section .success-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  color: #66bb6a;
}

.success-section .success-title {
  font-family: 'Cinzel Decorative', serif;
  color: #c9a84c;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.success-section .success-text {
  color: #8a90a0;
  font-size: 1rem;
  line-height: 1.6;
}

/* Invalid state (accept-invite) */
.invalid-section {
  text-align: center;
  animation: slideDown 0.3s ease;
}

.invalid-section .invalid-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  color: #cf6679;
}

.invalid-section .invalid-title {
  font-family: 'Cinzel Decorative', serif;
  color: #c9a84c;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.invalid-section .invalid-text {
  color: #8a90a0;
  font-size: 1rem;
  line-height: 1.6;
}

/* ---- Error Pages (404/500) ---- */

.error-code {
  font-family: 'Cinzel Decorative', serif;
  color: rgba(201, 168, 76, 0.12);
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.error-message-text {
  color: #8a90a0;
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 2rem;
}

.forge-link-btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, #c9a84c, #a88a38);
  color: #0d0f17;
  border: none;
  border-radius: 8px;
  font-family: 'Cinzel Decorative', serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: all 0.25s ease;
}

.forge-link-btn:hover {
  background: linear-gradient(135deg, #ddb856, #c9a84c);
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.3);
  transform: translateY(-1px);
}

.forge-link-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 12px rgba(201, 168, 76, 0.2);
}

/* ---- Links ---- */

.forge-link {
  color: #c9a84c;
  text-decoration: none;
  transition: color 0.2s;
}

.forge-link:hover {
  color: #ddb856;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  color: #c9a84c;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: #ddb856;
}

.signin-link {
  text-align: center;
  margin-top: 1.25rem;
}

.signin-link a {
  color: #c9a84c;
  text-decoration: none;
  font-size: 0.9rem;
  font-style: italic;
  transition: color 0.2s;
}

.signin-link a:hover {
  color: #ddb856;
}

/* ---- Dividers & Footer ---- */

.forge-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(201, 168, 76, 0.15), transparent);
  margin: 1.75rem 0;
}

.forge-divider-or {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: #4a5565;
  font-size: 0.8rem;
  font-style: italic;
}

.forge-divider-or::before, .forge-divider-or::after {
  content: '';
  flex: 1;
  border-top: 1px solid rgba(201, 168, 76, 0.1);
}

.forge-divider-or span {
  padding: 0 0.75rem;
}

.forge-footer {
  text-align: center;
  color: #3a4050;
  font-size: 0.8rem;
  font-style: italic;
}

/* ---- Checkbox ---- */

.tos-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 0.5rem;
}

.tos-group input[type="checkbox"] {
  margin-top: 3px;
  accent-color: #c9a84c;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.tos-group label {
  font-size: 0.85rem;
  color: #6a7585;
  line-height: 1.5;
  cursor: pointer;
}

.tos-group a {
  color: #c9a84c;
  text-decoration: underline;
  text-decoration-color: rgba(201, 168, 76, 0.4);
}

.tos-group a:hover {
  color: #ddb856;
}

/* ---- Resend Section (verify-email) ---- */

.resend-section {
  margin-top: 1.5rem;
  text-align: left;
}

.resend-section .resend-label {
  color: #6a7585;
  font-size: 0.9rem;
  font-style: italic;
  margin-bottom: 1rem;
  text-align: center;
}

.resend-success {
  color: #66bb6a;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0.75rem;
  animation: slideDown 0.3s ease;
}

/* ---- Legal Pages (terms, privacy, takedown) ---- */

body.forge-legal {
  display: block;
  padding: 40px 20px;
}

.legal-container {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.legal-back {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: #c9a84c;
  text-decoration: none;
  transition: color 0.2s;
}

.legal-back:hover {
  color: #ddb856;
}

.legal-card {
  background: linear-gradient(165deg, #161822, #0d0f17);
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.legal-card h1 {
  font-family: 'Cinzel Decorative', serif;
  color: #c9a84c;
  font-size: 1.5rem;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.legal-card .date {
  color: #555;
  font-size: 0.85rem;
  margin-bottom: 32px;
  font-style: italic;
}

.legal-card h2 {
  color: #c9a84c;
  font-size: 1.05rem;
  margin: 28px 0 12px;
  font-family: 'Cinzel Decorative', serif;
  letter-spacing: 0.02em;
}

.legal-card p,
.legal-card li {
  line-height: 1.7;
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: #8a90a0;
}

.legal-card ul {
  padding-left: 24px;
  margin-bottom: 16px;
}

.legal-card a {
  color: #c9a84c;
  text-decoration: none;
  transition: color 0.2s;
}

.legal-card a:hover {
  color: #ddb856;
}

.legal-card strong {
  color: #c8d0e0;
}

/* Takedown form */
.legal-card label {
  display: block;
  color: #8a90a0;
  font-size: 0.85rem;
  margin-bottom: 4px;
  margin-top: 16px;
}

.legal-card input,
.legal-card textarea,
.legal-card select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #252a38;
  border-radius: 8px;
  background: #0a0c14;
  color: #c8d0e0;
  font-size: 0.95rem;
  font-family: 'Crimson Pro', serif;
  transition: border-color 0.25s;
}

.legal-card input:focus,
.legal-card textarea:focus,
.legal-card select:focus {
  outline: none;
  border-color: #c9a84c;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.legal-card textarea {
  resize: vertical;
  min-height: 100px;
}

.legal-card .required { color: #cf6679; }

.legal-card .btn {
  display: inline-block;
  padding: 12px 28px;
  background: linear-gradient(135deg, #c9a84c, #a88a38);
  color: #0d0f17;
  border: none;
  border-radius: 8px;
  font-family: 'Cinzel Decorative', serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 24px;
  transition: all 0.25s ease;
  letter-spacing: 0.02em;
}

.legal-card .btn:hover {
  background: linear-gradient(135deg, #ddb856, #c9a84c);
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.3);
}

.legal-card .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.legal-card .success {
  background: rgba(76, 175, 80, 0.08);
  border: 1px solid rgba(76, 175, 80, 0.25);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  color: #66bb6a;
}

.legal-card .error {
  background: rgba(207, 102, 121, 0.08);
  border: 1px solid rgba(207, 102, 121, 0.25);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  color: #cf6679;
}

.legal-card .info {
  background: rgba(100, 140, 200, 0.08);
  border: 1px solid rgba(100, 140, 200, 0.2);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  margin-bottom: 16px;
  color: #7db8ce;
  font-size: 0.9rem;
}

/* ---- Mobile ---- */

@media (max-width: 480px) {
  .forge-container {
    padding: 1rem;
  }

  .forge-card {
    padding: 2rem 1.5rem;
    border-radius: 12px;
  }

  .forge-title {
    font-size: 1.35rem;
  }

  .form-input {
    padding: 0.75rem 0.9rem;
    font-size: 1rem;
  }

  .error-code {
    font-size: 5rem;
  }

  .legal-card {
    padding: 1.5rem;
  }
}

@media (max-width: 360px) {
  .forge-card {
    padding: 1.5rem 1.25rem;
  }

  .forge-title {
    font-size: 1.2rem;
  }

  .forge-icon svg {
    width: 44px;
    height: 44px;
  }

  .error-code {
    font-size: 4rem;
  }
}

@media (min-height: 700px) {
  body:not(.forge-legal) {
    padding-bottom: 5vh;
  }
}
