@use "sass:color";
@use "_numbers";
@use "_colours" as colour;


.dsa41.sheet.actor.character {

  .window-header.flexrow.draggable.resizable {
  }

  $sidebar-width: 224px;
  $attribute-height: 60px;
  $tabs-spacing: 14px;
  $tabs-height: 26px;

  .window-content {
    display: unset; /* we are on our own */
    position: relative;

    header.sheet-header {
      position: absolute;
      top: 0;
      left: 0;
      height: $attribute-height;
      right: 0;
    }

    div.head-data {
      position: absolute;
      left: 0;
      top: $attribute-height;
      width: $sidebar-width;
      bottom: 0;
      padding: 8px;


      .profile-img {
        width: $sidebar-width - 16px;
      }
    }

    nav.sheet-tabs.tabs {
      position: absolute;
      left: $sidebar-width;
      top: $attribute-height+$tabs-spacing;
      right: 0;
      height: $tabs-height;
    }

    section.sheet-body {
      position: absolute;
      top: $attribute-height+$tabs-height+$tabs-spacing+4px;
      left: $sidebar-width;
      right: 4px;
      bottom: 4px;
      padding: 8px;
      overflow: auto;
    }

    .tab.overview.active {

      display: flex;
      flex-direction: column;
      height: 100%;

      .meta-data {
        flex: 0;

        columns: 2;
        gap: 0 16px;


        div {
          break-inside: avoid;
          padding: 4px 0;
        }

        .double {
          display: grid;
          grid-template-columns: 1fr 1fr;
          grid-template-areas: 'label label' 'left right';
          gap: 0 8px;

          label {
            grid-area: label;
          }
        }

        .editor {
          background-color: rgba(0, 0, 0, 0.2)
        }

        & + .meta-data {
          flex: 1;
        }
      }

      .meta-data.html {

        & > div {
          display: flex;
          flex-direction: column;
          height: 100%;

          label {
            flex: 0;
          }

          .editor {
            flex: 1;
          }
        }

      }

    }

    .tab.attributes.active {
      height: 100%;

      .attribute {
        padding: 8px 0;
        display: flex;
        gap: 0 8px;

        label {
          width: 120px;
          text-align: right;
          vertical-align: middle;
          line-height: 24px;
        }

        input {
          max-width: 80px;
          text-align: right;
        }

        .mod {
          color: grey;
          text-shadow: 0 -1px 0 #ccc;
          box-Shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
          border-radius: 4px;
          height: 24px;
          width: 24px;
          background: linear-gradient(0deg, rgba(24, 24, 24, 1) 0%, rgba(80, 80, 80, 1) 100%);;
          display: inline-block;
          text-align: center;
          vertical-align: middle;
          line-height: 24px;
          margin-left: 4px;
        }

      }

      .attributes-overview {

        columns: 2;
        gap: 0 16px;

      }

      .resource-overview {

        .attribute {

        }

      }

      .advantages, .special-abilities {
        margin-bottom: 16px;

        ul {
          list-style-type: none;
          padding: 0;
          margin: 0;
          text-indent: 0;

          li {
            display: inline-block;
          }

          .advantage, .special-ability {
            position: relative;
            border: 1px solid gold;
            box-shadow: 2px 2px 4px #000;
            border-radius: 8px;
            height: 24px;
            color: gold;
            text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
            display: inline-block;
            padding: 0 8px;
            margin-left: 0;
            margin-bottom: 4px;
            background-image: url("../assets/velvet_button.png");
            background-repeat: repeat-y;
            background-size: cover;

            span {
              position: relative;
              z-index: 2;
              line-height: 24px;
              vertical-align: middle;
            }

            &.special-ability {
              &::after {
                background: rgba(128, 0, 96, 0.5);
              }
            }

            &::after {
              content: "";
              position: absolute;
              left: 0;
              top: 0;
              right: 0;
              bottom: 0;
              border-radius: 8px;
              background: rgba(0, 128, 0, 0.5);
            }

            & + .advantage, & + .special-ability {
              margin-left: 8px;
            }

            &.nachteil {
              font-style: italic;

              &::after {
                background: rgba(128, 0, 0, 0.5);
              }
            }
          }
        }

      }


    }

    .backpack.active {
      display: grid;
      grid-template-columns: 1fr 320px;
      grid-template-rows: 74px 1fr;
      gap: 10px;
      height: 100%;
      grid-template-areas:
      "capacity capacity"
      "inventory equipment";

      .capacity {

        grid-area: capacity;

        .resource {

          position: relative;
          border: 1px inset #ccc;
          background-color: rgba(0, 0, 0, 0.2);
          height: 8px;

          span.fill {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            background: linear-gradient(to bottom, #0bad29 0%, #11f128 50%, #0cde24 51%, #6ff77b 100%);
          }

        }
      }

      .inventory {
        grid-area: inventory;

        .equipment:hover {
          .item-name {
            text-shadow: 0 0 10px rgb(255 0 0);
          }
        }
      }
    }


    .tab.combat.active {

      display: grid;

      grid-template-columns: 1fr 320px;
      grid-template-rows: 32px 32px 1fr;
      grid-template-areas: "res res" "wounds wounds"  "actions actions";
      gap: 10px;

      .tab-resources {
        grid-area: res;
      }

      .wounds {
        position: relative;
        height: 24px;
        display: flex;
        margin-bottom: 8px;
        padding-left: 130px;
        grid-area: wounds;

        label {
          position: absolute;
          left: 0;
          top: 0;
          line-height: 24px;
          width: 120px;
          bottom: 0;
          vertical-align: middle;
          text-align: right;
          height: 24px;
          display: inline-block;
          z-index: 2;
        }

        .filled-segment {
          border: 1px solid black;
          background-image: url('../assets/gradient.png');
          background-size: 24px 100%;
          position: relative;
          flex: 1;
          text-align: center;
          vertical-align: middle;
          line-height: 24px;
          color: white;
          text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
          background-color: rgba(255, 0, 0, 0.8);
          background-blend-mode: multiply;

        }

        .empty-segment {
          border: 1px solid black;
          background-image: url('../assets/gradient.png');
          background-size: 32px 100%;
          position: relative;
          flex: 1;
          text-align: center;
          vertical-align: middle;
          line-height: 24px;
          color: gold;
          text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
          background-color: rgba(0, 0, 0, 0.8);
          background-blend-mode: multiply;

        }

      }

      .actions {
        grid-area: actions;
      }

      &.zones {
        grid-template-areas: "res res" "wounds wounds"  "actions paperdoll";

        .paperdoll {
          grid-area: paperdoll;

          div {
            position: relative;
            margin-left: 9px;
            margin-top: 42px;

            .wound {
              position: absolute;
              width: 32px;
              height: 32px;
              border-radius: 16px;
              border: 1px solid black;
              background-color: rgba(0, 0, 0, 0.5);
              box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
              line-height: 32px;
              vertical-align: middle;
              text-align: center;
              color: red;


              &.armlinks {
                top: 146px;
                left: 210px;
              }

              &.armrechts {
                top: 146px;
                left: 60px;
              }

              &.beinlinks {
                top: 346px;
                left: 210px;
              }

              &.beinrechts {
                top: 346px;
                left: 60px;
              }

              &.bauch {
                top: 166px;
                left: 136px;
              }

              &.kopf {
                top: 6px;
                left: 136px
              }

              &.brust {
                top: 86px;
                left: 110px;
              }

            }

            .armor {
              position: absolute;
              width: 32px;
              height: 32px;
              border-radius: 0 0 16px 16px;
              line-height: 32px;
              vertical-align: middle;
              text-align: center;
              border: 1px solid silver;
              background-color: rgba(0, 0, 0, 0.5);
              box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
              color: silver;

              &.armlinks {
                top: 180px;
                left: 210px;
              }

              &.armrechts {
                top: 180px;
                left: 60px;
              }

              &.beinlinks {
                top: 380px;
                left: 210px;
              }

              &.beinrechts {
                top: 380px;
                left: 60px;
              }

              &.bauch {
                top: 200px;
                left: 136px;
              }

              &.kopf {
                top: 40px;
                left: 136px
              }

              &.brust {
                top: 120px;
                left: 110px;
              }
            }
          }

        }

      }


    }

    .tab.spells {

      tr {
        height: 24px;
        margin: 0;
        padding: 0;
      }

      td {
        margin: 0;
        padding: 0;
        height: 24px;
      }

      $color: #05f;

      .spell.rollable svg {
        width: 24px;
        height: 24px;
        top: 1px;
        z-index: 1;
        position: relative;

        .border {
          fill: #0000;
        }

        .center {
          fill: $color;
          stroke: colour.$rollable-die-border-color;
        }

        .topleft {
          fill: color.adjust($color, $lightness: numbers.$lighter_factor);
          stroke: colour.$rollable-die-border-color;
        }

        .bottomleft {
          fill: color.adjust($color, $lightness: numbers.$lightest_factor);
          stroke: colour.$rollable-die-border-color;
        }

        .topright {
          fill: color.adjust($color, $lightness: numbers.$darken_factor);
          stroke: colour.$rollable-die-border-color;
        }

        .bottomright, .bottom {
          fill: color.adjust($color, $lightness: numbers.$darkest_factor);
          stroke: colour.$rollable-die-border-color;
        }
      }

      .die-column {
        width: 24px;
      }

      .clickable {
        span {
          position: relative;
          z-index: 1;
        }
      }

      tbody {

        tr {

          position: relative;

          &::after {
            content: '';
            background-image: linear-gradient(to right, rgba(color.scale($color, $lightness: numbers.$zebra_light), numbers.$start_gradient), rgba(color.scale($color, $lightness: numbers.$zebra_light), numbers.$end_2_gradient));
            border-top-right-radius: 8px;
            border-bottom-right-radius: 8px;
            position: absolute;
            top: 2px;
            left: 12px;
            bottom: 2px;
            right: 33%;
            z-index: 0;
            pointer-events: none;
          }

          &:nth-child(odd) {
            &::after {
              background-image: linear-gradient(to right, rgba(color.scale($color, $lightness: numbers.$zebra_dark), numbers.$start_gradient), rgba(color.scale($color, $lightness: numbers.$zebra_dark), numbers.$end_2_gradient));
            }
          }
        }

      }

      .merkmal-list {
        list-style: none;
        margin: 0;
        padding: 0;
        text-indent: 0;

        li {
          display: inline-block;
          padding: 0 4px;
        }
      }

    }

    .tab.liturgies {

      table {
        border-top: unset;
        border-bottom: unset;
        position: relative;
      }

      .liturgy-header {
        background: unset;
        border: unset;

        tr {
          height: 90px;

          th {
            vertical-align: middle;
            color: black;
            text-shadow: 2px 2px 1px rgba(0, 0, 0, 0.2);
          }
        }
      }

      td, th {
        padding-left: 8px;
      }
    }

    .tab-resources {
      display: flex;
      justify-content: center;
      gap: 0 16px;
      padding-bottom: 8px;

      & > div {


        height: 32px;
        position: relative;

        label {
          width: 80px;
          line-height: 32px;
          vertical-align: middle;
        }

        input {
          display: inline-block;
          width: 40px;
          height: 32px;
        }

        span.inline {
          line-height: 32px;
          vertical-align: middle;
          width: 40px;
          text-align: center;
        }


      }

    }

  }

}
