:root {
  --tsa-blue: #004bb8;
  --tsa-blue-dark: #102a4c;
  --tsa-light-blue: #8faee0;
  --glass-bg: rgba(11, 35, 66, 0.48);
  --glass-bg-mobile: rgba(7, 26, 51, 0.82);
  --glass-border: rgba(255, 255, 255, 0.32);
  --text-white: rgba(255, 255, 255, 0.96);
  --text-soft: rgba(255, 255, 255, 0.78);
  --field-bg: rgba(255, 255, 255, 0.08);
  --page-pad-x: clamp(16px, 4vw, 42px);
  --page-pad-y: clamp(18px, 4vh, 48px);
  --card-radius: clamp(16px, 2.5vw, 24px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Arial, sans-serif;
}

html {
  min-height: 100dvh;
}

body {
  min-height: 100dvh;
  background: #071a33;
  overflow-x: hidden;
}

.login-bg-photo {
  position: fixed;
  inset: 0;
  z-index: -4;

  background-image: url("data/img/dadi.avif");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 18, 38, 0.18), rgba(5, 18, 38, 0.62)),
    radial-gradient(circle at 50% 20%, rgba(31, 79, 154, 0.10), rgba(5, 18, 38, 0.42));
  z-index: -3;
}

.login-glow {
  position: fixed;
  width: clamp(70px, 10vw, 180px);
  height: 120vh;
  background: rgba(255, 255, 255, 0.10);
  transform: rotate(28deg);
  z-index: -2;
  pointer-events: none;
}

.login-glow-left {
  top: -10vh;
  left: -70px;
}

.login-glow-right {
  right: -80px;
  bottom: -20vh;
}

.login-brand {
  position: fixed;
  top: clamp(10px, 2vh, 22px);
  left: clamp(16px, 5vw, 180px);
  z-index: 4;
  display: flex;
  align-items: center;
  pointer-events: none;
  animation: fadeIn 550ms ease-out both;
}

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--page-pad-y) + clamp(34px, 7vh, 76px)) var(--page-pad-x) var(--page-pad-y);
}

.login-hero {
  width: min(100%, 620px);
  max-height: calc(100dvh - (var(--page-pad-y) * 2));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-white);
  animation: fadeIn 550ms ease-out both;
}

.tsa-logo {
  width: clamp(180px, 22vw, 360px);
  max-height: clamp(54px, 10vh, 86px);
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.32));
}

h1 {
  margin: 0 0 clamp(22px, 3.2vh, 34px) 0;
  color: var(--text-white);
  font-size: clamp(54px, 7vw, 86px);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-subtitle {
  margin: clamp(8px, 1.5vh, 14px) 0 clamp(16px, 3vh, 28px);
  color: var(--text-white);
  font-size: clamp(15px, 1.8vw, 27px);
  letter-spacing: 0.03em;
  text-shadow: 0 5px 22px rgba(0, 0, 0, 0.50);
}

.login-card {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: clamp(20px, 3.2vw, 34px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.form-group {
  text-align: left;
  margin-bottom: clamp(14px, 2.2vh, 22px);
}

label {
  display: block;
  margin: 0 0 8px;
  color: var(--text-white);
  font-size: clamp(14px, 1.25vw, 17px);
  font-weight: 650;
  letter-spacing: 0.01em;
}

input {
  width: 100%;
  height: clamp(46px, 6vh, 58px);
  padding: 0 clamp(14px, 2vw, 18px);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 10px;
  background: var(--field-bg);
  color: white;
  font-size: clamp(16px, 1.4vw, 18px);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input:focus {
  border-color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 0 0 4px rgba(143, 174, 224, 0.20);
}

button {
  width: 100%;
  min-height: clamp(50px, 6.5vh, 64px);
  margin-top: clamp(4px, 1vh, 8px);
  padding: 0 clamp(16px, 2.4vw, 22px);
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #0077ff, #003ea8);
  color: white;
  font-size: clamp(18px, 2vw, 23px);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 64, 180, 0.45);
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

button span {
  float: right;
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 0.8;
  font-weight: 400;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(0, 64, 180, 0.52);
}

button:active {
  transform: translateY(0);
}

.error {
  margin-top: clamp(12px, 2vh, 18px);
  padding: 12px 14px;
  color: #fff;
  background: rgba(215, 25, 32, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 10px;
  font-size: clamp(14px, 1.2vw, 16px);
  font-weight: 700;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .login-hero {
    width: min(100%, 560px);
  }

  .login-card {
    width: min(100%, 480px);
  }
}

@media (max-width: 640px) {
  :root {
    --page-pad-x: 16px;
    --page-pad-y: 16px;
  }

  .login-page {
    align-items: stretch;
    justify-items: stretch;
    min-height: 100svh;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .login-hero {
    width: 100%;
    min-height: calc(100svh - 36px);
    max-height: none;
    justify-content: center;
  }

  .login-bg-video {
    opacity: 0.62;
  }

  .login-overlay {
    background:
      linear-gradient(180deg, rgba(4, 16, 34, 0.30), rgba(4, 16, 34, 0.86)),
      radial-gradient(circle at 50% 10%, rgba(31, 79, 154, 0.20), rgba(5, 18, 38, 0.62));
  }

  .login-glow {
    display: none;
  }

  .login-brand {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    left: 16px;
  }

  /* Mobile keyboard: hide the TSA logo completely while the login form
     contains keyboard focus, so it can never overlap Mælisjá TSÁ. */
  body:focus-within .login-brand {
    display: none;
  }

  .tsa-logo {
    width: min(46vw, 210px);
    max-height: 62px;
  }

  h1 {
    font-size: clamp(38px, 12vw, 52px);
  }

  .login-subtitle {
    margin: 8px 0 18px;
    font-size: clamp(14px, 4.2vw, 18px);
  }

  .login-card {
    width: 100%;
    padding: 20px 18px 22px;
    background: var(--glass-bg-mobile);
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.40);
  }

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

  label {
    font-size: 14px;
  }

  input {
    height: 48px;
    font-size: 16px;
  }

  button {
    min-height: 52px;
    font-size: 18px;
  }
}

@media (max-width: 380px) {
  .login-card {
    padding: 18px 15px 20px;
  }
}

@media (max-height: 720px) and (min-width: 641px) {
  .login-page {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .tsa-logo {
    width: clamp(170px, 20vw, 320px);
    max-height: 72px;
  }

  .login-subtitle {
    margin-bottom: 16px;
  }

  .login-card {
    padding-top: 22px;
    padding-bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------
   Client selector popup
   --------------------------------------------------------- */

.client-selector-backdrop[hidden] {
  display: none;
}

.client-selector-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  background: rgba(3, 15, 31, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: selectorBackdropIn 220ms ease-out both;
}

body.client-selector-open {
  overflow: hidden;
}

.client-selector {
  width: min(100%, 760px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: clamp(22px, 4vw, 38px);
  color: var(--text-white);
  background:
    linear-gradient(145deg, rgba(15, 45, 82, 0.82), rgba(7, 27, 54, 0.72));
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  animation: selectorCardIn 260ms ease-out both;
}

.client-selector-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(22px, 3.5vw, 32px);
  text-align: left;
}

.client-selector-kicker {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.client-selector h2 {
  margin: 0;
  color: var(--text-white);
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.client-selector-heading p {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.5;
}

.client-selector-logout {
  flex: 0 0 auto;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 10px;
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.client-selector-logout:hover,
.client-selector-logout:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.65);
  transform: translateY(-1px);
  outline: none;
}

.client-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 18px);
}

.client-option {
  position: relative;
  min-height: 176px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 15px;
  color: var(--tsa-blue-dark);
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 14px 32px rgba(0, 24, 72, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  text-decoration: none;
  overflow: hidden;
  transition:
    transform 170ms ease,
    background 170ms ease,
    box-shadow 170ms ease,
    border-color 170ms ease;
}

.client-option::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.32),
    rgba(143, 174, 224, 0.08)
  );
}

.client-option:hover,
.client-option:focus-visible {
  transform: translateY(-3px);
  background: #fff;
  border-color: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 20px 44px rgba(0, 31, 95, 0.38),
    0 0 0 4px rgba(143, 174, 224, 0.18);
  outline: none;
}

.client-option:active {
  transform: translateY(0);
}

.client-option-logo-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.client-option-logo {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 250px;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 3px 6px rgba(0, 25, 65, 0.24));
  transition: transform 170ms ease;
}

.client-option:hover .client-option-logo,
.client-option:focus-visible .client-option-logo {
  transform: scale(1.035);
}

.client-option-logo-fallback {
  color: var(--tsa-blue-dark);
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.1;
  text-align: center;
}

.client-option-arrow {
  position: absolute;
  right: 14px;
  bottom: 10px;
  z-index: 2;
  color: rgba(0, 75, 184, 0.72);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  transition: transform 170ms ease, color 170ms ease;
}

.client-option:hover .client-option-arrow,
.client-option:focus-visible .client-option-arrow {
  color: var(--tsa-blue);
  transform: translateX(3px);
}

.client-selector-loading,
.client-selector-empty {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
  line-height: 1.5;
}

.client-selector-user {
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  text-align: center;
}

@keyframes selectorBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes selectorCardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .client-selector-backdrop {
    align-items: center;
    background: rgba(3, 15, 31, 0.60);
  }

  .client-selector {
    width: 100%;
    max-height: calc(100svh - 32px);
    padding: 22px 18px;
    background:
      linear-gradient(145deg, rgba(10, 36, 70, 0.94), rgba(5, 23, 48, 0.92));
  }

  .client-selector-heading {
    gap: 14px;
    margin-bottom: 20px;
  }

  .client-selector-logout {
    min-height: 38px;
    padding: 0 12px;
  }

  .client-options {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .client-option {
    min-height: 132px;
    padding: 16px 22px;
  }

  .client-option-logo-frame {
    height: 92px;
  }

  .client-option-logo {
    max-width: 220px;
  }
}

@media (max-width: 420px) {
  .client-selector-heading {
    flex-direction: column;
  }

  .client-selector-logout {
    align-self: flex-start;
  }
}

