@use '../abstracts' as *;

/* Organism - Dashboard */

.o-dashboard-grid {
  display: grid;
  height: 100%;
  grid-template-rows: repeat(12, 1fr);
}

.o-dashboard-widget {
  position: relative;
  overflow: hidden; // usefull for tile widget not having a double scroll
  z-index: 1;

  &.-edited {
    overflow: hidden;
    box-shadow: 1px 1px 4px 2px rgba(0, 0, 0, 0.1);
    border-radius: toRem(5);
  }
}

.no-interaction {
  pointer-events: none;
}

.move {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  cursor: move;
  padding: toRem(24);
  z-index: 1;

  .move-inside {
    top: toRem(15);
    bottom: toRem(15);
    right: toRem(15);
    left: toRem(15);
    background-color: #fff;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: absolute;
    z-index: 2;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    &.move-map {
      background-image: url('/assets/backgrounds/map.svg');
    }

    &.move-table {
      background-image: url('/assets/backgrounds/table.svg');
    }

    &.move-detail {
      background-image: url('/assets/backgrounds/detail.svg');
    }

    &.move-chart {
      background-image: url('/assets/backgrounds/chart.svg');
    }

    &.move-graph {
      background-image: url('/assets/backgrounds/graph.svg');
    }

    &.move-iframe {
      background-image: url('/assets/backgrounds/iframe.svg');
    }

    &.move-template {
      background-image: url('/assets/backgrounds/template.svg');
    }

    &.move-placeholder {
      background-image: url('/assets/backgrounds/placeholder.png');
    }

    &.move-tile {
      background-image: url('/assets/backgrounds/tile.svg');
    }
  }
}

.resize {
  position: absolute;
  display: inline-block;
  width: toRem(24);
  height: toRem(24);
  z-index: 2;

  &.nw-resize {
    cursor: nw-resize;
    top: 0;
    left: 0;
  }

  &.ne-resize {
    cursor: ne-resize;
    top: 0;
    right: 0;
  }

  &.sw-resize {
    cursor: sw-resize;
    bottom: 0;
    left: 0;
  }

  &.se-resize {
    cursor: se-resize;
    bottom: 0;
    right: 0;
  }

  &.delete {
    top: 0;
    left: 50%;
    transform: translate(-50%, 0);
  }
}

.no-widget {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;

  &__search {
    width: 40%;
    margin-bottom: toRem(40);
  }

  &__text {
    max-width: toRem(294);
    text-align: center;
    line-height: toRem(20);
  }
}

.o-layout-indicator {
  display: grid;
  gap: toRem(1);
  z-index: -1;
  grid-area: 1 / 1 / -1 / -1;
  background-color: #ccc;

  &.-grid-1\/3v {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr;
  }
  &.-grid-1\/3h {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr 1fr;
  }
  &.-grid-1\/2v {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
  }
  &.-grid-1\/2h {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  &.-grid-1\/4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .a-indicator-block {
    content: '';
    background-color: white;
  }
}
