@use "sass:map";
@use "@twig/scss/_global" as global;
@use "@twig/scss/variables/_variables-components" as components;

$params: (
   "padding": 20px 10px,

   "background": global.$white,
   "breakpoint": global.$md,
   "border": 0,

   "resp-text-align": center,

   "title-color": global.$text-dark,
   "title-font-size": global.$font-size-h3,
   "title-font-weight": global.$font-weight-bold,

   "title-icon-color": global.$white,
   "title-icon-background": global.$brand-ctr,
   "title-icon-size": 28px,
   "title-icon-icon-size": 12px,
   "title-icon-border-radius": 50%,

   "border-top-left-radius": unset,
   "border-top-right-radius": unset,

   "product-name-font-weight": global.$font-weight-bold,

   "product-variation-color": global.$gray,

   "overlay-bg": global.$overlay-bg,
   "overlay-opacity": .6,
);

@if global-variable-exists(c-added-to-cart-resp, components) {
   $keys: map.keys(components.$c-added-to-cart-resp);
   @each $name in $keys {
      @if not map.get($params, $name) {
         @warn "Neexistující proměnná '#{$name}' v komponentě 'added-to-cart-resp'.";
      }
   }

   $params: map.merge($params, components.$c-added-to-cart-resp);
}


@media screen and (min-width: map.get($params, "breakpoint")) {
   .js-shop-added-to-cart-resp-overlay,
   .js-shop-added-to-cart-resp {
      display: none;
   }
}

.js-shop-added-to-cart-resp-overlay {
   background: map.get($params, "overlay-bg");
   position: fixed;
   bottom: 0;
   left: 0;
   transition: opacity global.$transition-speed;
   width: 100%;
   height: 100%;
   opacity: map.get($params, "overlay-opacity");
   z-index: 1001;
}

.js-shop-added-to-cart-resp {
   position: fixed;
   left: 0;
   right: 0;
   bottom: 0;
   background: map.get($params, "background");
   text-align: map.get($params, "resp-text-align");
   z-index: 1002;
   padding: map.get($params, "padding");
   animation: js-shop-added-to-cart-resp-init .5s ease-in;
   border-top-left-radius: map.get($params, "border-top-left-radius");
   border-top-right-radius: map.get($params, "border-top-right-radius");

   > .handle {
      margin-bottom: 1em;

      > [data-vaul-handle-hitarea] {
         cursor: grab;

         &:active {
            cursor: grabbing;
         }
      }
   }

   > .title {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 5px;
      color: map.get($params, "title-color");
      font-size: map.get($params, "title-font-size");
      font-weight: map.get($params, "title-font-weight");

      .c-icon {
         color: map.get($params, "title-icon-color");
         background-color: map.get($params, "title-icon-background");
         width: map.get($params, "title-icon-size");
         height: map.get($params, "title-icon-size");
         display: inline-flex;
         justify-content: center;
         align-items: center;
         margin-right: 8px;
         border-radius: map.get($params, "title-icon-border-radius");
         font-size: map.get($params, "title-icon-icon-size");
      }
   }

   > .product-name {
      font-weight: map.get($params, "product-name-font-weight");
      margin-bottom: 0;
   }

   > .product-variation {
      color: map.get($params, "product-variation-color");
   }
}

@keyframes js-shop-added-to-cart-resp-init {
   0% {
      transform: translateY(100%);
   }

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

@keyframes lds-dual-ring {
   0% {
      transform: rotate(0deg);
   }

   100% {
      transform: rotate(360deg);
   }
}
