/* =========================================
   CSS VARIABLES - Override in theme.properties
   ========================================= */
:root {
  /* Typography */
  --bs-body-font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";

  /* Font Sizes - Default values (can be overridden per theme) */
  --font-title-desktop: 28px;
  --font-title-mobile: 22px;
  --font-base-desktop: 16px;
  --font-base-mobile: 14px;
  --font-caption-desktop: 14px;
  --font-caption-mobile: 12px;

  /* Colors - Default light theme (override in theme CSS) */
  --bs-danger-text: #ff8e8e;
  --base-color: #3C3C3C;
  --background-color: #FAFAFA;
  --border-color: #B4B4B4;
  --input-border-color: lightgray;
  --app-muted-color: #B4B4B4;

  /* Backgrounds & Images */
  --bg-image: url('../img/via-bg-white.png');

  /* Border Radius */
  --border-radius-xl: 40px;
  --border-radius-lg: 20px;
  --border-radius-md: 15px;
  --border-radius-sm: 5px;
  --border-radius-xs: 4px;

  /* Button Styles */
  --btn-primary-bg: linear-gradient(90deg, rgba(93, 205, 241, 0.75) 0%, #B3EFFF 51.5%, rgba(93, 205, 241, 0.75) 100%);
  --btn-outlined-border: #B3EFFF;
  --btn-outlined-bg: #fff;

  /* Component Specific */
  --page-bg: #FAFAFA;
  --page-border: 1px solid #B4B4B4;
  --menu-bg: #FAFAFA;
  --menu-border: 1px solid #B4B4B4;
  --modal-bg: #fff;
  --modal-text-color: #333;
  --hamburger-color: #666666;
}

/* =========================================
   GLOBAL RESET & BASE STYLES
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--bs-body-font-family);
}

a {
  text-decoration: none;
  color: var(--base-color);
}

a:hover {
  color: var(--base-color);
  text-decoration: none;
}

/* =========================================
   BODY & PAGE LAYOUT
   ========================================= */
.app-login body {
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  color: var(--base-color);
}

#kc-header {
  display: none;
}

#kc-page-title {
  margin: 1rem 0 !important;
}

.app-page {
  position: relative;
  padding: 2rem 2rem;
  width: 96%;
  text-align: center;
  border-radius: var(--border-radius-lg);
  background: var(--page-bg);
  border: var(--page-border);
  box-shadow: 1px 1px 7.4px 1px rgba(101, 101, 101, 0.26);
}

#kc-content {
  position: relative;
  height: 514px;
}

#kc-content-wrapper {
  margin-top: 5rem;
}

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1 {
  margin: 1rem 0;
  text-align: center;
  font-size: var(--font-title-mobile);
  font-style: normal;
  font-weight: 600;
  line-height: 30px;
}

p {
  font-size: var(--font-base-mobile);
}

.subtitle {
  display: none
}

.instruction {
  font-size: var(--font-base-mobile);
  font-weight: normal;
  max-width: 324px;
  margin: 0 auto;
}

/* =========================================
   FORMS & INPUTS
   ========================================= */
.form-control {
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-width: 324px;
  font-size: .9rem !important;
  --bs-form-control-bg: #fff;
  border-radius: var(--border-radius-sm);
  padding: 1.05rem .75rem;
  text-align: center;
  border: 2px solid var(--input-border-color);
}

input::placeholder {
  font-style: normal !important;
}

.form-control:focus {
  box-shadow: none;
  border-color: var(--border-color);
}

.form-label {
  display: none;
}

.invalid-feedback {
  display: block;
  width: 324px;
  margin: .5rem auto 1rem auto;
}

.invalid-feedback>a {
  color: #FF5353;
  text-decoration: underline;
  font-weight: 600;
}

.alert-error {
  max-width: 324px;
  margin: 0 auto;
  color: var(--bs-danger-text);
}

.spaced-input {
  letter-spacing: 0.3rem;
  font-family: monospace;
}

/* =========================================
   BUTTONS
   ========================================= */
.sign-in-btn {
  display: block;
  margin: 1rem auto;
  width: 100%;
  max-width: 325px;
  padding: 8px 7px;
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--base-color);
  font-size: var(--font-base-mobile);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s;
  background: var(--btn-primary-bg);
}

.sign-in-btn-outlined {
  display: block;
  margin: 1rem auto;
  width: 100%;
  max-width: 325px;
  padding: 6px 7px;
  border: 1.5px solid var(--btn-outlined-border);
  border-radius: var(--border-radius-sm);
  color: var(--base-color);
  font-size: var(--font-base-mobile);
  font-weight: 500;
  cursor: pointer;
  background-color: var(--btn-outlined-bg);
  transition: background-color 0.3s;
}



.sign-in-btn-outlined-small {
  display: block;
  margin: 2rem auto;
  padding: 1px 8px;
  border: 2.5px solid #808080;
  border-radius: var(--border-radius-sm);
  color: #808080;
  font-size: var(--font-base-mobile);
  font-weight: 500;
  cursor: pointer;
  background-color: #fff;
  transition: background-color 0.3s;
}

.btn-copy-qr {
  padding: 8px 20px;
  background: var(--primary-color);
  color: var(--background-color);
  font-size: var(--font-base-mobile);
  font-weight: 500;
  border: none;
  margin-top: 1rem;
}

.sign-out-btn-outlined {
  display: block;
  margin: 1rem auto;
  width: 100%;
  max-width: 325px;
  border: 2.5px solid #808080;
  padding: 6px 7px;
  border-radius: var(--border-radius-sm);
  color: var(--base-color);
  font-size: var(--font-base-mobile);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s;
  background-color: #fff;
}

.text-button {
  background: none;
  border: none;
  color: var(--base-color);
  font-size: var(--font-base-mobile);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  margin: 1rem auto;
  display: inline;
}

.text-button:hover {
  text-decoration: none;
}

.btn-disabled {
  background: #B4B4B4 !important;
  cursor: not-allowed;
}

.btn-loading::after {
  content: "Loading...";
  color: var(--base-color);
}

/* =========================================
   LOGO & BRANDING
   ========================================= */
.via-logo {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* =========================================
   QR CODE
   ========================================= */
.qr-box {
  margin: 2rem auto 0 auto;
  width: 100%;
  max-width: 325px;
  height: 100%;
  max-height: 325px;
  background-color: #f0f0f0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: .1rem;
  aspect-ratio: 1 / 1;
}

.qr-code-loading {
  margin: 0 auto;
  width: 100%;
  height: 100%;
  background-color: #e0e0e0;
  position: relative;
  overflow: hidden;
}

#qr-code img {
  margin: 0 auto;
}

.qr-code-loading::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0.2) 20%,
      rgba(255, 255, 255, 0.5) 60%,
      rgba(255, 255, 255, 0));
  animation: shimmer 1000ms infinite;
}

/* =========================================
   HAMBURGER MENU
   ========================================= */
#menu-icon {
  position: absolute;
  top: .8rem;
  right: 20px;
  font-size: 24px;
  color: #333;
}

.hamburger {
  display: inline-block;
  cursor: pointer;
  width: 30px;
  height: 22px;
  position: relative;
  z-index: 2;
}

.hamburger span {
  background: var(--hamburger-color);
  display: block;
  height: 4px;
  margin: 4px 0;
  border-radius: 2px;
  transition: 0.3s ease;
}

.menu-popup {
  position: absolute;
  top: 70px;
  border-radius: var(--border-radius-md);
  background: var(--menu-bg);
  border: var(--menu-border);
  box-shadow: 1px 1px 7.4px 1px rgba(101, 101, 101, 0.26);
  right: 20px;
  padding: 12px 3rem 12px 1.5rem;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.menu-popup ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-popup li {
  margin: 8px 0;
}

.menu-popup a {
  text-decoration: none;
  color: var(--base-color);
  font-weight: normal;
  font-size: var(--font-base-mobile);
}

.menu-popup.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* =========================================
   REGISTRATION & NAVIGATION LINKS
   ========================================= */
#kc-registration {
  font-size: var(--font-base-mobile);
  color: var(--base-color);
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  bottom: 0;
  width: 100%;
}

#kc-registration a {
  color: var(--base-color);
  font-weight: 600;
  text-decoration: none;
}

.back-to-login {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  bottom: 0;
  width: 100%;
}

#kc-form-options span {
  font-size: var(--font-base-mobile);
  color: var(--base-color);
}

#kc-form-options span a {
  color: var(--base-color);
  font-weight: bold;
  text-decoration: none;
}

#kc-logout-confirm>#kc-info-message {
  display: block;
  margin: 1rem auto;
  width: 100%;
  max-width: 325px;
  padding: 7px;
  border: 1px solid #B3EFFF;
  border-radius: var(--border-radius-sm);
  color: var(--base-color);
  font-size: var(--font-caption-mobile);
  font-weight: 600;
  cursor: pointer;
  background-color: #fff;
  transition: background-color 0.3s;
}

#kc-logout-confirm>#kc-info-message>p {
  margin: 0 auto !important;
}

#kc-logout-confirm>#kc-info-message>p>a {
  color: var(--base-color);
  text-decoration: none;
}

/* =========================================
   TERMS & CONDITIONS
   ========================================= */
#tnc-login {
  position: absolute;
  bottom: -5rem;
  font-size: 12px !important;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

#tnc-login p a {
  color: #5F5F5F !important;
  font-size: var(--font-base-mobile) !important;
  font-weight: 600 !important;
}

#tnc-login p {
  font-size: var(--font-base-mobile) !important;
}

#tnc-register {
  margin: 0 auto;
  font-size: 12px !important;
  max-width: 324px;
  text-align: center;
}

#tnc-register p a {
  color: #5F5F5F !important;
  font-size: var(--font-base-mobile);
  font-weight: 600 !important;
}

#tnc-register p {
  font-size: var(--font-base-mobile);
}

.trouble-signing-in {
  text-align: center;
  position: absolute;
  bottom: -5rem;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

/* =========================================
   MODALS
   ========================================= */
.custom-modal-overlay {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.custom-modal-download-content {
  background-color: var(--modal-bg);
  margin: 10% auto;
  padding: 30px;
  border-radius: var(--border-radius-xl);
  width: 100%;
  max-width: 583px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  font-family: inherit;
  color: var(--modal-text-color);
  text-align: center;
}

.custom-modal-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 20px;
  line-height: 1;
}

.custom-modal-close:hover,
.custom-modal-close:focus {
  text-decoration: none;
}

.custom-modal-download-title {
  font-size: var(--font-title-desktop);
  font-weight: 600;
  line-height: 34px;
  margin: 2rem 0;
  text-align: center;
}

.custom-modal-list {
  list-style-type: disc;
  padding-left: 20px;
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.5;
}

.custom-modal-list li {
  margin-bottom: 15px;
}

.custom-modal-sublist {
  list-style-type: disc;
  margin-top: 5px;
  padding-left: 20px;
}

.custom-modal-sublist li {
  margin-bottom: 5px;
}

.custom-modal-footer {
  font-size: 16px;
  line-height: 1.5;
  margin-top: 20px;
  color: #555;
}

.store-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 50px;
  margin-top: 2rem;
}

/* =========================================
   KEYCLOAK DEFAULT OVERRIDES
   ========================================= */
.card-pf {
  background: none;
  border-top: none;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  50% {
    transform: translateX(5px);
  }

  75% {
    transform: translateX(-5px);
  }

  100% {
    transform: translateX(0);
  }
}

/* =========================================
   DESKTOP RESPONSIVE (768px+)
   ========================================= */
@media screen and (min-width: 768px) {
  h1 {
    margin: 2rem 0;
    font-size: var(--font-title-desktop);
    line-height: 34px;
  }

  p {
    font-size: var(--font-base-desktop);
  }

  .app-page {
    border-radius: var(--border-radius-xl);
    width: 95%;
    max-width: 583px;
  }

  .menu-popup {
    top: 60px;
    border-radius: var(--border-radius-lg);
  }

  .menu-popup a {
    font-size: var(--font-base-desktop);
  }

  #kc-content {
    position: relative;
    height: 584px;
  }

  .via-logo {
    position: absolute;
    top: 15px;
    left: 19px;
    transform: translate(0, 0);
  }

  .qr-box {
    margin: 1rem auto 0 auto;
    width: 100%;
    max-width: 325px;
    height: 100%;
    max-height: 325px;
  }

  #kc-registration {
    font-size: var(--font-base-desktop);
  }

  .sign-in-btn-outlined {
    font-size: var(--font-caption-desktop);
  }

  .sign-in-btn-outlined-small {
    font-size: var(--font-caption-desktop);
  }

  .sign-out-btn-outlined {
    font-size: var(--font-caption-desktop);
  }

  .sign-in-btn {
    font-size: var(--font-caption-desktop);
  }

  #kc-form-options span {
    font-size: var(--font-base-desktop);
  }

  .instruction {
    font-size: var(--font-base-desktop);
  }

  #kc-logout-confirm>#kc-info-message {
    font-size: var(--font-caption-desktop);
  }

  .text-button {
    font-size: var(--font-base-desktop);
  }
}

#qr-code-download {
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

#enter-pin-subtitle {
  display: none;
}


.cac-login {
  margin: 5rem auto 0 auto;
  position: relative;
  max-width: 325px;
  width: 100%;
}

.cac-login-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  text-decoration: none;
  color: white;
}

.cac-login-btn::after {
  content: "Please ensure your CAC is inserted into the reader and recognized by your system before you continue.";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  text-align: center;
  font-size: var(--font-caption-mobile);
  color: var(--bs-danger-text);
  margin-top: 0.5rem;
  width: 325px;
  box-sizing: border-box;
  white-space: normal;
}

.cac-login-btn:hover::after {
  opacity: 1;
  visibility: visible;
}