/*
 * Custom stylesheet for the Login Gateway UI.
 * Loaded after MDBootstrap so rules here can override the default theme.
 * Add project-specific branding and layout tweaks here.
 */

:root {
  --color-primary: #26686f;
  --color-primary-text: #26686f;
  --color-primary-muted: #2d575c;
  --color-primary-highlight: #34777d97;
  --color-muted: #f1f1f1;
  --color-border: #e5e5e5;
  --color-muted-foreground: #4f4f4fbf;
  --color-surface: #fff;
  --color-heading: #14282a;
  --color-icon-bg: #f1f3f6;
  --color-icon-bg-alt: #f6f6f6;
  --color-body-bg: oklch(92.002% 0.00548 286.013 / 0.3);
  --color-thumb-bg: #d9d9d9;
  --color-thumb-fg: #ac7903;
  --color-footer-link: #d5e0ec;
  --color-link-hover: #2d575c;
  --color-test-banner-bg: #f5e0cfa6;
  --color-test-banner-text: #92400e;
}

[data-mdb-theme="dark"] {
  --color-primary: #214144;
  --color-primary-text: #2d848c;
  --color-primary-muted: #4a8a91;
  --color-primary-highlight: #285c614d;
  --color-muted: #2c2c2e;
  --color-border: #363638;
  --color-muted-foreground: oklch(0.705 0.012 286.07 / 0.8);
  --color-surface: #232629;
  --color-heading: #eef1f2;
  --color-icon-bg: #33363a;
  --color-icon-bg-alt: #2e3134;
  --color-body-bg: #1e2123;
  --color-thumb-bg: #49494a;
  --color-thumb-fg: #f0b429;
  --color-footer-link: #a9c2da;
  --color-link-hover: #4a8a91;
  --color-test-banner-bg: #3a2a1a;
  --color-test-banner-text: #f0b429;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mdb-theme="light"]):not([data-mdb-theme="dark"]) {
    --color-primary: #1b4d52;
    --color-primary-muted: #4a8a91;
    --color-primary-highlight: #34777d4d;
    --color-muted: #2c2c2e;
    --color-muted-foreground: oklch(0.705 0.012 286.07 / 0.8);
    --color-surface: #232629;
    --color-heading: #eef1f2;
    --color-icon-bg: #33363a;
    --color-icon-bg-alt: #2e3134;
    --color-body-bg: #16181a;
    --color-thumb-bg: #49494a;
    --color-thumb-fg: #f0b429;
    --color-footer-link: #a9c2da;
    --color-link-hover: #8fb8e0;
    --color-test-banner-bg: #3a2a1a;
    --color-test-banner-text: #f0b429;
  }
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-Variable.ttf") format("truetype-variations");
  font-weight: 100 700;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: "IBM Plex Sans", var(--mdb-font-roboto), sans-serif;
  background-color: var(--color-body-bg);
}

h1,
h2 {
  color: var(--color-heading);
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.35rem;
  font-weight: 600;
}

footer {
  position: relative;
  overflow: hidden;
  background-color: var(--color-primary);
  color: #fefefe;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;

  a {
    color: var(--color-footer-link);
  }

  > a,
  > span {
    position: relative;
    z-index: 1;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.legal-page {
  h1 {
    margin-bottom: 1.5rem;
  }

  h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
  }

  h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
  }
}

nav {
  background-color: var(--color-primary);
}
.nav-content {
  padding: 0 1.5rem;
}

.test-env-banner {
  background-color: var(--color-test-banner-bg);
  color: var(--color-test-banner-text);
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
}

.muted {
  color: var(--color-primary-muted);
}

.brand-name {
  font-size: 1.2rem;
}

.heading-login {
  font-size: 1.5rem;
}

.link {
  /* color: var(--color-heading); */
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

/* Home page hero */
.hero-tag {
  font-family: var(--mdb-font-monospace);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-primary-muted);
}

.hero-description {
  max-width: 30rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mdb-secondary-color, #6c757d);
}

.requirements-card {
  border-radius: 0.75rem;
  overflow: hidden;
  background-color: var(--color-surface);
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
}

.requirement-item {
  padding: 0.25rem 0;
  height: 100%;
}

.requirement-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  background-color: var(--color-icon-bg);
  color: var(--color-primary-muted);
  font-size: 1.2rem;
}

/* Center heading next to the icon when there is no subtitle link */
.requirement-item > .d-flex:not(:has(.requirement-link)) {
  align-items: center !important;
}

.requirement-item > .d-flex:not(:has(.requirement-link)) .requirement-icon {
  margin-top: 0;
}

.custom-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 6.75rem;
  height: 6.75rem;
  border-radius: 0.5rem;
  background-color: var(--color-icon-bg-alt);
}

/* Login page header logo */
.login-logo-box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 0.5rem;
  background-color: var(--color-icon-bg-alt);
}

.login-logo-box img {
  max-width: 70%;
  max-height: 70%;
}

.card-wrapper {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

/* QR/wallet login card */
.login-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: 0.75rem;
  overflow: hidden;
}

.login-card-secondary {
  border-color: var(--color-border);
}

.login-card-header-accent {
  position: relative;
  display: flex;
  align-items: center;
  color: #fefefe;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0 1.25rem;
  overflow: hidden;
  background-color: var(--color-primary);
}

.login-card-header-accent-with-text {
  height: 2.875rem;
}

.login-card-header-accent-without-text {
  height: 1.875rem;
}

.login-card-header-accent-text {
  position: relative;
  z-index: 1;
}

.password-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem; /* ~44px touch target */
  max-width: 2.75rem;
  padding: 0 0.75rem;
  border: var(--mdb-border-width) solid var(--mdb-border-color);
  border-radius: 0 0.5rem 0.5rem 0;
  background-color: var(--mdb-body-bg);
  color: var(--color-primary-text);
  touch-action: manipulation;
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* Edge shows its own reveal eye on password fields */
input[type="password"]::-ms-reveal {
  display: none;
}

.back-link {
  color: var(--color-primary-text);
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  color: var(--color-link-hover);
}

.login-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background-color: var(--color-primary);
  color: #fefefe;
  font-weight: 700;
  font-size: 1.1rem;
}

.login-card-body {
  padding: 1.5rem;
}
.login-card-paragraph {
  margin-top: -1rem;
}

.qr-box {
  background-color: var(--color-icon-bg-alt);
  border-radius: 0.5rem;
  padding: 2rem 0.25rem;
}

.qr-box-plain {
  background-color: transparent;
  padding-top: 0.5rem;
}

.qr-expiry {
  font-size: 0.85rem;
  color: var(--mdb-secondary-color, #6c757d);
}

.btn-open-app {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: fit-content;
  padding: 0.25rem 0.75rem;
  color: var(--color-muted-foreground);
  border-radius: 0.5rem;
  text-decoration: none;
}

.btn-open-app:hover {
  color: var(--color-primary);
}

.login-card-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background-color: transparent;
  border: none;
  color: var(--color-heading);
  text-align: left;
}

.login-card-toggle-icon {
  flex-shrink: 0;
  color: var(--mdb-secondary-color, #6c757d);
  transition: transform 0.2s ease;
}

.form-control,
.form-select {
  border-radius: 0.5rem;
}

.btn-login-submit {
  padding: 0.5rem 1rem;
  width: 100%;
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  background-color: var(--color-primary);
  color: #fefefe;
  font-weight: 600;
}

.requirement-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--mdb-secondary-color, #6c757d);
  text-decoration: underline;
}

.requirement-link:hover {
  color: var(--color-link-hover);
}

.vertical-divider {
  display: inline-block;
  width: 1px;
  height: 1.2em;
  margin: 0 0.75rem;
  background-color: currentColor;
  opacity: 0.3;
  vertical-align: middle;
}

.horizontal-divider {
  border: none;
  border-top: 1px solid currentColor;
  height: 0;
  margin: 0.75rem 0;
  opacity: 0.09;
}

.custom-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  width: 100%;
  display: flex;
  padding: 0.8rem;
  gap: 0.75rem;
}

.custom-card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.custom-card-textblock {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.custom-card h3 {
  color: var(--color-heading);
}

.cta {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem;
  gap: 1rem;
  color: #fefefe;

  h3 {
    font-weight: 600;
  }
  p {
    max-width: 35rem;
  }

  > div,
  > a {
    position: relative;
    z-index: 1;
  }
}

.cta-button {
  background-color: var(--color-muted);
  padding: 10px 20px;
  border: 1px solid var(--color-primary-muted);
  border-radius: 6px;
  font-weight: 600;
  color: var(--color-primary-text);
  max-height: fit-content;
}

.cta-button:hover {
  background-color: var(--color-surface);
}

/* Dark mode pill toggle (sun/moon) */
.theme-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
}

.theme-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.theme-switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 63px;
  height: 32px;
  border-radius: 999px;
  background-color: var(--color-primary-muted);
  transition: background-color 0.3s ease;
}

.theme-switch-track-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--color-muted);
  opacity: 0.85;
}

.theme-switch-track-icon-start {
  left: 9px;
  bottom: 2px;
}

.theme-switch-track-icon-end {
  right: 10px;
  bottom: 2px;
}

.theme-switch-thumb {
  position: absolute;
  left: 3px;
  width: 29px;
  height: 27px;
  border-radius: 47%;
  background-color: var(--color-thumb-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-thumb-fg);
  font-size: 0.9rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s ease;
}

.theme-switch-input:checked ~ .theme-switch-track .theme-switch-thumb {
  transform: translateX(29px);
}

/* Decorative skewed highlight stripes on the navbar */
.navbar-highlighted {
  position: relative;
}

.navbar-highlighted > .container-fluid {
  position: relative;
  z-index: 1;
}

.navbar-highlight-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.navbar-highlight {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 23%;
  width: 2%;
  background-color: var(--color-primary-highlight);
  transform: skewX(-28deg);
}

.navbar-highlight-big {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -2%;
  width: 24%;
  background-color: var(--color-primary-highlight);
  transform: skewX(-28deg);
}

.cta-highlight-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.cta-highlight {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 31%;
  width: 1.5%;
  background-color: var(--color-primary-highlight);
  transform: skewX(-28deg);
}

.cta-highlight-huge {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -7%;
  width: 36%;
  background-color: var(--color-primary-highlight);
  transform: skewX(-28deg);
}

/* Decorative skewed highlight stripes on the footer */
.footer-highlight-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.footer-highlight {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3.5%;
  width: 1%;
  background-color: var(--color-primary-highlight);
  transform: skewX(-28deg);
}

.footer-highlight-big {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -2%;
  width: 5%;
  background-color: var(--color-primary-highlight);
  transform: skewX(-28deg);
}

/* ==========================================================
   Mobile styling
   ========================================================== */
@media (max-width: 767.98px) {
  .nav-content {
    padding: 0 1rem;
    flex-wrap: nowrap;
  }

  footer {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  .nav-content .d-flex.align-items-center.gap-4 {
    gap: 1rem !important;
  }

  .theme-switch-track {
    width: 52px;
    height: 27px;
  }

  .theme-switch-thumb {
    width: 24px;
    height: 22px;
  }

  .theme-switch-input:checked ~ .theme-switch-track .theme-switch-thumb {
    transform: translateX(24px);
  }

  .hero-tag {
    font-size: 0.7rem;
  }

  .hero-description {
    max-width: none;
  }

  .requirements-card {
    padding: 0.75rem;
  }

  .cta {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
    border-radius: 0%;
  }

  .cta-button {
    width: 100%;
    text-align: center;
  }

  .cta-highlight {
    display: none;
  }

  .cta-highlight-huge {
    position: absolute;
    top: 0;
    bottom: 0;
    right: -29%;
    width: 36%;
    background-color: var(--color-primary-highlight);
    transform: skewX(-28deg);
  }

  .login-actions {
    flex-direction: column;
    gap: 0.25rem;
  }

  .login-actions > .vertical-divider {
    display: none;
  }

  .btn-open-app-primary {
    width: 100%;
    justify-content: center;
    padding: 0.6rem 1rem;
    background-color: var(--color-primary);
    color: #fefefe;
    border-color: var(--color-primary);
  }
}
