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

$params: (
   "item-gap": global.$gap-width,
   "items-per-row": 3,
   "breakpoint" : global.$md,

   "font-size": global.$font-size-base,
   "background": global.$body-bg-alt,
   "padding": 20px,
   "margin": 0,
   "border": none,
   "border-radius": global.$border-radius-lg,

   "text-margin": 0,
);

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

   $params: map.merge($params, components.$c-account-userdashboard-pricelevel);
}

.#{component("Account:UserDashboard:PriceLevel", "class")} {
   width: 100%;
   background: map.get($params, 'background');
   padding: map.get($params, 'padding');
   margin: map.get($params, 'margin');
   border: map.get($params, 'border');
   font-size: map.get($params, "font-size");
   border-radius: map.get($params, 'border-radius');

   p {
      margin-bottom: map.get($params, 'text-margin');
   }

   @container (inline-size > #{map.get($params, "breakpoint")}) {
      width: calc((100% - ( map.get($params, 'items-per-row') - 1) * map.get($params, 'item-gap')) / map.get($params, 'items-per-row'));
   }
}
