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

$params: (
   "seller-thumbnail-border-radius": 10px,
   "seller-info-border": 1px solid global.$border-color,
   "seller-info-mobile-padding": 20px global.$grid-gutter-width,
   "seller-info-desktop-padding": 40px 0,
   "seller-info-mobile-margin-bottom": 20px,
   "seller-info-desktop-margin-bottom": 35px,
   "seller-info-item-gap": 20px,
   "seller-info-icon-color": global.$brand-secondary,
   "seller-info-icon-size": 30px,
   "seller-info-icon-margin-top": 20px,
   "seller-description-margin-bottom": 40px,
   "seller-map-mobile-height": 500px,
   "seller-map-desktop-height": 600px,
   "seller-map-border-radius": 10px,
   "seller-map-mobile-margin-bottom": 20px,
   "seller-map-desktop-margin-bottom": 60px,
   "seller-map-pin-color": global.$brand-secondary,
   "seller-map-pin-hover-color": global.$red,
   "container-max-width": 1230px,
);

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

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

.#{component("SellerDetails", "class")} {
   container-type: inline-size;

   > .container {
      max-width: map.get($params, "container-max-width");
   }

   .seller-thumbnail img {
      border-radius: map.get($params, "seller-thumbnail-border-radius");
   }

   .seller-info {
      display: grid;
      grid-template-columns: 1fr;
      gap: map.get($params, "seller-info-item-gap");
      border-bottom: map.get($params, "seller-info-border");
      padding: map.get($params, "seller-info-mobile-padding");
      margin: 0 -#{global.$grid-gutter-width} map.get($params, "seller-info-mobile-margin-bottom");
   }

   .seller-info-item {
      display: flex;
      gap: map.get($params, "seller-info-item-gap");

      .no-margin {
         margin-bottom: 0;
      }
   }

   .seller-info-button {
      align-self: center;
      display: flex;
      align-items: center;
      flex-direction: column;

      .btn {
         display: flex;
         width: 100%;
      }
   }

   .seller-info-icon {
      color: map.get($params, "seller-info-icon-color");
      margin-top: map.get($params, "seller-info-icon-margin-top");

      .c-icon {
         height: map.get($params, "seller-info-icon-size");
         width: map.get($params, "seller-info-icon-size");
      }
   }

   .seller-opening-hours td {
      padding-right: 10px;
   }

   .seller-description {
      margin-bottom: map.get($params, "seller-description-margin-bottom");
   }

   .seller-map {
      height: map.get($params, "seller-map-mobile-height");
      margin: 0 -#{global.$grid-gutter-width * 2} map.get($params, "seller-map-mobile-margin-bottom");
   }


   .seller-map-label {
      width: 38px;
      height: 50px;
      align-items: center;
      justify-content: center;
      overflow: visible !important;
      color: map.get($params, "seller-map-pin-color");
      display: flex !important;
      cursor: pointer;

      svg {
         fill: currentColor;

         * {
            fill: currentColor;
         }
      }

      &.hover {
         color: map.get($params, "seller-map-pin-hover-color");
      }
   }

   @container (inline-size > 700px) {
      .seller-map {
         border-radius: map.get($params, "seller-map-border-radius");
         height: map.get($params, "seller-map-desktop-height");
         margin: 0 0 map.get($params, "seller-map-desktop-margin-bottom");
      }
   }

   @container (inline-size > 800px) {
      .seller-info {
         grid-template-columns: 1fr 1fr 1fr 1fr;
         gap: map.get($params, "seller-thumbnail-gap");
         padding: map.get($params, "seller-info-desktop-padding");
         margin: 0 0 map.get($params, "seller-info-desktop-margin-bottom");
      }

      .seller-info-button {
         justify-content: end;
      }
   }
}
