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

$params: (
   "border": global.$border-width solid global.$border-color,
   "border-radius": global.$border-radius-base,
   "margin-bottom": global.$gap-width,
   "padding": 10px 15px 10px 5px,
   "gap": global.$gap-width,
   "background": global.$white,

   "img-size": 50px,
   "picture-margin": 0,

   "product-name-color": global.$text-dark,
   "product-name-font-size": global.$font-size-base,
   "product-name-font-weight": global.$font-weight-base,
   "product-name-line-height": global.$line-height-sm,

   "price-color": global.$text-dark,
   "price-font-size": global.$font-size-base,
   "price-font-weight": global.$font-weight-bold,
);

@if global-variable-exists(c-product-gifts-giftrow, components) {
   $keys: map.keys(components.$c-product-gifts-giftrow);
   @each $name in $keys {
      @if not map.get($params, $name) {
         @warn "Neexistující proměnná '#{$name}' v komponentě '$#{component("Product:Gifts:GiftRow", "class")}'.";
      }
   }

   $params: map.merge($params, components.$c-product-gifts-giftrow);
}

.#{component("Product:Gifts:GiftRow", "class")} {
   container-type: inline-size;
   position: relative;
   overflow: hidden;
   width: 100%;
   border: map.get($params, "border");
   border-radius: map.get($params, "border-radius");
   margin-bottom: map.get($params, "margin-bottom");
   padding: map.get($params, "padding");
   background: map.get($params, "background");

   .product {
      display: flex;
      align-items: center;
      gap: map.get($params, "gap");
      text-decoration: unset;

      picture {
         max-width: 1em;
         min-width: .75em;
         background: map.get($params, "background");
         font-size: map.get($params, "img-size");
         margin: map.get($params, "picture-margin");
      }
   }

   .title-wrapper {
      display: flex;
      flex-direction: column;
   }

   .product-name {
      white-space: normal;
      color: map.get($params, "product-name-color");
      font-size: map.get($params, "product-name-font-size");
      font-weight: map.get($params, "product-name-font-weight");
      line-height: map.get($params, "product-name-line-height");
   }

   .price {
      color: map.get($params, "price-color");
      font-size: map.get($params, "price-font-size");
      font-weight: map.get($params, "price-font-weight");
   }
}
