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

$params: (
   "border": 2px solid global.$border-color-dark,
   "border-radius": global.$border-radius-base,
   "padding-bottom": global.$spacer,
   "background-not-active": global.$body-bg-alt,
   "gap": global.$spacer,
   "item-padding": 21px 14px,

   "title-font-size": global.$font-size-base,
   "title-font-weight": global.$font-weight-bold,
);

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

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

.#{component("Preorders:DatePicker", "class")} {
   display: flex;
   flex-wrap: wrap;
   gap: map.get($params, "gap");
   padding-bottom: map.get($params, "padding-bottom");

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

   .date-picker-item {
      display: block;
      padding: map.get($params, "item-padding");
      border-radius: map.get($params, "border-radius");
      text-decoration: none;
      flex: 1;

      &.active {
         border: map.get($params, "border");
      }

      &:not(.active) {
         background-color: map.get($params, "background-not-active");
      }

      &:not(.active) .title {
         text-decoration: underline;
      }

      .description {
         color: global.$text-muted;
      }
   }
}
