:root {
  /* paleta brenda — usklađena sa ponudom DPX Sales Operating System */
  --navy: #06205a;
  --navy-deep: #13233f;
  --blue: #0b4dbb;
  --cyan: #04beea;
  --text: #22314c;
  --muted: #60708d;
  --line: #dce5f1;
  --surface: #ffffff;
  --error: #c2413a;
}

* {
  box-sizing: border-box;
}

/* Jedna skala za celu stranu: sve mere ispod su u rem, pa se ceo ekran pomera
   zajedno sa korenom. 1280px -> 16px (kao pre), 1920px -> 18.7px, preko 2560px
   staje na 19px. Donja granica cuva citljivost na zumiranom laptopu. */
html {
  font-size: clamp(15px, 0.42vw + 10.6px, 19px);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--surface);
}

a {
  color: inherit;
}

/* Desna kolona ima gornju granicu — visak sirine ide plavoj strani, koja od
   rastezanja ne gubi (gradijent), za razliku od bele koja postaje praznina. */
.login-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(460px, 34vw, 640px);
  min-height: 100vh;
  min-height: 100dvh;
}

/* =========================================================
   LEVA STRANA — brend i poverenje
   ========================================================= */
.brand-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(30px, 4.4vh, 54px) clamp(34px, 3.4vw, 58px);
  color: #e6f1fb;
  /* poluprecnici u procentima panela, ne u px — na 2560px je ranije ostajala
     ravna tamna povrsina jer je gradijent od 880px pokrivao trecinu strane */
  background:
    radial-gradient(132% 65% at 8% 4%, var(--blue) 0%, transparent 60%),
    radial-gradient(84% 52% at 96% 96%, var(--cyan) 0%, transparent 55%),
    linear-gradient(158deg, var(--navy), var(--navy-deep) 82%);
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image: radial-gradient(#8fd7f5 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}

/* Visak visine ide na jedno mesto (ispod poruke), a ne u dve rupe kao kod
   space-between — na 1440p je razmak izmedju znaka i poruke isao do 383px. */
.brand-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(20px, 3.2vh, 40px);
  min-height: 100%;
}

/* --- lockup: znak + naziv + deskriptor --- */
.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.dpx-wordmark {
  display: block;
  width: 152px;
  height: 42px;
}

.brand-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.brand-name:empty {
  display: none;
}

.brand-descriptor {
  margin: 0;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: #79b8dd;
}

/* --- logo i naziv kupca, iznad forme na beloj strani --- */
.customer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eef3fa;
}

/* ako kupac nije postavio ni logo ni naziv, blok se ne prikazuje */
.customer-brand:not(:has(.customer-logo:not([hidden]))):not(:has(.customer-name:not(:empty))) {
  display: none;
}

.customer-logo img {
  display: block;
  height: 46px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
}

.customer-name {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.customer-name:empty {
  display: none;
}

/* --- poruka --- */
.brand-content {
  max-width: 46ch;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}

h1 {
  margin: 0 0 18px;
  max-width: 15ch;
  color: #ffffff;
  font-size: clamp(1.85rem, 2.6vw, 2.45rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.brand-description {
  margin: 0 0 32px;
  max-width: 44ch;
  font-size: 1rem;
  line-height: 1.7;
  color: #a5bdd8;
}

.pillars {
  display: grid;
  gap: 16px;
  max-width: 42ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pillars li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pillar-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--cyan);
  background: rgba(4, 190, 234, 0.16);
}

.pillar-text b {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.pillar-text em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #93aec9;
}

/* --- signali poverenja --- */
.brand-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.77rem;
  color: #82a0bd;
}

.brand-trust span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* =========================================================
   DESNA STRANA — forma
   ========================================================= */
.form-panel {
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vh, 40px) clamp(28px, 2.2vw, 40px);
  background: var(--surface);
}

.login-card {
  width: 100%;
  max-width: clamp(392px, 26vw, 470px);
}

.card-header {
  margin-bottom: 28px;
}

.card-kicker {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
}

h2 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.card-subtitle {
  margin: 0;
  font-size: 0.87rem;
  color: var(--muted);
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1f3252;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: #8fa2bd;
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 14px 0 40px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#password {
  padding-right: 44px;
}

.input-wrap input::placeholder {
  color: #8fa2bd;
}

.input-wrap input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(11, 77, 187, 0.14);
}

.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #8fa2bd;
  background: transparent;
  cursor: pointer;
}

.toggle-password:hover {
  color: var(--blue);
  background: #f2f6fc;
}

.toggle-password:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.toggle-password .icon-eye-off,
.toggle-password[aria-pressed="true"] .icon-eye {
  display: none;
}

.toggle-password[aria-pressed="true"] .icon-eye-off {
  display: block;
}

.form-group.has-error .input-wrap input {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(194, 65, 58, 0.1);
}

.error-message {
  min-height: 18px;
  margin: 6px 0 0;
  color: var(--error);
  font-size: 0.82rem;
  line-height: 1.35;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 22px;
  font-size: 0.86rem;
}

.remember-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.remember-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.forgot-link {
  border: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

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

/* =========================================================
   DIJALOG — zaboravljena lozinka
   ========================================================= */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(19, 35, 63, 0.5);
}

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

.dialog-card {
  width: 100%;
  max-width: 360px;
  padding: 26px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 48px rgba(6, 32, 90, 0.3);
}

.dialog-card h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.dialog-card p {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

.dialog-close-button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 9px;
  color: #ffffff;
  background: linear-gradient(180deg, #0d57ce, var(--navy));
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
}

.login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 9px;
  color: #ffffff;
  background: linear-gradient(180deg, #0d57ce, var(--navy));
  box-shadow: 0 8px 18px rgba(6, 32, 90, 0.26);
  font: inherit;
  font-weight: 700;
  font-size: 0.97rem;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.login-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(6, 32, 90, 0.3);
}

.login-button:disabled {
  cursor: wait;
  opacity: 0.9;
  transform: none;
}

.button-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.login-button.is-loading .button-text {
  display: none;
}

.login-button.is-loading .button-loader {
  display: block;
}

.form-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--error);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

.secure-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: #7787a1;
}

.card-footer {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid #eef3fa;
  font-size: 0.75rem;
  color: #93a2ba;
  text-align: center;
}

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

/* =========================================================
   RESPONZIVNO
   ========================================================= */
/* --- veliki ekran: kolona sa porukom se centrira u plavom panelu ---
   Bez ovoga tekst ostaje pribijen uz levu ivicu polja od skoro 2000 px, pa
   strana izgleda kao da nesto nedostaje. Ispod 1600 px se nista ne menja. */
@media (min-width: 1600px) {
  .brand-inner {
    max-width: 50ch;
    margin-inline: auto;
  }
}

/* --- nizak ekran: laptop na 125–150% zuma, gde visina padne ispod 800px ---
   Dve kolone ostaju (slaganje bi visinu jos povecalo); skuplja se sadrzaj
   plave strane, jer je forma ta koja mora ostati cela iznad pregiba. */
@media (min-width: 769px) and (max-height: 800px) {
  .brand-description {
    display: none;
  }

  .pillars {
    gap: 12px;
  }

  .card-header {
    margin-bottom: 20px;
  }
}

@media (min-width: 769px) and (max-height: 660px) {
  .pillars {
    display: none;
  }

  .brand-lockup {
    gap: 6px;
  }

  /* Logo i naziv kupca jedan pored drugog umesto jedan ispod drugog: isti
     sadrzaj, 86 px -> ~46 px visine. */
  .customer-brand {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  .customer-logo img {
    height: 34px;
  }

  /* Natpis "Dobro dosli nazad" je ukras — naslov ispod njega nosi isto znacenje. */
  .card-kicker {
    display: none;
  }

  .form-group {
    margin-bottom: 12px;
  }

  /* Mesto za poruku o ishodu se ne cuva unapred; poruka se i dalje ispisuje. */
  .form-status {
    min-height: 0;
  }

  /* Signal o zastiti ostaje na plavoj strani (.brand-trust), koja je na ovoj
     sirini i dalje vidljiva — ne gubi se, samo se ne ponavlja. */
  .secure-note,
  .card-footer {
    display: none;
  }
}

@media (max-width: 768px) {
  .login-page {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .brand-panel {
    padding: 30px 24px 34px;
  }

  .brand-inner {
    gap: 22px;
  }

  /* na telefonu forma mora biti odmah dohvatljiva */
  .eyebrow,
  .brand-description,
  .pillars,
  .brand-trust {
    display: none;
  }

  h1 {
    margin: 0;
    max-width: 22ch;
    font-size: 1.5rem;
  }

  .form-panel {
    padding: 32px 24px 44px;
  }

  /* iOS zumira na fokus svako polje ispod 16px i ne vraca zum. Px, ne rem:
     koren je ovde 15px. */
  .input-wrap input {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  .brand-panel {
    padding: 24px 18px 28px;
  }

  .dpx-wordmark {
    width: 128px;
    height: 35px;
  }

  h1 {
    font-size: 1.32rem;
  }

  .form-panel {
    padding: 28px 18px 40px;
  }

  h2 {
    font-size: 1.42rem;
  }

  .form-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-button,
  .input-wrap input {
    transition: none;
  }

  .button-loader {
    animation-duration: 2s;
  }
}
