:root {
  color-scheme: light;
  --auth-bg-start: #2c5d5f;
  --auth-bg-end: #173e40;
  --auth-card-bg: #ffffff;
  --auth-card-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
  --auth-text: #1f2937;
  --auth-muted: #6b7280;
  --auth-border: #d7dee5;
  --auth-input-border: #e1e5e9;
  --auth-focus: #ff6b35;
  --auth-button-bg: #ff6b35;
  --auth-button-bg-hover: #e55a2b;
  --auth-link: #2c5d5f;
  --auth-panel-bg: #f8fafc;
  --auth-panel-border: #dbe4ea;
  --auth-panel-accent: #2c5d5f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.auth-page {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--auth-text);
  background:
    radial-gradient(circle at top left, rgba(255, 107, 53, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(44, 93, 95, 0.24), transparent 34%),
    linear-gradient(135deg, var(--auth-bg-start) 0%, var(--auth-bg-end) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body.auth-page * {
  box-sizing: border-box;
}

input,
select,
button {
  font: inherit;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--auth-card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--auth-card-shadow);
  animation: auth-slide-in 0.45s ease-out;
}

.auth-card--register {
  max-width: 520px;
}

.auth-card--message {
  max-width: 560px;
}

.auth-card--admin {
  max-width: 420px;
}

.auth-hero {
  background: linear-gradient(135deg, #2c5d5f 0%, #1a4648 100%);
  color: #ffffff;
  padding: 36px 30px;
  text-align: center;
}

.auth-hero--left {
  text-align: left;
  padding: 40px 32px 28px;
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.auth-hero h1,
.auth-title {
  margin: 0 0 8px;
  font-size: clamp(1.9rem, 5vw, 2.45rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.auth-hero p,
.auth-subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  line-height: 1.6;
}

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

.auth-form-group {
  margin-bottom: 24px;
}

.auth-form-group label {
  display: block;
  margin-bottom: 8px;
  color: #374151;
  font-weight: 600;
  font-size: 0.95rem;
}

.auth-form-group input:not([type="hidden"]),
.auth-form-group select,
.auth-form-group textarea {
  width: 100%;
  border: 2px solid var(--auth-input-border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  background: #ffffff;
  color: var(--auth-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form-group input:not([type="hidden"]):focus,
.auth-form-group select:focus,
.auth-form-group textarea:focus {
  outline: none;
  border-color: var(--auth-focus);
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.12);
}

.auth-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.auth-button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 16px;
  background: var(--auth-button-bg);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 12px 24px rgba(255, 107, 53, 0.22);
  text-decoration: none;
}

.auth-button:hover {
  background: var(--auth-button-bg-hover);
  transform: translateY(-1px);
}

.auth-button:disabled,
.auth-button[aria-disabled="true"] {
  background: #c7cdd4;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.auth-panel,
.auth-alert {
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* When the alert is rendered below the submit button (login / register),
   add a gap above it so it doesn't sit flush against the button. */
form > #alert-container .auth-alert {
  margin-top: 24px;
}

.auth-panel {
  border: 1px solid var(--auth-panel-border);
  background: var(--auth-panel-bg);
}

.auth-panel strong,
.auth-panel-title {
  display: block;
  margin-bottom: 6px;
  color: var(--auth-panel-accent);
  font-size: 15px;
}

.auth-panel p {
  margin: 0;
  line-height: 1.6;
  color: #374151;
}

.auth-panel--default {
  --auth-panel-bg: #f8fafc;
  --auth-panel-border: #dbe4ea;
  --auth-panel-accent: #2c5d5f;
}

.auth-panel--success,
.auth-alert--success {
  --auth-panel-bg: #f0fdf4;
  --auth-panel-border: #bbf7d0;
  --auth-panel-accent: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.auth-panel--error,
.auth-alert--error {
  --auth-panel-bg: #fef2f2;
  --auth-panel-border: #fecaca;
  --auth-panel-accent: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.auth-alert--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.auth-alert--success,
.auth-alert--error,
.auth-alert--info {
  align-items: center;
}

.auth-help {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--auth-border);
  text-align: center;
  color: var(--auth-muted);
  font-size: 14px;
  line-height: 1.6;
}

.auth-help--left {
  text-align: left;
}

.auth-help p {
  margin: 0;
}

.auth-help p + p {
  margin-top: 10px;
}

.auth-help a {
  color: var(--auth-link);
  text-decoration: none;
  font-weight: 600;
}

.auth-help a:hover {
  text-decoration: underline;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid #ffffff;
  border-radius: 50%;
  animation: auth-spin 1s linear infinite;
}

.auth-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes auth-spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes auth-slide-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  body.auth-page {
    padding: 16px;
  }

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

  .auth-hero,
  .auth-hero--left {
    padding: 30px 22px 24px;
  }

  .auth-content {
    padding: 26px 22px;
  }
}

@media (max-width: 480px) {
  .auth-form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
