/* ============================================================
   Avalo — Delt CSS for auth-sider
   (login, register, forgot, reset, 2fa-setup, verify)
   ============================================================ */

:root {
  --brand-primary:  #e05c2a;
  --brand-accent:   #c94e20;
  --brand-warm:     #e05c2a;
  --brand-warm2:    #f07540;
  --bg-soft:        #fdf6f2;
  --auth-dark1:     #100f0d;
  --auth-dark2:     #1c1a16;
  --auth-dark3:     #252118;
  --border-light:   #e2ddd4;
}

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

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  background:
    radial-gradient(ellipse 70% 50% at 80% 20%, rgba(13,122,140,.18), transparent 55%),
    linear-gradient(145deg, var(--auth-dark1) 0%, var(--auth-dark2) 55%, var(--auth-dark3) 100%);
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
}

/* Mobil: fjern grid-høydebegrensning så siden kan scrolle naturlig */
@media (max-width: 700px) {
  html { height: auto; overflow-y: auto; }
  body {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    padding: 0;
    background: #fff;
  }
}

/* ── Kort ── */
.auth-card {
  width: 100%;
  max-width: 900px;
  display: flex;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.2);
  background: #fff;
}

/* ── Venstre panel ── */
.auth-side {
  flex: 0 0 320px;
  background: linear-gradient(175deg, var(--auth-dark1) 0%, #1a1714 60%, #211f1b 100%);
  color: #ddf4f8;
  display: flex;
  flex-direction: column;
  padding: 40px 32px;
  position: relative;
  overflow: hidden;
}

.auth-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 130% 80% at 85% 110%, rgba(224,92,42,.18) 0%, transparent 58%);
  pointer-events: none;
}

.auth-brand { position: relative; }

.auth-brand-kicker {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(224,92,42,.65);
  margin-bottom: 6px;
}

.auth-brand-name {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #f0fafb;
  line-height: 1.1;
}

.auth-brand-tagline {
  font-size: 0.78rem;
  color: rgba(180,230,235,.45);
  margin-top: 8px;
  line-height: 1.4;
}

.auth-side-icon {
  position: relative;
  margin-top: 2.5rem;
  font-size: 4.5rem;
  color: rgba(13,122,140,.28);
  line-height: 1;
}

.auth-side-footer {
  position: relative;
  margin-top: auto;
  padding-top: 1.5rem;
}

/* Knapp i sidefeltet */
.auth-side-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  color: rgba(200,235,240,.8);
  border: 1px solid rgba(255,255,255,.1);
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
}
.auth-side-btn:hover {
  background: rgba(255,255,255,.13);
  color: #fff;
  border-color: rgba(255,255,255,.2);
  text-decoration: none;
}

.auth-copyright {
  font-size: 0.7rem;
  color: rgba(255,255,255,.25);
  margin-top: 10px;
}

/* ── Høyre panel ── */
.auth-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 44px 48px;
  background: #fff;
}

.auth-main h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0e2830;
  margin: 0 0 1.4rem 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.auth-main h2 .bi {
  color: var(--brand-primary);
  font-size: 1.1rem;
}

/* ── Skjema ── */
.auth-main .form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
  display: block;
}

.auth-main .form-control,
.auth-main .form-select {
  border-radius: 8px;
  border: 1.5px solid var(--border-light);
  font-size: 0.875rem;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background: #fafcfc;
  color: #0e2830;
}

.auth-main .form-control:focus,
.auth-main .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(13,122,140,.13);
  background: #fff;
}

.auth-main .form-text {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 3px;
}

.auth-main .input-group .form-control {
  border-radius: 8px 0 0 8px;
}
.auth-main .input-group .input-group-text {
  border-radius: 0 8px 8px 0;
  border: 1.5px solid var(--border-light);
  border-left: none;
  background: #f5fafa;
}

.mb-field { margin-bottom: 1rem; }

/* ── Hoved-CTA knapp ── */
.btn-auth-primary {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--brand-warm), var(--brand-warm2));
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 2px 10px rgba(212,120,74,.35);
  text-decoration: none;
}
.btn-auth-primary:hover {
  opacity: .92;
  box-shadow: 0 4px 18px rgba(212,120,74,.45);
  color: #fff;
}
.btn-auth-primary:active {
  transform: scale(.99);
}

/* ── Sekundær lenke-knapp ── */
.btn-auth-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4a7080;
  background: transparent;
  border: 1.5px solid var(--border-light);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-auth-ghost:hover {
  border-color: #a8c8ce;
  background: #f4fafb;
  color: #0e2830;
}

/* ── Varsler ── */
.auth-alert {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  margin-bottom: 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}
.auth-alert.danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.auth-alert.success { background: #f0fdf8; border: 1px solid #a7f3d0; color: #065f46; }
.auth-alert.warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.auth-alert.info    { background: #edf7f8; border: 1px solid #a5d8df; color: #0c4558; }

.auth-alert ul { margin: 4px 0 0 0; padding-left: 1.2em; }
.auth-alert ul li + li { margin-top: 2px; }

/* ── OTP-felt ── */
.otp-input {
  letter-spacing: 0.4em;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}

/* ── Hjelpelenker ── */
.auth-help {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 1rem;
  line-height: 1.5;
}

.auth-link {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
}
.auth-link:hover { text-decoration: underline; }

.auth-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.9rem;
}

/* ── QR-blokk (2FA) ── */
.qr-block {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  background: #f4fafb;
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 1.25rem;
}

.qr-block img {
  border-radius: 8px;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

.secret-key {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.98rem;
  font-weight: 700;
  color: #0e2830;
  letter-spacing: 0.12em;
  word-break: break-all;
}

/* ── Brreg-feedback ── */
#brreg-result .bi { vertical-align: -2px; }

/* ── Cloudflare Turnstile ── */
.cf-turnstile { margin-bottom: .25rem; max-width: 100%; overflow: hidden; }

/* ── Passord-grid ── */
.password-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Mobil ── */
@media (max-width: 700px) {
  /* auth-card: blokkflyt – ingen flex-algoritme, høyde = innhold */
  .auth-card {
    display: block;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  /* Sidepanel: kompakt toppseksjon */
  .auth-side {
    display: block;
    width: 100%;
    padding: 18px 20px;
    overflow: visible;
  }
  .auth-side-icon { display: none; }

  /* Innholdspanel: blokkflyt, høyde satt av innholdet */
  .auth-main {
    display: block;
    width: 100%;
    padding: 24px 20px 48px;
  }

  /* Passord-felter stables */
  .password-grid { grid-template-columns: 1fr; }

  /* QR-blokk: stabel vertikalt */
  .qr-block { flex-direction: column; align-items: center; gap: 1rem; }

  /* OTP: reduser letter-spacing */
  .otp-input { letter-spacing: 0.22em; }

  /* Touch-targets */
  .btn-auth-primary { min-height: 48px; font-size: .875rem; }
  .auth-side-btn    { min-height: 40px; }
}

/* ── Ekstra smal (360px og under) ── */
@media (max-width: 360px) {
  .auth-main { padding: 20px 14px 28px; }
  .auth-side  { padding: 14px 16px; }
}
