/* ***************************** Customize Apps Styles ******************************** */
/* Shared */
:root {
  color-scheme: only light;
  --primary: #9b0c19;
  --primary-dark: #700912;
  --primary-light: #f8d8d9;
  --grey-100: #f5f5f5;
  --grey-200: #f0f0f0;
  --grey-300: #e8e8e8;
  --grey-400: #e0e0e0;
  --grey-500: #dcdcdc;
  --grey-600: #d8d8d8;
  --box-shadow: 0px 0px 3px 0px var(--grey-400);
  --max-width: 480px;
  --max-height: 812px;
  --fs-base: 1rem;
}

.apps-general-shadow-pulse {
  animation: shadow-pulse 2s infinite;
}

@keyframes shadow-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--primary-dark);
  }

  70% {
    box-shadow: 0 0 0 8px var(--primary-light);
  }
}

.apps-general-shimmer {
  animation: animate-mounting 1.5s;
}

@keyframes animate-mounting {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

/* Component - AccordionButton */
.apps-component-accordion-button {
  transform: rotate(0deg);
  transition: transform 0.35s linear;

  &.show {
    transform: rotate(-180deg);
  }
}

/* Component - BlockUI */
.apps-component-block-ui-overlay {
  background-color: black;
}

/* Component - BottomSheetDialog */
.apps-component-bottom-sheet-dialog {
  animation: slide-up 0.3s forwards;

  &.restore-position {
    transition: bottom 0.15s linear !important;
  }

  &.close-dialog {
    animation: slide-down 0.15s ease-in-out forwards;
  }
}

@keyframes slide-up {
  0% {
    transform: translateY(100%);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes slide-down {
  100% {
    transform: translateY(100%);
  }
}

/* Component - RippleWrapper */
.apps-component-ripple-wrapper {
  overflow: hidden;
  position: relative;

  .ripple {
    animation: ripple 0.5s ease-in-out;
    width: 0;
    height: 0;
    position: absolute;
    background-color: #eee;
    border-radius: 100%;
    opacity: 1;
    transform: scale(0);
    will-change: opacity, transform; /* Optimization usage for browser rendering about the element */
  }
}

@keyframes ripple {
  100% {
    opacity: 0;
    transform: scale(3);
  }
}

/* Page - Home */
.apps-page-home-landing-page {
  animation: zoom-to-original 3s ease-out forwards,
    animate-unmount 1s ease-in 3s forwards;
}

@keyframes zoom-to-original {
  0% {
    background-size: 110% 110%;
  }

  100% {
    background-size: 100% 100%;
  }
}

@keyframes animate-unmount {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* Page - Menu */
.apps-page-menu-scrollspy {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--max-width);
  background-color: white;
  border-block: 1px solid var(--grey-300);
  box-shadow: var(--box-shadow);

  &.sticky {
    position: sticky;
    top: 50px;
    z-index: 1;
  }
}

.apps-page-menu-scrollspy ul {
  overflow-x: auto;
  list-style: none;
  -ms-overflow-style: none; /* Internet Explorer and Edge */
  scrollbar-width: none; /* Firefox */

  &::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
  }
}

.apps-page-menu-scrollspy li {
  position: relative;
  white-space: nowrap;

  &::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2.5px;
    background-color: var(--primary);
    border-radius: 3px;
  }

  &.is-active {
    &::after {
      width: 100%;
    }

    > a {
      color: var(--primary) !important;
    }
  }
}

.apps-page-menu-scrollspy a {
  text-decoration: none;
  color: black;
  font-weight: 500;
}

/* UI - CartMode */
.apps-ui-cart-mode-component-panel {
  &.show-suggest-label {
    &::before {
      position: absolute;
      top: 25px;
      right: -5px;
      content: "";
      background: #9b0d1a;
      height: 25px;
      width: 25px;
      transform: rotate(45deg);
    }

    &::after {
      position: absolute;
      top: 10px;
      right: -10px;
      content: "Suggested";
      background: #ff0707;
      color: white;
      font-size: 14px;
      font-weight: bold;
      padding: 3px 6px;
    }
  }

  &.can-toggle-background {
    &:active,
    &:hover {
      .container {
        background-color: var(--grey-100) !important;
      }
    }
  }
}

/* UI - MenuItem */
.apps-ui-menu-item-component-header {
  background-color: rgba(0, 0, 0, 0);
  border-bottom: none;
  box-shadow: none;

  &.with-background {
    background: #fff;
    border-bottom: 1px solid var(--grey-300);
    box-shadow: 0px 0px 3px 0px rgba(186, 186, 186, 0.5);
  }
}

.apps-ui-menu-item-component-header-back-button {
  transition: background-color 0.8s linear;
}

.apps-ui-menu-item-component-customize-panel {
  border-bottom: 1px solid var(--grey-300);
}

.apps-ui-menu-item-component {
  &.badge-required {
    background-color: #d6292f;
    color: #fff !important;

    &.with-animation {
      animation: badge-required-vertical-flip 0.5s ease-in-out forwards;
    }
  }

  &.badge-optional {
    background: #eaeaea;
    color: #757575 !important;
  }

  &.badge-completed {
    border: 1px solid #198754;
    color: #009705 !important;

    &.with-animation {
      animation: badge-completed-vertical-flip 0.5s ease-in-out forwards;
    }
  }
}

@keyframes badge-required-vertical-flip {
  0% {
    transform: rotateX(90deg);
  }

  100% {
    transform: rotateX(0deg);
  }
}

@keyframes badge-completed-vertical-flip {
  0% {
    transform: rotateX(90deg);
  }

  100% {
    transform: rotateX(0deg);
  }
}

/* UI - Order */
.apps-ui-order-component-order-panel {
  display: flex;
  flex-direction: column;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  border-left: 1px solid var(--grey-200);
  border-right: 1px solid var(--grey-200);
  margin-left: 1rem;
  margin-right: 1rem;
  margin-bottom: 4rem;
  position: relative;

  &:has(.accordion-collapse.collapse:not(.show)) {
    border-end-start-radius: 12px;
    border-end-end-radius: 12px;
    border-bottom: 1px solid var(--grey-200);
  }

  &:has(.accordion-collapse.collapse.show) {
    &::before,
    &::after {
      content: "";
      position: absolute;
      left: 0;
      bottom: -10px;
      right: 0;
      background-repeat: repeat-x;
    }

    &::before {
      height: 10px;
      background-size: 15px 10px;
      background-image: radial-gradient(
        circle at 7.5px -5px,
        transparent 9px,
        var(--grey-200) 10px
      );
    }

    &::after {
      height: 15px;
      background-size: 30px 15px;
      background-image: radial-gradient(
        circle at 7.5px 10px,
        var(--grey-200) 9px,
        transparent 10px
      );
      box-shadow: 0px 6px 3px var(--grey-200);
      filter: drop-shadow(0px 4px 3px var(--grey-200));
    }
  }
}

/* ***************************** Customize Bootstrap ******************************** */
.bg-primary {
  background-color: var(--primary) !important;
}

.border-primary {
  border-color: var(--primary) !important;
}

.btn-light {
  background-color: #e6e6e6 !important;
}

.btn-light:hover {
  background-color: #c5c5c5 !important;
}

.btn-primary {
  background-color: var(--primary) !important;
}

.btn-primary:hover {
  background-color: var(--primary-dark) !important;
}

.btn-check:focus + .btn-primary,
.btn-primary:focus {
  background-color: var(--primary-dark) !important;
}

.btn-check:checked + .btn-primary,
.btn-check:active + .btn-primary,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
  background-color: var(--primary-dark) !important;
}

.btn-outline-primary {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.btn-outline-primary:active {
  color: var(--primary-light) !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.btn-outline-primary:hover {
  color: var(--primary-light) !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.carousel-inner {
  height: 100%;
}

.carousel-item {
  height: 100%;
}

.fs-1 {
  font-size: calc(var(--fs-base) * 1.375) !important;
}

.fs-2 {
  font-size: calc(var(--fs-base) * 1.25) !important;
}

.fs-3 {
  font-size: calc(var(--fs-base) * 1.125) !important;
}

.fs-4 {
  font-size: var(--fs-base) !important;
}

.fs-5 {
  font-size: calc(var(--fs-base) * 0.875) !important;
}

.fs-6 {
  font-size: calc(var(--fs-base) * 0.75) !important;
}

.form-check-input {
  border: 1px solid var(--primary);

  &:checked {
    background-color: var(--primary);
    border-color: var(--primary);
  }

  &:focus {
    border-color: var(--primary);
  }
}

.form-check-label.is-invalid {
  font-weight: 600;
  color: #dc3545;
}

.form-control:focus {
  border-color: var(--primary);
}

.form-control:focus,
.btn:focus,
.btn-primary:focus,
.form-check-input {
  box-shadow: none !important;
}

/* Hide the scrollbar */
.modal-body {
  -ms-overflow-style: none; /* Internet Explorer 10+ */
  scrollbar-width: none; /* Firefox */

  &::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
  }
}

.nav-tabs {
  border-bottom: 1px solid var(--grey-300);

  .nav-link {
    color: #000;
    font-weight: 500;
  }

  .nav-link.active {
    border: none;
    border-bottom: 3px solid var(--primary);
    color: var(--primary);
    font-weight: 700;
  }
}

.offcanvas-backdrop {
  background-color: #000;
  height: 100vh;
  left: 0;
  position: fixed;
  top: 0;
  width: 100vw;
  z-index: 1040;

  &.fade {
    opacity: 0;
  }

  &.show {
    opacity: 0.5;
  }
}

@media screen and (min-width: 481px) {
  .offcanvas-start {
    left: 0;
    right: 160px;
    margin: auto;
    width: 320px;
  }
}

@media screen and (max-width: 480px) {
  .offcanvas-start {
    width: 60vw;
  }
}

.text-primary {
  color: var(--primary) !important;
}

/* ***************************** Customize DevExtreme ******************************** */
.dx-button-mode-contained.dx-button-default {
  background-color: var(--primary);
}

.dx-button-mode-contained.dx-button-default.dx-state-hover {
  background-color: var(--primary-dark);
}

.dx-button-mode-contained.dx-button-default.dx-state-focused {
  background-color: var(--primary-dark);
}

.dx-button-mode-contained.dx-button-default.dx-state-active {
  background-color: var(--primary-dark);
}

.dx-loadindicator-icon .dx-loadindicator-segment {
  background: var(--primary);
}

/* ***************************** Customize React Toastify ******************************** */
@media only screen and (max-width: 480px) {
  .Toastify__toast {
    width: 320px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0.5rem !important;
  }

  .Toastify__toast-container--top-center {
    top: calc(env(safe-area-inset-top) + 40px) !important;
  }
}

.react-toastify-toast-body {
  font-weight: bold;
  font-size: 0.875em;
}
