/**
 * The styles in this file are only structural for Seelenweg,
 * all the design should be added to the default theme css.
 */
body {
  overflow: hidden;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;

  &:has(.taskbar.left) {
    justify-content: flex-start;
  }

  &:has(.taskbar.right) {
    justify-content: flex-end;
  }

  &:has(.taskbar.top) {
    align-items: flex-start;
  }

  &:has(.taskbar.bottom) {
    align-items: flex-end;
  }
}

/** Root Styles */
#root {
  --dock-size: calc(var(--config-item-size) + (var(--config-padding) + var(--config-margin)) * 2);

  position: absolute;
  height: min-content;
  width: min-content;
  max-width: 100vw;
  max-height: 100vh;
  transition: transform 0.2s ease-in-out;

  &:has(.taskbar.left) {
    left: 0;
  }

  &:has(.taskbar.right) {
    right: 0;
  }

  &:has(.taskbar.top) {
    top: 0;
  }

  &:has(.taskbar.bottom) {
    bottom: 0;
  }

  &:not(:hover) {
    &:has(.taskbar.hidden.left) {
      transform: translate(calc(var(--dock-size) * -1), 0);
    }

    &:has(.taskbar.hidden.right) {
      transform: translate(var(--dock-size), 0);
    }

    &:has(.taskbar.hidden.top) {
      transform: translate(0, calc(var(--dock-size) * -1));
    }

    &:has(.taskbar.hidden.bottom) {
      transform: translate(0, var(--dock-size));
    }
  }
}

/** Taskbar Styles */
.taskbar {
  --max-taskbar-width: calc(100vw - var(--config-margin) * 2);
  --max-taskbar-height: calc(100vh - var(--config-margin) * 2);

  position: relative;
  margin: var(--config-margin);
  max-width: var(--max-taskbar-width);
  max-height: var(--max-taskbar-height);

  .weg-items-container {
    overflow: auto;
    width: 100%;
    height: 100%;
    padding: var(--config-padding);

    &::-webkit-scrollbar {
      display: none;
    }

    .weg-items {
      display: flex;
      gap: var(--config-space-between-items);
    }
  }

  &.full-width {
    .weg-item-drag-container:has(.weg-separator) {
      flex: 1;
    }
  }

  &.horizontal {
    width: min-content;
    height: calc(var(--config-item-size) + var(--config-padding) * 2);

    &.full-width {
      width: var(--max-taskbar-width);
    }

    .weg-items {
      flex-direction: row;
      min-width: 100%;
      width: max-content;
    }
  }

  &.vertical {
    width: calc(var(--config-item-size) + var(--config-padding) * 2);
    height: min-content;

    &.full-width {
      height: var(--max-taskbar-height);
    }

    .weg-items {
      flex-direction: column;
      min-height: 100%;
      height: max-content;
    }
  }

  &:has(.weg-item-drag-container.dragging) {
    pointer-events: none;
  }
}

.weg-separator {
  opacity: 0;

  .vertical & {
    width: var(--config-item-size);
  }

  .horizontal & {
    height: var(--config-item-size);
  }

  .weg-item-drag-container:not(:first-child):not(:last-child) > & {
    &.visible {
      opacity: 1;
    }
  }

  .weg-item-drag-container:first-child > & {
    .vertical & {
      margin-top: calc(var(--config-space-between-items) * -1);
    }

    .horizontal & {
      margin-left: calc(var(--config-space-between-items) * -1);
    }
  }

  .weg-item-drag-container:last-child > & {
    .vertical & {
      margin-bottom: calc(var(--config-space-between-items) * -1);
    }

    .horizontal & {
      margin-right: calc(var(--config-space-between-items) * -1);
    }
  }
}

.weg-item-preview-container {
  position: relative;
  max-width: 100vw;
  gap: var(--config-space-between-items);

  .weg-item-preview-scrollbar {
    display: flex;
    overflow-x: auto;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  .weg-item-preview {
    z-index: 1;

    &:hover {
      filter: brightness(0.95);
      backdrop-filter: brightness(0.95);
    }

    .weg-item-preview-topbar {
      display: flex;
      width: 240px;
      justify-content: space-between;
      gap: 10px;

      .weg-item-preview-title {
        overflow: hidden;
        text-wrap: nowrap;
        text-overflow: ellipsis;
        flex: 1;
      }

      .weg-item-preview-close {
        border-radius: 6px;
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 5px;

        &:hover {
          background-color: #0000005c;
        }
      }
    }

    .weg-item-preview-image-container {
      width: 240px;
      height: calc(240px / 1.77);
      display: flex;
      justify-content: center;
      align-items: center;

      .weg-item-preview-image {
        max-height: 100%;
        height: 100%;
        object-fit: scale-down;
      }
    }
  }
}
