/*
 * ===================================================================
 * Scoped Styling for the Petrol Go App registration form
 * By using #petrol-go-app, these styles are isolated.
 * ===================================================================
 */

#petrol-go-app {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background-color: #ffffff;
  gap: 24px;
}

/* --- Main Visual Frame --- */
#petrol-go-app .registration__sso-frame {
  width: 100%;
  max-width: 480px;
  background-color: #ffffff;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08);
}

#petrol-go-app .registration__sso-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;

  height: auto;
  min-height: initial;

  padding: 0 1em 0 1em;
}

#petrol-go-app .registration__sso {
  box-shadow: none;
  padding: 0 0 0 0;
  box-shadow: none;
  overflow: visible;
}

/* --- Header: Logo and Language Selector --- */
#petrol-go-app .registration__sso-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 1em 0 0;
  height: 24px;
}

@media screen and (max-width: 480px) {
  #petrol-go-app {
    gap: 20px;
    padding: 16px 12px;
  }
}

#petrol-go-app .form-item label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  padding: 3px 8px 3px 8px;
}

#petrol-go-app .form-item.form-item--checkbox.registration__step-agree label {
  padding: 2px 0 0 36px;
  font-size: 14px;
  font-weight: 400;
}

/* CHECKBOX STYLES START */
/* 1. The main container for layout and alignment */
#petrol-go-app .form-item--checkbox {
  display: flex;
  cursor: default;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  flex-direction: column;
}

/* 2. The label needs to be relative to position the swoosh inside */
#petrol-go-app .form-item--checkbox label {
  position: relative;
  display: flex;
  align-items: center;
  pointer-events: none;
}

/* 3. Hide the original browser checkbox */
#petrol-go-app .form-item--checkbox input[type="checkbox"] {
  position: absolute;
  cursor: pointer;
  height: 0;
  width: 0;
  margin: 0;
}

/* --- The Custom Checkbox Visuals --- */

/* 4. The circular box (::before) in its default, unchecked state */
#petrol-go-app .form-item--checkbox label::before {
  content: "";
  box-sizing: border-box;
  flex-shrink: 0; /* Prevents shrinking */

  /* Appearance */
  width: 24px;
  height: 24px;
  border-radius: 100px; /* Makes it a circle */
  border: 1px solid #d1d1d1;

  /* Smooth transition for color changes */
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

/* 5. The white "swoosh" (::after), hidden by default */
#petrol-go-app .form-item--checkbox label::after {
  content: "";
  box-sizing: border-box;

  position: absolute;
  cursor: pointer;
  height: 0;
  width: 0;
  margin: 0;

  /* Shape & Color */
  width: 13px;
  height: 8px;
  border-left: 3px solid #ffffff;
  border-bottom: 3px solid #ffffff;

  /* Positioning & Rotation */
  position: absolute;
  left: 6px;
  top: 8px;
  transform: rotate(-45deg);

  background: transparent;
}

#petrol-go-app .form-item--checkbox label::before,
#petrol-go-app .form-item--checkbox label::after {
  pointer-events: auto;
  cursor: pointer;
}

#petrol-go-app .form-item--checkbox label a,
#petrol-go-app .form-item--checkbox label a * {
  pointer-events: auto;
}

#petrol-go-app .form-item.is-error input[type="checkbox"] ~ label::before,
#petrol-go-app .form-item.is-error input[type="radio"] ~ label::before {
  background-color: transparent !important;
  background: transparent !important;
  border-color: #db0f18 !important;
}

@media print, screen and (min-width: 64em) {
  #petrol-go-app input[type="checkbox"] ~ label:hover::before,
  #petrol-go-app input[type="radio"] ~ label:hover::before {
    background-image: -webkit-gradient(
      linear,
      left top,
      right top,
      color-stop(22%, #bd0009),
      color-stop(79%, #db0f18)
    );
    background-image: linear-gradient(90deg, #bd0009 22%, #db0f18 79%);
    border-color: #db0f18;
  }
}

/* --- Checked State --- */

/* 6. Change the circle's background and border when checked */
#petrol-go-app
  .form-item--checkbox
  input[type="checkbox"]:checked
  + label::before {
  background-image: -webkit-gradient(
    linear,
    left top,
    right top,
    color-stop(22%, #bd0009),
    color-stop(79%, #db0f18)
  );
  background-image: linear-gradient(90deg, #bd0009 22%, #db0f18 79%);
  border-color: #db0f18;
}

/* 7. Show the swoosh when checked */
#petrol-go-app
  .form-item--checkbox
  input[type="checkbox"]:checked
  + label::after {
  display: block;
}

/* CHECKBOX STYLES END */

#petrol-go-app .registration_sso-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0px 8px;
  align-self: stretch;
  gap: 4px;
  margin-bottom: 2em;
}

#petrol-go-app .registration_sso-title p {
  margin: 0;
  color: #000000;
  margin: 0;
}

#petrol-go-app .already-registered {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: center;
}

#petrol-go-app .already-registered a {
  color: #db0f18;
}

#petrol-go-app input {
  box-sizing: border-box;

  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 20px 16px;
  gap: 12px;

  /* Grayscale/White FFFFFF */
  background: #ffffff;
  /* Grayscale/Gray D1D1D1 */
  border: 1px solid #d1d1d1;
  /* shadow/row_light */
  box-shadow:
    0px 0px 4px rgba(0, 0, 0, 0.05),
    0px 4px 8px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  align-self: stretch;
}

#petrol-go-app input:not([type="checkbox"]):not([type="radio"]):focus {
  border-color: #005dbf;
  outline: 3px solid #005dbf;
  outline-offset: 0;
  box-shadow:
    0 0 0 3px #005dbf,
    0px 0px 4px rgba(0, 0, 0, 0.05),
    0px 4px 8px rgba(0, 0, 0, 0.05);
}

#petrol-go-app
  .form-item.is-error
  input:not([type="checkbox"]):not([type="radio"]) {
  border-color: #db0f18;
}

#petrol-go-app .registration__step-agree input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  appearance: none;
  border: 2px solid #db0f18;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.2s;
  vertical-align: middle;
}

#petrol-go-app .registration__step-agree input[type="checkbox"]:checked {
  background: #db0f18;
  box-shadow: 0 0 0 2px #fff inset;
}

#petrol-go-app .registration__step-buttons .button {
  /* Auto layout */
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 18px 16px;
  gap: 10px;
  width: 100%;
  /* Gradients/red */
  background-image: -webkit-gradient(
    linear,
    left top,
    right top,
    color-stop(22%, #bd0009),
    color-stop(79%, #db0f18)
  );
  background-image: linear-gradient(90deg, #bd0009 22%, #db0f18 79%);
  border-radius: 8px;
  float: none;
  margin-right: 0;
}

/* Register-only spacing exception */
#petrol-go-app #kc-register-form .registration__step-buttons {
  margin-top: 20px;
}

#petrol-go-app .registration__step-buttons .button.set-disabled,
#petrol-go-app .registration__step-buttons .button:disabled {
  background-image: none; /* Remove red gradient */
  background-color: #767676; /* Gray background */
  color: white;
  cursor: not-allowed; /* 'No entry' mouse cursor */
  border-color: transparent; /* Hide border if present */
}

#petrol-go-app
  .registration__step-buttons
  .button:not(.set-disabled):not(:disabled):not([aria-disabled="true"]):hover {
  background-image: none;
  background-color: #db0f18;
}

#petrol-go-app
  .registration__step-buttons
  .button:not(.set-disabled):not(:disabled):not([aria-disabled="true"]):active {
  background-image: none;
  background-color: #bd0009;
}

#petrol-go-app .social-provider-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin: 24px 36px;
}

#petrol-go-app .social-provider-label {
  margin: 0;
  text-align: center;
}

#petrol-go-app .social-provider-buttons a.button--outline.-wide.-has-icon {
  flex: 0 0 48px;
  width: 48px !important;
  min-width: 48px;
  max-width: 48px;
  height: 48px;
  margin: 0 !important;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  background-image: none;
  border-color: #000;
}

#petrol-go-app
  .social-provider-buttons
  a.button--outline.-wide.-has-icon
  .icon {
  width: 20px;
  height: 20px;
}

#petrol-go-app
  .social-provider-buttons
  a.button--outline.-wide.-has-icon:hover {
  background: #f0f0f0;
  border-color: #000;
  color: inherit;
}

#petrol-go-app
  .social-provider-buttons
  a.button--outline.-wide.-has-icon:active {
  background: #e1e1e1;
  border-color: #000;
  color: inherit;
}

#petrol-go-app .registration_sso-title .title {
  font-size: 18px;
  font-weight: 750;
}

#petrol-go-app .registration_sso-title .subtitle {
  font-size: 15px;
  font-weight: 400;
}

#petrol-go-app .registration__sso-header img {
  height: 32px;
  width: auto;
  display: block;
}

/* --- Custom Styled Language Selector --- */
#petrol-go-app .registration__sso-header-lang {
  margin-bottom: 0;
}

#petrol-go-app .registration__sso-header-lang .language-select {
  -webkit-appearance: none;
  appearance: none;
  width: auto;
  min-width: 0;
  min-height: 1.5rem;
  padding: 0.3125rem 1.125rem 0.3125rem 0.375rem;
  font: inherit;
  line-height: 1.25;
  color: inherit;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 6'%3e%3cpath fill='%23333333' d='M0 0h12L6 6z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.125rem center;
  background-size: 0.75rem 0.375rem;
  border: 1px solid transparent;
  border-radius: 0.15625rem;
  cursor: pointer;
}

#petrol-go-app .registration__sso-header-lang .language-select:open {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 6'%3e%3cpath fill='%23333333' d='M0 6h12L6 0z'/%3e%3c/svg%3e");
}

#petrol-go-app .registration__sso-header-lang .language-select:hover,
#petrol-go-app .registration__sso-header-lang .language-select:focus {
  border-color: transparent;
}

#petrol-go-app .registration__sso-header-lang .language-select:focus-visible {
  outline: 3px solid #005dbf;
  outline-offset: 2px;
}

@media (forced-colors: active) {
  #petrol-go-app .registration__sso-header-lang .language-select {
    -webkit-appearance: auto;
    appearance: auto;
    border: 1px solid ButtonText;
    color: ButtonText;
    background-color: Canvas;
    background-image: none;
  }

  #petrol-go-app .registration__sso-header-lang .language-select:focus-visible {
    outline: 3px solid Highlight;
  }
}

/* --- Footer: Copyright and Legal Links --- */
#petrol-go-app .registration__sso-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 480px;
  font-size: 12px;
  color: #586069;
  padding: 0;
  margin: 0;
  gap: 12px 20px;
  text-align: center;
}

#petrol-go-app .registration__sso-footer p {
  width: 100%;
  margin: 0;
}

#petrol-go-app .registration__sso-footer a {
  color: #586069;
  text-decoration: none;
}

#petrol-go-app .registration__sso-footer a:hover {
  text-decoration: underline;
  color: #24292e;
}

#petrol-go-app .password-strength-meter {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

#petrol-go-app #password-rules {
  margin: 0;
}

#petrol-go-app
  .password-strength-meter__meter[data-password-strength="to-short"]::after {
  -webkit-transform: translateX(-90%);
  transform: translateX(-90%);
  background-color: #db0f18;
}

#petrol-go-app
  .password-strength-meter__meter[data-password-strength="weak"]::after {
  -webkit-transform: translateX(-60%);
  transform: translateX(-60%);
  background-color: #ed951b;
}

#petrol-go-app
  .password-strength-meter__meter[data-password-strength="medium"]::after {
  -webkit-transform: translateX(-33%);
  transform: translateX(-33%);
  background-color: #0205cb;
}

#petrol-go-app
  .password-strength-meter__meter[data-password-strength="strong"]::after {
  -webkit-transform: translateX(0);
  transform: translateX(0);
  background-color: #00a513;
}

#petrol-go-app #password {
  justify-content: center;
  align-items: center;
  display: -webkit-flex;
}

#petrol-go-app #password-reveal-button {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Login form styles --- */
#petrol-go-app .registration__forgotten-pass {
  display: block;
  width: fit-content;
  margin-top: 0.25rem;
  margin-left: auto;
}

#petrol-go-app .paragraph-margin-bottom {
  margin-bottom: 0 !important;
}

/* --- Verify Email Styles --- */
#petrol-go-app #email-verify-title {
  font-size: 18px;
}

#petrol-go-app .verify-email__sso {
  box-shadow: none;
  padding: 0 0 0 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 24px;
  text-align: center;
}

#petrol-go-app .verify-email__sso .registration__step-buttons {
  width: 100%;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#petrol-go-app .verify-email__sso .registration__step-buttons::after {
  content: none;
}

#petrol-go-app .verify-email__sso .registration__step-buttons .button {
  width: 100%;
  margin-right: 0;
  margin-bottom: 0;
  float: none;
}

#petrol-go-app .transparent-with-border {
  background: transparent !important;
  color: #db0f18;
  border: 1px solid #db0f18;
  padding: 18px 16px;
  width: 100%;
  border-radius: 8px;
}

#petrol-go-app
  .transparent-with-border:not(.set-disabled):not(.-disabled):not(
    :disabled
  ):not([aria-disabled="true"]):hover {
  background: #db0f18 !important;
  color: #ffffff;
  border-color: #db0f18;
}

#petrol-go-app
  .transparent-with-border:not(.set-disabled):not(.-disabled):not(
    :disabled
  ):not([aria-disabled="true"]):active {
  background: #bd0009 !important;
  color: #ffffff;
  border-color: #bd0009;
}

#petrol-go-app #email-verify-send-again,
#petrol-go-app #reset-password-go-back {
  margin-top: 0;
  margin-bottom: 0;
}

#petrol-go-app #info-page-title ~ .registration__step-buttons,
#petrol-go-app #error-page-title ~ .registration__step-buttons {
  margin-bottom: 16px;
  padding-bottom: 16px;
}

#petrol-go-app .login-form__sso[aria-labelledby="info-page-title"],
#petrol-go-app .login-form__sso[aria-labelledby="error-page-title"] {
  padding-bottom: 16px;
}

#petrol-go-app .underline {
  text-decoration: underline !important;
}

/* --- login-reset-password styles --- */
#petrol-go-app .reset-password__sso {
  padding-bottom: 24px;
}

#petrol-go-app .reset-password__sso .registration__step-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#petrol-go-app .reset-password__sso .registration__step-buttons::after {
  content: none;
}

#petrol-go-app .reset-password__sso .registration__step-buttons .button {
  width: 100%;
  margin-right: 0;
  float: none;
}

#petrol-go-app #kc-reset-password-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 24px;
}
/* Full-screen Dimmer/Overlay */
#petrolgo-dimmer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff; /* Clean white background */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
}

#petrolgo-dimmer.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Red Dotted Spinner with Pulsing Effect */
.spinner-dots {
  width: 60px;
  height: 60px;
  /* Using a thick dotted border for the "dots" */
  border: 8px dotted #e31e24;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  box-sizing: border-box;
  /* We combine rotation and scaling in one animation */
  animation: petrol-pulse-rotate 2s ease-in-out infinite;
}

@keyframes petrol-pulse-rotate {
  0% {
    transform: rotate(0deg) scale(0.8);
    opacity: 0.6;
  }
  50% {
    transform: rotate(180deg) scale(1.2); /* Grows bigger */
    opacity: 1;
  }
  100% {
    transform: rotate(360deg) scale(0.8); /* Shrinks back */
    opacity: 0.6;
  }
}
