/**
 * ADP — Tema login Keycloak | hub Intercluster (e-Logistics Hub)
 * Stile del mockup "Secure Login" (card + stat box + toggle + footer).
 * Caricato dal login.ftl standalone.
 *
 * Accento brand = VARIABILE: cambia --adp-accent per passare verde<->blu.
 *   verde mockup:        #16a34a
 *   blu design system:   #1d4ed8 (ADP-76 / packages/ui .theme-intercluster)
 */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

:root,
body.adp-login {
  /* marker ADP-76 (test ATDD) — non rimuovere */
  --adp-primary: #1d4ed8;
  --adp-primary-foreground: #ffffff;

  /* palette mockup */
  --adp-bg: #f4f5f8;
  --adp-card: #ffffff;
  --adp-ink: #0f1a2b;
  --adp-text: #334155;
  --adp-muted: #7b8794;
  --adp-line: #e7eaf0;
  --adp-input-bg: #f8fafc;
  --adp-btn: #0f1a2b;
  --adp-btn-ink: #ffffff;

  /* accento (link / focus) — verde mockup intercluster */
  --adp-accent: #16a34a;
  --adp-accent-strong: #15803d;
  --adp-accent-soft: rgba(22, 163, 74, 0.18);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}

body.adp-login {
  min-height: 100vh;
  background: var(--adp-bg);
  color: var(--adp-text);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.adp-page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Brand / logo placeholder ===== */
.adp-brand {
  text-align: center;
  margin-bottom: 28px;
}
.brand-logo {
  width: 124px;
  height: 50px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #c7ccd6;
  border-radius: 10px;
  color: #aab2bf;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.brand-name {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--adp-ink);
}

/* ===== Card ===== */
.adp-card {
  width: 100%;
  background: var(--adp-card);
  border: 1px solid var(--adp-line);
  border-radius: 16px;
  padding: 40px 38px 34px;
  box-shadow: 0 18px 44px -26px rgba(15, 26, 43, 0.28);
}
.adp-title {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--adp-ink);
}
.adp-subtitle {
  margin: 0 0 30px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--adp-muted);
}

/* ===== Alert (messaggi Keycloak) ===== */
.adp-alert {
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  border: 1px solid transparent;
}
.adp-alert--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.adp-alert--success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}
.adp-alert--warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}
.adp-alert--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

/* ===== Campi ===== */
.adp-field {
  margin-bottom: 24px;
}
.adp-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.adp-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--adp-ink);
}
.adp-label-icon {
  display: inline-flex;
  color: var(--adp-muted);
}

.adp-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--adp-input-bg);
  border: 1px solid var(--adp-line);
  border-radius: 11px;
  font-size: 15px;
  color: var(--adp-ink);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}
.adp-input::placeholder {
  color: #aab2bf;
}
.adp-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--adp-accent);
  box-shadow: 0 0 0 3px var(--adp-accent-soft);
}
.adp-input--error {
  border-color: #f87171;
}
.adp-input--error:focus {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.22);
}

.adp-input-wrap {
  position: relative;
}
.adp-input-wrap .adp-input {
  padding-right: 46px;
}
.adp-eye {
  position: absolute;
  top: 0;
  right: 0;
  height: 46px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--adp-muted);
}
.adp-eye:hover {
  color: var(--adp-ink);
}
.adp-eye.is-on {
  color: var(--adp-accent);
}

.adp-field-error {
  display: block;
  margin-top: 7px;
  font-size: 12.5px;
  color: #dc2626;
}

/* ===== Link ===== */
.adp-link {
  color: var(--adp-accent);
  font-weight: 500;
  text-decoration: none;
  font-size: 13px;
}
.adp-link:hover {
  color: var(--adp-accent-strong);
  text-decoration: underline;
}

/* ===== Remember ===== */
.adp-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 28px;
  font-size: 14px;
  color: var(--adp-text);
  cursor: pointer;
}
.adp-check input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  position: relative;
  background: #fff;
  border: 1.5px solid var(--adp-line);
  border-radius: 7px; /* check stondato come nel mockup */
  transition:
    background 0.15s,
    border-color 0.15s;
}
.adp-check input:hover {
  border-color: #cbd2dc;
}
.adp-check input:checked {
  background: var(--adp-accent);
  border-color: var(--adp-accent);
}
.adp-check input:checked::after {
  content: "";
  position: absolute;
  left: 6.5px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.adp-check input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--adp-accent-soft);
}

/* ===== Submit ===== */
.adp-submit {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--adp-btn);
  color: var(--adp-btn-ink);
  border: none;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 14px 26px -16px rgba(15, 26, 43, 0.7);
  transition:
    background 0.15s,
    transform 0.05s;
}
.adp-submit:hover {
  background: #16233a;
}
.adp-submit:active {
  transform: translateY(1px);
}

/* ===== Stat box (decorativi) ===== */
.adp-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 30px;
}
.adp-stat {
  background: var(--adp-input-bg);
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
}
.adp-stat-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--adp-muted);
}
.adp-stat-value {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--adp-ink);
  font-variant-numeric: tabular-nums;
}

/* ===== Footer ===== */
.adp-footer {
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--adp-muted);
  text-align: center;
}

/* ===== Focus visibile (WCAG 2.1 AA) ===== */
:focus-visible {
  outline: 3px solid var(--adp-accent);
  outline-offset: 2px;
}
.adp-input:focus-visible {
  outline: none;
} /* l'input usa il box-shadow ring */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
