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

$params: (
   "gap": 15px,
   "margin-bottom": global.$spacer,

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

   "img-max-width": 100px,

   "link-color": inherit,
   "link-font-size": inherit,
   "link-font-weight": inherit,
   "link-text-decoration-mixin": "default",

   "tooltip-icon-color": global.$text-dark,
   "tooltip-icon-font-size": global.$font-size-base,
   "tooltip-icon-margin": 0,
);

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

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

.#{component("Product:ProducerLogo", "class")} {
   display: flex;
   align-items: center;
   justify-content: flex-start;
   gap: map.get($params, "gap");
   flex-wrap: wrap;
   margin-bottom: map.get($params, "margin-bottom");

   > * {
      flex: 0 0 auto;
   }

   p {
      margin: 0;
      color: map.get($params, "title-color");
      font-size: map.get($params, "title-font-size");
      font-weight: map.get($params, "title-font-weight");
   }

   .#{component("Picture", "class")} {
      max-width: map.get($params, "img-max-width");
   }

   a {
      @if (map.get($params, "link-text-decoration-mixin") == "default") {
         @include global.underline-default;
      } @else if (map.get($params, "link-text-decoration-mixin") == "hover") {
         @include global.underline-hover;
      }

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

   .c-icon {
      color: map.get($params, "tooltip-icon-color");
      font-size: map.get($params, "tooltip-icon-font-size");
      margin: map.get($params, "tooltip-icon-margin");
   }
}
