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

$params: (
   "color": global.$text-dark,
   "font-size": global.$font-size-larger,
   "font-weight": global.$font-weight-bold,
   "padding": 25px 7px,
   "margin": 0 35px -2px 0,
   "resp-margin": 0 5px,
   "background": transparent,
   "border-bottom": 3px solid transparent,
   "background-active": global.$body-bg,
   "border-bottom-active-color": global.$brand-secondary,
   "counter-color": global.$text-muted,
   "counter-font-size": global.$font-size-base,
   "counter-font-weight": global.$font-weight-base,
);

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

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

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

   display: inline-flex;
   position: relative;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   z-index: 1;
   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");
   width: 100%;
   order: unset;
   margin: map.get($params, "resp-margin");
   border-bottom: map.get($params, "border-bottom");
   transition: border-bottom-color global.$transition-speed, background-color global.$transition-speed;

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

   svg {
      position: absolute;
      right: 0;
      transition: transform global.$transition-speed;
   }

   &.active {
      svg {
         transform: rotate(-180deg);
      }
   }

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

   @container (inline-size > 500px) {
      order: -1;
      margin: map.get($params, "margin");
      width: unset;

      @include global.container-query-selector("svg") {
         display: none;
      }
   }
}
