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

$params: (
   "height": 100%,
   "color": global.$text-dark,
   "font-size": global.$font-size-larger,
   "font-weight": global.$font-weight-bold,
   "padding": 25px 7px,
   "margin": 0 35px 0 0,
   "background": global.$body-bg,
   "border-bottom": 3px solid transparent,
   "border-radius": 0,
   "background-active": global.$body-bg,
   "border-bottom-active-color": global.$brand-secondary,
   "pointer-events-active": none,
   "text-transform": none,
   "letter-spacing": normal,

   "counter-size": 24px,
   "counter-margin-left": 8px,
   "counter-background": global.$brand-secondary,
   "counter-color": global.$white,
   "counter-font-size": global.$font-size-base,
   "counter-font-weight": global.$font-weight-bold,

   "disable-active-breakpoint": global.$lg,
);

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

   $params: map.merge($params, components.$c-product-tabs-tab-link);
}

.#{component("Product:Tabs:Tab:Link", "class")} {
   @include global.underline-never;

   display: inline-flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   z-index: 1;
   order: -1;
   height: map.get($params, "height");
   line-height: 1;
   background-color: map.get($params, "background");
   color: map.get($params, "color");
   font-size: map.get($params, "font-size");
   font-weight: map.get($params, "font-weight");
   padding: map.get($params, "padding");
   margin: map.get($params, "margin");
   border-bottom: map.get($params, "border-bottom");
   border-radius: map.get($params, "border-radius");
   text-transform: map.get($params, "text-transform");
   letter-spacing: map.get($params, "letter-spacing");
   transition: border-bottom-color global.$transition-speed, background-color global.$transition-speed;

   &::after {
      display: flex;
      align-items: center;
      justify-content: center;
      width: map.get($params, "counter-size");
      height: map.get($params, "counter-size");
      margin-left: map.get($params, "counter-margin-left");
      background: map.get($params, "counter-background");
      color: map.get($params, "counter-color");
      font-size: map.get($params, "counter-font-size");
      font-weight: map.get($params, "counter-font-weight");
      border-radius: 50%;
   }

   @include global.haf {
      background-color: map.get($params, "background-active");
      border-bottom-color: map.get($params, "border-bottom-active-color");
   }

   @container (inline-size > #{map.get($params, "disable-active-breakpoint")}) {
      &.active {
         pointer-events: map.get($params, "pointer-events-active");
      }
   }
}
