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

$params: (
   "width": 100%,
   "item-gap": global.$gap-width,

   "image-padding": 20px,
   "image-border-radius": 50%,
   "image-width": 98px,
   "image-height": 98px,
   "image-color": global.$black,
   "image-background-color": global.$white,
   "image-font-size": 30px,
   "image-font-weight": global.$font-weight-bold,
   "image-line-height": 98px,

   "info-padding": 40px,

   "name-margin": 0 0 5px 0,
   "name-color": global.$black,

   "background": global.$body-bg-alt,
   "padding": 20px,
   "margin": 0,
   "border": none,
   "border-radius": global.$border-radius-lg,
   "row-gap": 5px,

   "column-text-margin": 0,

   "b2b-indicator-background-color": global.$green,
   "b2b-indicator-color": global.$white,
   "b2b-indicator-padding": 1px 5px,
   "b2b-indicator-border-radius": 10px,
   "b2b-indicator-font-size": global.$font-size-tiny,
   "b2b-indicator-margin": 0 0 0 5px,
);

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

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

.#{component("Account:UserDashboard:UserInfoWithPhoto", "class")} {
   display: flex;
   align-items: center;
   flex-wrap: wrap;
   width: map.get($params, 'width');
   background: map.get($params, 'background');
   padding: map.get($params, 'padding');
   margin: map.get($params, 'margin');
   border: map.get($params, 'border');
   border-radius: map.get($params, 'border-radius');
   row-gap: map.get($params, 'row-gap');

   .account-image {
      text-align: center;
      padding: map.get($params, "image-padding");

      span {
         display: inline-block;
         border-radius: map.get($params, "image-border-radius");
         width: map.get($params, "image-width");
         height: map.get($params, "image-height");
         color: map.get($params, "image-color");
         background-color: map.get($params, "image-background-color");
         font-size: map.get($params, "image-font-size");
         font-weight: map.get($params, "image-font-weight");
         line-height: map.get($params, "image-line-height");
      }
   }

   .account-info {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      flex-grow: 1;
      padding: map.get($params, "info-padding");

      .name {
         width: 100%;
         margin-bottom: map.get($params, "name-margin");
         color: map.get($params, "name-color");
      }
   }

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

   .email {
      word-wrap: break-word;
   }

   .logged-b2b {
      background-color: map.get($params, "b2b-indicator-background-color");
      color: map.get($params, "b2b-indicator-color");
      padding: map.get($params, "b2b-indicator-padding");
      border-radius: map.get($params, "b2b-indicator-border-radius");
      font-size: map.get($params, "b2b-indicator-font-size");
      margin: map.get($params, "b2b-indicator-margin");
   }
}
