/* ==============================================================
   AUTH PAGES — devise_login.css
   Implements Figma design: Roboto, MUI-style inputs, two-column
   ============================================================== */

@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap");

/* --- Reset & Base ------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: #fff;
  color: rgba(0, 0, 0, 0.87);
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Two-column layout -------------------------------------- */
.auth-layout {
  display: flex;
  min-height: 100vh;
}

/* Left panel — padded, white background outside the rounded image */
.auth-slideshow {
  flex: 0 0 58%;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px;
  padding-right: 0px;
  background: #fff;
}

/* Rounded container that clips the slide images */
.auth-slideshow-inner {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  height: 100%;
}

/* Individual slides — stacked, fade in/out */
.auth-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.auth-slide.active {
  opacity: 1;
}

.slide-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Gradient overlay over the slides */
.auth-slideshow-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.60) 0%,
    rgba(0, 0, 0, 0.08) 50%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Bottom bar: [logo] [bars] [logo] */
.auth-slideshow-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 32px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
}

.auth-slideshow-bottom-side {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.auth-slideshow-bottom-side--right {
  justify-content: flex-end;
}

.auth-ikm-logo {
  height: 32px;
  width: auto;
}

.auth-brand-logo {
  height: 32px;
  width: auto;
}

@media (min-width: 1400px) {
  .auth-ikm-logo,
  .auth-brand-logo {
    height: 48px;
  }
}

/* Thin horizontal bar indicators (matching Figma) */
.auth-slide-bars {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
  padding: 0 24px;
}

.auth-slide-bar {
  flex: 1;
  max-width: 80px;
  height: 4px;
  border-radius: 37px;
  background: rgba(255, 255, 255, 0.30);
  transition: background 0.4s;
}

.auth-slide-bar.active {
  background: #ffffff;
}

/* --- Right form panel -------------------------------------- */
.auth-form-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 48px;
  min-height: 100vh;
}

.auth-form-header {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.auth-form-logo {
  width: 100%;
  max-width: 360px;
  height: auto;
}

/* Turbo frame — sizes to content, centers the form */
turbo-frame#auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  view-transition-name: auth-form;
  width: 100%;
}

/* Inner form wrapper — max-width container */
.auth-form-inner {
  max-width: 360px;
  width: 100%;
  padding: 24px 0;
}

/* Container grouping flash messages + turbo frame */
.auth-form-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}


/* Copyright footer */
.auth-copyright {
  flex-shrink: 0;
  margin-top: 24px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.87);
  text-align: center;
}

.auth-copyright-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}

.auth-copyright-logo {
  height: 24px;
  width: auto;
  filter: brightness(0);
}

.auth-copyright a {
  color: #1976d2;
  text-decoration: none;
}

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

/* --- Secondary inline row (e.g. "Don't have an account? Sign up") */
.auth-bottom-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.auth-body2 {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.87);
  line-height: 1.43;
}

.auth-link-inline {
  font-size: 14px;
  color: #1976d2;
  text-decoration: none;
  line-height: 1.43;
}

.auth-link-inline:hover {
  text-decoration: underline;
}

/* --- Back button ------------------------------------------- */
.auth-back {
  margin-bottom: 24px;
}

.auth-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 100px;
  background: #f1f1f1;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: rgba(0, 0, 0, 0.87);
  transition: background 0.2s ease;
}

.auth-back-btn:hover {
  background: #e0e0e0;
}

.auth-back-btn svg {
  display: block;
}

/* --- Typography -------------------------------------------- */
.auth-title {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.15px;
  color: rgba(0, 0, 0, 0.87);
  margin-bottom: 16px;
}

.auth-subtitle {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.6);
  line-height: 1.5;
  margin-top: -16px;
  margin-bottom: 24px;
}

/* --- Flash messages ---------------------------------------- */
.flash {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.flash p {
  margin: 0;
  font-size: 14px;
}

.flash p + p {
  margin-top: 4px;
}

.flash-alert {
  background: #fdeded;
  color: #5f2120;
  border: 1px solid rgba(229, 115, 115, 0.5);
}

.flash-notice {
  background: #edf7ed;
  color: #1e4620;
  border: 1px solid rgba(129, 199, 132, 0.5);
}

.flash-warning {
  background: #fff4e5;
  color: #7d4e00;
  border: 1px solid rgba(255, 167, 38, 0.5);
}

/* --- Auth nav (login page tabs) ---------------------------- */
.auth-nav {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
}

.auth-nav a {
  font-size: 14px;
  font-weight: 500;
  color: #1976d2;
  text-decoration: none;
  letter-spacing: 0.1px;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}

.auth-nav a:hover {
  border-bottom-color: rgba(25, 118, 210, 0.5);
}

/* --- MUI-style floating label inputs ----------------------- */
.field {
  position: relative;
  margin-bottom: 16px;
}

/* Label sits in the middle of the input by default */
.field > label {
  position: absolute;
  left: 13px;
  top: 28px;
  transform: translateY(-50%);
  font-size: 16px;
  color: rgba(0, 0, 0, 0.6);
  background: #fff;
  padding: 0 4px;
  pointer-events: none;
  transition:
    top 0.15s ease,
    transform 0.15s ease,
    font-size 0.15s ease,
    color 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}

/* Asterisk on required fields */
.field input:required ~ label::after,
.field select:required ~ label::after,
.field textarea:required ~ label::after {
  content: " *";
}

/* Float label up when input has content or is focused */
.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label,
.field textarea:focus ~ label,
.field textarea:not(:placeholder-shown) ~ label,
.field select:focus ~ label,
.field select:required:valid ~ label {
  top: 0;
  transform: translateY(-50%);
  font-size: 12px;
  color: #1976d2;
}

/* Non-focused but has value — use secondary text color */
.field input:not(:focus):not(:placeholder-shown) ~ label,
.field textarea:not(:focus):not(:placeholder-shown) ~ label {
  color: rgba(0, 0, 0, 0.6);
}

.field select:not(:focus):required:valid ~ label {
  color: rgba(0, 0, 0, 0.6);
}

/* ── Rails .field_with_errors wrapper compatibility ──────────
   When a model attribute has errors Rails wraps both the input
   and the label in separate <div class="field_with_errors">
   divs, breaking the input ~ label sibling selector.
   display:contents makes the wrapper invisible to layout so
   the label stays absolutely positioned inside .field.
   The :has() rules below restore float-up behaviour.        */
.field .field_with_errors {
  display: contents;
}

.field .field_with_errors > label {
  position: absolute;
  left: 13px;
  top: 28px;
  transform: translateY(-50%);
  font-size: 16px;
  color: rgba(0, 0, 0, 0.6);
  background: #fff;
  padding: 0 4px;
  pointer-events: none;
  transition:
    top 0.15s ease,
    transform 0.15s ease,
    font-size 0.15s ease,
    color 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}

/* Asterisk when input inside wrapper is required */
.field:has(.field_with_errors input:required) .field_with_errors > label::after {
  content: " *";
}

/* Float up when focused */
.field:has(.field_with_errors input:focus) .field_with_errors > label {
  top: 0;
  transform: translateY(-50%);
  font-size: 12px;
  color: #1976d2;
}

/* Float up when filled */
.field:has(.field_with_errors input:not(:placeholder-shown)) .field_with_errors > label {
  top: 0;
  transform: translateY(-50%);
  font-size: 12px;
  color: rgba(0, 0, 0, 0.6);
}

/* Focused + filled — use primary colour */
.field:has(.field_with_errors input:focus):has(.field_with_errors input:not(:placeholder-shown)) .field_with_errors > label {
  color: #1976d2;
}

/* Base input styles */
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field textarea {
  width: 100%;
  padding: 16.5px 14px;
  font-size: 16px;
  font-family: 'Roboto', sans-serif;
  color: rgba(0, 0, 0, 0.87);
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.23);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.4375;
}

.field input[type="text"]:hover,
.field input[type="email"]:hover,
.field input[type="password"]:hover,
.field input[type="tel"]:hover,
.field textarea:hover {
  border-color: rgba(0, 0, 0, 0.87);
}

.field input[type="text"]:focus,
.field input[type="email"]:focus,
.field input[type="password"]:focus,
.field input[type="tel"]:focus,
.field textarea:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 2px #1976d2;
}

.field textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.5;
}

.field select {
  width: 100%;
  padding: 16.5px 40px 16.5px 14px;
  font-size: 16px;
  font-family: 'Roboto', sans-serif;
  color: rgba(0, 0, 0, 0.87);
  background-color: transparent;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='rgba(0,0,0,0.54)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px 20px;
  border: 1px solid rgba(0, 0, 0, 0.23);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
  appearance: none;
}

.field select:hover {
  border-color: rgba(0, 0, 0, 0.87);
}

.field select:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 2px #1976d2;
}

/* --- Password toggle --------------------------------------- */
.field.password-field {
  position: relative;
}

.field.password-field input[type="password"],
.field.password-field input[type="text"] {
  padding-right: 48px;
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 28px;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: rgba(0, 0, 0, 0.54);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  line-height: 0;
}

.password-toggle-btn:hover {
  color: rgba(0, 0, 0, 0.87);
  background: rgba(0, 0, 0, 0.04);
}

/* Hint text under password field */
.field-hint {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.6);
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 14px;
  line-height: 1.4;
}

.field:has(.field-hint),
.field:has(+ .field-hint) {
  margin-bottom: 4px;
}

/* --- Form Validation --------------------------------------- */

/* Error message container — hidden until .is-invalid is added */
.field-error {
  display: block;
  font-size: 12px;
  color: #d32f2f;
  padding-left: 14px;
  line-height: 1.4;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, max-height 0.2s ease, margin-top 0.2s ease;
  margin-top: 0;
}

.field.is-invalid .field-error {
  max-height: 48px;
  opacity: 1;
  margin-top: 4px;
}

/* Remove bottom margin on invalid field — error message provides spacing */
.field.is-invalid {
  margin-bottom: 16px;
}

/* Input border colour — via JS class or native :user-invalid */
.field input:user-invalid,
.field select:user-invalid,
.field textarea:user-invalid,
.field.is-invalid input:not([readonly]),
.field.is-invalid select,
.field.is-invalid textarea {
  border-color: #d32f2f !important;
  outline-color: #d32f2f;
}

/* Box-shadow ring only while the invalid field is focused */
.field input:user-invalid:focus,
.field select:user-invalid:focus,
.field textarea:user-invalid:focus,
.field.is-invalid input:not([readonly]):focus,
.field.is-invalid select:focus,
.field.is-invalid textarea:focus {
  box-shadow: 0 0 0 2px #d32f2f;
}

/* Floating label colour when invalid */
.field input:user-invalid ~ label,
.field select:user-invalid ~ label,
.field textarea:user-invalid ~ label,
.field.is-invalid input:not([readonly]) ~ label,
.field.is-invalid select ~ label,
.field.is-invalid textarea ~ label {
  color: #d32f2f;
}

/* --- Password strength bars -------------------------------- */
.password-strength-bars {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 37px;
  background: rgba(0, 0, 0, 0.12);
  transition: background 0.3s ease;
}

.strength-bar.is-active {
  background: #4caf50;
}

.password-requirements {
  list-style: none;
  margin: 6px 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.password-requirements li {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.5);
  padding-left: 20px;
  position: relative;
  line-height: 1.5;
  transition: color 0.2s ease;
}

.password-requirements li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='5.5' stroke='rgba(0,0,0,0.25)' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
}

.password-requirements li.is-met {
  color: #2e7d32;
}

.password-requirements li.is-met::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='7' fill='%234caf50'/%3E%3Cpolyline points='3.5,7 6,9.5 10.5,4.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}

/* --- Checkbox field ---------------------------------------- */
.field.field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.field.field-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  accent-color: #1976d2;
  cursor: pointer;
}

.field.field-checkbox > label {
  position: static;
  transform: none;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.87);
  pointer-events: auto;
  padding: 0;
  background: none;
  cursor: pointer;
  white-space: normal;
}

/* --- Primary button ---------------------------------------- */
button[type="submit"],
button.btn-primary,
a.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 22px;
  min-height: 42px;
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: 'Roboto', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.46px;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0px 3px 1px -2px rgba(0, 0, 0, 0.2),
    0px 2px 2px 0px rgba(0, 0, 0, 0.14),
    0px 1px 5px 0px rgba(0, 0, 0, 0.12);
  transition: background 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.75;
  margin-top: 8px;
  box-sizing: border-box;
}

button[type="submit"]:hover,
button.btn-primary:hover,
a.btn-primary:hover {
  background: #1565c0;
  box-shadow:
    0px 2px 4px -1px rgba(0, 0, 0, 0.2),
    0px 4px 5px 0px rgba(0, 0, 0, 0.14),
    0px 1px 10px 0px rgba(0, 0, 0, 0.12);
}

button[type="submit"]:active,
button.btn-primary:active,
a.btn-primary:active {
  background: #0d47a1;
}

/* Spinner — no box reserved until loading; layout shift on appearance is fine. */
button[type="submit"].is-loading::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  box-sizing: border-box;
  flex-shrink: 0;
  animation: btn-spin 0.65s linear infinite;
}

button[type="submit"].is-loading {
  background: #9e9e9e;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

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

/* --- Secondary auth links ---------------------------------- */
.auth-link {
  display: inline-block;
  color: #1976d2;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 16px;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-bottom {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --- Unlock status page ------------------------------------ */
.text-center {
  text-align: center;
}

.unlock-status {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.unlock-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin-bottom: 20px;
}

.unlock-status-icon--success {
  background: #edf7ed;
  color: #2e7d32;
}

.unlock-status-icon--error {
  background: #fdeded;
  color: #c62828;
}

.unlock-status-icon--info {
  background: #e8f0fe;
  color: #1a56db;
}

.unlock-status .flash {
  width: 100%;
}

.unlock-status-btn {
  text-decoration: none;
  margin-top: 8px;
}

/* --- Cookie consent dialog --------------------------------- */
.cookie-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cookie-dialog-overlay[hidden] {
  display: none;
}

.cookie-dialog-overlay.is-visible {
  opacity: 1;
}

.cookie-dialog {
  background: #fff;
  border-radius: 4px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    0px 11px 15px -7px rgba(0,0,0,0.2),
    0px 24px 38px 3px rgba(0,0,0,0.14),
    0px 9px 46px 8px rgba(0,0,0,0.12);
}

.cookie-dialog-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.87);
}

.cookie-dialog-header h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
}

.cookie-dialog-body {
  padding: 16px 24px;
  overflow-y: auto;
}

.cookie-dialog-body p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.87);
  margin: 0 0 12px;
}

.cookie-dialog-body p:last-child {
  margin-bottom: 0;
}

.cookie-dialog-body h3 {
  font-size: 16px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.87);
  margin: 12px 0 6px;
}

.cookie-dialog-link {
  color: #1976d2;
  text-decoration: underline;
}

.cookie-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.cookie-btn {
  padding: 6px 16px;
  border-radius: 4px;
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  white-space: nowrap;
}

.cookie-btn--accept {
  background: #1976d2;
  color: #fff;
}

.cookie-btn--accept:hover {
  background: #1565c0;
}

.cookie-btn--reject {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.87);
}

.cookie-btn--reject:hover {
  background: rgba(0, 0, 0, 0.14);
}

/* Privacy policy cookie settings panel */
.pp-cookie-settings {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.pp-cookie-settings-label {
  font-size: 14px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.87);
  margin: 0;
}

.pp-cookie-settings-actions {
  display: flex;
  gap: 4px;
  margin-left: -8px;
}

.cookie-settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #fff;
  transition: background 0.15s;
  background: #1976d2;
}

.cookie-settings-btn:hover {
  background: #1565c0;
}

.cookie-settings-btn:active {
  background: #1565c0;
}

.cookie-settings-btn .cookie-settings-check {
  display: none;
  flex-shrink: 0;
}

.cookie-settings-btn.is-active .cookie-settings-check {
  display: block;
}

@media (prefers-color-scheme: dark) {
  .cookie-dialog {
    background: #1e1e1e;
  }

  .cookie-dialog-header {
    color: rgba(255, 255, 255, 0.87);
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .cookie-dialog-body p,
  .cookie-dialog-body h3 {
    color: rgba(255, 255, 255, 0.87);
  }

  .cookie-dialog-link {
    color: #90caf9;
  }

  .cookie-dialog-actions {
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .cookie-btn--reject {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.87);
  }

  .cookie-btn--reject:hover {
    background: rgba(255, 255, 255, 0.16);
  }

  .pp-cookie-settings-label {
    color: rgba(255, 255, 255, 0.87);
  }

  .cookie-settings-btn {
    color: rgba(255, 255, 255, 0.87);
  }

  .cookie-settings-btn:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .cookie-settings-btn:active {
    background: rgba(255, 255, 255, 0.14);
  }
}

/* --- Privacy Policy ---------------------------------------- */
.auth-form-inner.privacy-policy {
  max-width: 720px;
}

.pp-section {
  margin-bottom: 24px;
}

.pp-section p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.87);
  margin-bottom: 8px;
}

.pp-heading {
  font-size: 16px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.87);
  margin-bottom: 8px;
}

.pp-subheading {
  font-size: 14px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.87);
  margin-top: 12px;
  margin-bottom: 6px;
}

.pp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}

.pp-table th,
.pp-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.87);
}

.pp-table th {
  font-weight: 500;
  background: rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  .pp-section p,
  .pp-heading,
  .pp-subheading,
  .pp-table th,
  .pp-table td {
    color: rgba(255, 255, 255, 0.87);
  }

  .pp-table th {
    background: rgba(255, 255, 255, 0.06);
  }

  .pp-table th,
  .pp-table td {
    border-bottom-color: rgba(255, 255, 255, 0.12);
  }
}

/* --- View Transitions API ---------------------------------- */
::view-transition-old(auth-form) {
  animation: 180ms ease both fade-out;
}

::view-transition-new(auth-form) {
  animation: 220ms ease both fade-in;
}

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

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

/* Freeze the slideshow during transitions */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0ms;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 1000px) {
  .auth-slideshow {
    display: none;
  }
}

@media (max-width: 640px) {
  .auth-form-side {
    padding: 32px 24px;
  }
}

/* --- Dark mode -------------------------------------------- */
@media (prefers-color-scheme: dark) {
  body {
    background: #121212;
    color: rgba(255, 255, 255, 0.87);
  }

  .auth-slideshow {
    background: #121212;
  }

  .auth-form-side {
    background: #121212;
  }

  /* Floating label */
  .field > label,
  .field .field_with_errors > label {
    background: #121212;
    color: rgba(255, 255, 255, 0.6);
  }

  .field input:focus ~ label,
  .field input:not(:placeholder-shown) ~ label,
  .field textarea:focus ~ label,
  .field textarea:not(:placeholder-shown) ~ label,
  .field select:focus ~ label,
  .field select:required:valid ~ label,
  .field:has(.field_with_errors input:focus) .field_with_errors > label,
  .field:has(.field_with_errors input:focus):has(.field_with_errors input:not(:placeholder-shown)) .field_with_errors > label {
    color: #90caf9;
  }

  .field input:not(:focus):not(:placeholder-shown) ~ label,
  .field textarea:not(:focus):not(:placeholder-shown) ~ label,
  .field:has(.field_with_errors input:not(:placeholder-shown)) .field_with_errors > label {
    color: rgba(255, 255, 255, 0.6);
  }

  .field select:not(:focus):required:valid ~ label {
    color: rgba(255, 255, 255, 0.6);
  }

  /* Inputs */
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="password"],
  .field input[type="tel"],
  .field textarea {
    color: rgba(255, 255, 255, 0.87);
    border-color: rgba(255, 255, 255, 0.23);
  }

  .field input[type="text"]:hover,
  .field input[type="email"]:hover,
  .field input[type="password"]:hover,
  .field input[type="tel"]:hover,
  .field textarea:hover {
    border-color: rgba(255, 255, 255, 0.87);
  }

  .field input[type="text"]:focus,
  .field input[type="email"]:focus,
  .field input[type="password"]:focus,
  .field input[type="tel"]:focus,
  .field textarea:focus {
    border-color: #90caf9;
    box-shadow: 0 0 0 2px #90caf9;
  }

  /* Select */
  .field select {
    color: rgba(255, 255, 255, 0.87);
    background-color: #121212;
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='rgba(255,255,255,0.54)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    border-color: rgba(255, 255, 255, 0.23);
  }

  .field select:hover {
    border-color: rgba(255, 255, 255, 0.87);
  }

  .field select:focus {
    border-color: #90caf9;
    box-shadow: 0 0 0 2px #90caf9;
  }

  /* Back button */
  .auth-back-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.87);
  }

  .auth-back-btn:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  /* Typography */
  .auth-title {
    color: rgba(255, 255, 255, 0.87);
  }

  .auth-subtitle {
    color: rgba(255, 255, 255, 0.6);
  }

  .auth-body2 {
    color: rgba(255, 255, 255, 0.87);
  }

  .field-hint {
    color: rgba(255, 255, 255, 0.6);
  }

  /* Links */
  .auth-link,
  .auth-link-inline {
    color: #90caf9;
  }

  .auth-nav a {
    color: #90caf9;
  }

  .auth-nav a:hover {
    border-bottom-color: rgba(144, 202, 249, 0.5);
  }

  /* Flash messages */
  .flash-alert {
    background: rgba(211, 47, 47, 0.15);
    color: #ef9a9a;
    border-color: rgba(239, 154, 154, 0.3);
  }

  .flash-notice {
    background: rgba(46, 125, 50, 0.15);
    color: #a5d6a7;
    border-color: rgba(165, 214, 167, 0.3);
  }

  .flash-warning {
    background: rgba(237, 108, 2, 0.15);
    color: #ffb74d;
    border-color: rgba(255, 183, 77, 0.3);
  }

  /* Unlock status icons */
  .unlock-status-icon--success {
    background: rgba(46, 125, 50, 0.15);
    color: #a5d6a7;
  }

  .unlock-status-icon--error {
    background: rgba(211, 47, 47, 0.15);
    color: #ef9a9a;
  }

  .unlock-status-icon--info {
    background: rgba(25, 118, 210, 0.15);
    color: #90caf9;
  }

  /* Submit button loading state */
  button[type="submit"].is-loading {
    background: #616161;
  }

  /* Password toggle */
  .password-toggle-btn {
    color: rgba(255, 255, 255, 0.54);
  }

  .password-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.87);
    background: rgba(255, 255, 255, 0.08);
  }

  /* Checkbox */
  .field.field-checkbox > label {
    color: rgba(255, 255, 255, 0.87);
  }

  /* Copyright */
  .auth-copyright {
    color: rgba(255, 255, 255, 0.87);
  }

  .auth-copyright a {
    color: #90caf9;
  }

  .auth-copyright-logo {
    filter: brightness(1);
  }

  /* Form validation */
  .field-error {
    color: #ef9a9a;
  }

  .field input:user-invalid,
  .field select:user-invalid,
  .field textarea:user-invalid,
  .field.is-invalid input:not([readonly]),
  .field.is-invalid select,
  .field.is-invalid textarea {
    border-color: #ef9a9a !important;
    outline-color: #ef9a9a;
  }

  .field input:user-invalid:focus,
  .field select:user-invalid:focus,
  .field textarea:user-invalid:focus,
  .field.is-invalid input:not([readonly]):focus,
  .field.is-invalid select:focus,
  .field.is-invalid textarea:focus {
    box-shadow: 0 0 0 2px #ef9a9a;
  }

  .field input:user-invalid ~ label,
  .field select:user-invalid ~ label,
  .field textarea:user-invalid ~ label,
  .field.is-invalid input:not([readonly]) ~ label,
  .field.is-invalid select ~ label,
  .field.is-invalid textarea ~ label {
    color: #ef9a9a;
  }

  /* Password strength bars */
  .strength-bar {
    background: rgba(255, 255, 255, 0.15);
  }

  /* Password requirements list */
  .password-requirements li {
    color: rgba(255, 255, 255, 0.4);
  }

  .password-requirements li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='5.5' stroke='rgba(255,255,255,0.25)' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  }

  .password-requirements li.is-met {
    color: #a5d6a7;
  }

  .password-requirements li.is-met::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='7' fill='%234caf50'/%3E%3Cpolyline points='3.5,7 6,9.5 10.5,4.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  }
}
