/* Path: /app/public/assets/auth.css */
/* Shared auth layout for login & registration */

/* ------------------------------
   Design Tokens
------------------------------ */
:root {
  /* Background + text (match app) */
  --auth-bg: radial-gradient(circle at top left, rgba(56,189,248,0.22), transparent 55%),
             radial-gradient(circle at bottom right, rgba(59,130,246,0.20), transparent 55%),
             #f3f4f6;
  --auth-text: #0f172a;
  --auth-muted: #64748b;

  /* Card (match .card in admin.css with slightly elevated feel) */
  --auth-card-bg: #ffffff;
  --auth-card-border: rgba(15,23,42,0.10);
  --auth-card-shadow: 0 18px 40px rgba(15,23,42,0.05);
  --auth-card-radius: 12px;

  /* Inputs (match modal fields) */
  --auth-input-border: rgba(15,23,42,0.12);
  --auth-input-radius: 10px;

  /* Accent (match app accent blues) */
  --auth-accent: #0ea5e9;
  --auth-accent-alt: #2563eb;

  /* Error */
  --auth-error-text: #b91c1c;
  --auth-error-bg: #fef2f2;
  --auth-error-border: #fecaca;
}

/* ------------------------------
   Layout
------------------------------ */
body.auth {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 32px);
  background: var(--auth-bg);
  color: var(--auth-text);
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Narrow vs wide layouts */
body.auth.auth--wide .auth-wrap {
  max-width: 980px;
}

body.auth:not(.auth--wide) .auth-wrap {
  max-width: 520px;
}

.auth-wrap {
  width: 100%;
}

/* ------------------------------
   Card
------------------------------ */
.card.auth-card {
  width: 100%;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 26px);
  border-radius: var(--auth-card-radius);
  background: var(--auth-card-bg);
  box-shadow: var(--auth-card-shadow);
  border: 1px solid var(--auth-card-border);
}

/* ------------------------------
   Branding
------------------------------ */
.auth-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-bottom: 16px;
}

.auth-logo-icon {
  width: 32px;
  height: 32px;
  margin-right: 10px;
}

.auth-logo-text {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--auth-text);
}

/* ------------------------------
   Titles / Copy
------------------------------ */
.page-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--auth-muted);
  text-align: left;
}

.page-subtitle {
  margin: 4px 0 16px;
  font-size: 13px;
  color: var(--auth-muted);
}

/* ------------------------------
   Sections
------------------------------ */
.section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--auth-card-border);
}

.section h3 {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--auth-muted);
}

.section-help {
  margin: 0;
  font-size: 12px;
  color: var(--auth-muted);
}

/* ------------------------------
   Form Layout
------------------------------ */
.form-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-top: 14px;
}

.col {
  flex: 1 1 320px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.col--full {
  flex-basis: 100%;
  min-width: 0;
}

/* ------------------------------
   Fields
------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: 11px;
  color: var(--auth-muted);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

.label-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--auth-muted);
}

.input,
.select {
  width: 100%;
  height: 44px;
  border-radius: var(--auth-input-radius);
  border: 1px solid var(--auth-input-border);
  padding-inline: 12px;
  background: rgba(248,250,252,0.96);
  color: var(--auth-text);
  outline: none;
  font-size: 13px;
  box-sizing: border-box;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
  -webkit-appearance: none;
}

.input:focus,
.select:focus {
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.25);
  background: #ffffff;
}

/* Native select arrow (match app’s select styling) */
.select {
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 17px,
    calc(100% - 9px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.select::-ms-expand {
  display: none;
}

/* Textarea variant */
.input--textarea {
  height: auto;
  min-height: 80px;
  padding-top: 8px;
  padding-bottom: 8px;
  resize: vertical;
}

/* ------------------------------
   Actions / Buttons
------------------------------ */
.actions {
  margin-top: 18px;
}

.btn {
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  padding: 0 18px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Match .btn.primary in admin.css */
.btn.primary {
  width: 100%;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #f9fafb;
  box-shadow: 0 12px 30px rgba(37,99,235,0.35);
  border: none;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    filter 0.08s ease;
}

.btn.primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 16px 38px rgba(37,99,235,0.45);
}

.btn.primary:disabled {
  opacity: 0.65;
  cursor: default;
  box-shadow: none;
  transform: none;
}

/* ------------------------------
   Helper Text / Error / Footer
------------------------------ */
.small-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--auth-muted);
}

.auth-error {
  font-size: 13px;
  color: var(--auth-error-text);
  background-color: var(--auth-error-bg);
  border: 1px solid var(--auth-error-border);
  padding: 8px 10px;
  border-radius: var(--auth-input-radius);
}

.auth-footer-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--auth-muted);
  text-align: center;
}

.auth-footer-note a {
  color: var(--auth-accent);
  text-decoration: none;
}

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

/* ------------------------------
   Mobile
------------------------------ */
@media (max-width: 850px) {
  body.auth {
    align-items: flex-start;
  }

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

/* ------------------------------
   Role selector (step 1)
------------------------------ */
.role-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.role-card {
  position: relative;
  padding: 12px 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,0.5);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease,
    background-color 0.15s ease;
}

.role-card .role-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0369a1;
  background: rgba(56,189,248,0.10);
  margin-bottom: 6px;
}

.role-card .role-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.role-card .role-copy {
  font-size: 12px;
  color: var(--auth-muted);
}

.role-card.is-active {
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.22), 0 14px 28px rgba(56,189,248,0.22);
  background: linear-gradient(135deg, #eff6ff, #ecfeff);
  transform: translateY(-1px);
}

.role-card:hover:not(.is-active) {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(148,163,184,0.25);
}

/* Hide groups by role */
.is-hidden {
  display: none !important;
}

/* ------------------------------
   Reason options & textarea
------------------------------ */
.reason-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.reason-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--auth-text);
}

.reason-option input[type="checkbox"] {
  margin-top: 2px;
}

/* ------------------------------
   Checkbox label (terms)
------------------------------ */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--auth-text);
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
}

.checkbox-label a {
  color: var(--auth-accent);
  text-decoration: underline;
}

/* Mobile: stack role cards */
@media (max-width: 900px) {
  .role-selector {
    grid-template-columns: 1fr;
  }
}
