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

$params: (
   "breakpoint": global.$lg,
   "has-side-filters": 'false',
   "left-side-width": 250px,
   "left-side-border-right": 0,
   "right-side-width": auto,
   "gap": 30px,
   "margin-bottom": 0,
);

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

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

.#{component("Section:View", "class")} {
   container-type: inline-size;
   margin-bottom: map.get($params, "margin-bottom");

   @if (map.get($params, "has-side-filters") == true) {
      .category-left-side {
         display: none;
      }

      @media screen and (min-width: #{map.get($params, "breakpoint")}) {
         .container-with-sidebar {
            display: flex;
            justify-content: space-between;
            gap: map.get($params, "gap");
         }

         .category-left-side {
            flex: 0 0 map.get($params, "left-side-width");
            border-right: map.get($params, "left-side-border-right");
            display: block;
         }

         .category-right-side {
            flex: 1 1 map.get($params, "right-side-width");
         }
      }
   }
}
