/* ═══════════════════════════════════════════════════════════
   PJ CIRCULAR — AUTH STYLES
   Login-modal, fejl/loading-states, og topbar user-area.
   Matcher global.css palette (navy, rød, Titillium / Manrope).
   ═══════════════════════════════════════════════════════════ */

/* ─── PAGE LOCK når modal er åben ────────────────────────── */
html.auth-pending body { visibility: hidden; }
body.auth-locked { overflow: hidden; }

/* ─── OVERLAY ────────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 27, 48, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: auth-fade-in 0.18s ease-out;
}
.auth-overlay[hidden] { display: none !important; }

@keyframes auth-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── MODAL CARD ─────────────────────────────────────────── */
.auth-modal {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  font-family: var(--font-body, 'Manrope', system-ui, sans-serif);
  animation: auth-slide-up 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes auth-slide-up {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.auth-header {
  background: var(--pj-navy, #1b4472);
  color: #fff;
  padding: 28px 28px 22px;
  text-align: center;
}
.auth-header h2 {
  font-family: var(--font-display, 'Titillium Web', sans-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
}
.auth-header p {
  margin: 0;
  font-size: 13px;
  opacity: 0.82;
  letter-spacing: 0.02em;
}

.auth-body { padding: 24px 28px 28px; }

/* ─── FORM ───────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form[hidden] { display: none; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pj-grey-500, #6b7280);
}
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="text"] {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1.5px solid var(--pj-grey-200, #dde1e7);
  border-radius: 8px;
  background: #fff;
  color: var(--pj-grey-900, #111827);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--pj-navy, #1b4472);
  box-shadow: 0 0 0 3px rgba(27, 68, 114, 0.16);
}

.auth-field-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pj-grey-700, #374151);
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
.auth-checkbox input { margin: 0; }

.auth-help {
  font-size: 13px;
  line-height: 1.5;
  color: var(--pj-grey-700, #374151);
  margin: 0 0 4px;
}

.auth-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--pj-navy, #1b4472);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.auth-btn {
  position: relative;
  font-family: var(--font-display, 'Titillium Web', sans-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.auth-btn:disabled { cursor: not-allowed; opacity: 0.75; }
.auth-btn:active:not(:disabled) { transform: translateY(1px); }

.auth-btn-primary {
  background: var(--pj-navy, #1b4472);
  color: #fff;
  width: 100%;
}
.auth-btn-primary:hover:not(:disabled) {
  background: var(--pj-navy-dark, #123257);
}

.auth-btn-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

/* ─── ERROR / SUCCESS ────────────────────────────────────── */
.auth-error,
.auth-success {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 6px;
  line-height: 1.4;
}
.auth-error[hidden],
.auth-success[hidden] { display: none; }

.auth-error {
  background: var(--pj-red-light, #fbe5e3);
  color: var(--pj-red-dark, #b8362d);
  border-left: 3px solid var(--pj-red, #d9443a);
}
.auth-success {
  background: var(--pj-green-light, #e6f3ec);
  color: #1b5333;
  border-left: 3px solid var(--pj-green, #3f8f5f);
}

/* ─── TOPBAR USER-AREA ───────────────────────────────────── */
.auth-user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.auth-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display, 'Titillium Web', sans-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.auth-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.auth-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.auth-user-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-block;
  align-self: flex-start;
}
.auth-role-admin  { background: var(--pj-red, #d9443a); color: #fff; }
.auth-role-user   { background: rgba(255,255,255,0.22); color: #fff; }
.auth-role-reader { background: rgba(255,255,255,0.12); color: #d8e2ee; }

.auth-logout-btn {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s;
}
.auth-logout-btn:hover {
  background: var(--pj-red, #d9443a);
  border-color: var(--pj-red, #d9443a);
}

/* Skjul user-area og overlay i print */
@media print {
  .auth-user-area, .auth-overlay { display: none !important; }
}

/* ─── RESPONSIVT ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-modal { max-width: none; }
  .auth-user-text { display: none; }
}
