@import "../../../mixins/flex-grid";
@import "../../../mixins/buttons";

.row {
  .simple-row();
}

*, *:after, *:before {
  box-sizing: border-box;
}

a {
  color: @base-color;
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  &:first-child {
    margin-top: 0;
  }
}

.message {
  width: 100%;
  overflow: hidden;
  margin-bottom: 15px;
  > .container {
    > .heading {
      font-weight: bold;
      color: inherit;
      font-size: 1.2em;
      margin: 0;
      + p {
        margin-top: 4px;
      }
    }
    padding: 15px 5px;
    border-radius: 5px;
    font-size: rem(20);
    text-align: center;
    min-height: 36px;
    background: lighten(@color-message, 47%);
    color: @color-message;
    border: 1px solid lighten(@color-message, 20%);
    color: #777;
    > p {
      color: inherit;
      margin: 0;
    }
  }

  &.error {
    > .container {
      border: 1px solid lighten(@form-invalid-color, 20%);
      background: lighten(@form-invalid-color, 50%);
      color: @form-invalid-color;
    }
  }

  &.success {
    > .container {
      background: lighten(@color-success, 47%);
      color: @color-success;
      border-color: lighten(@color-success, 20%);
    }
  }

  &.animate {
    transition: all 0.5s;
  }

  &.enter:not(.active), &.leave.active {
    height: 0 !important;
    margin-bottom: 0;
  }
}

.button-color(@color, @saturate: true) {
  @light-color: lighten(@color, 17%);

  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.15);
  background-color: @color;
  background-image: linear-gradient(@light-color, @color);
  & when (@saturate) {
    background-image: linear-gradient(saturate(@light-color, 13%), @color);
  }

  border-color: darken(@color, 7%);
}

.button-color-darken(@color) {
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.15);
  background-color: @color;
  //@dark-color: darken(@color, 0%);
  background-image: linear-gradient(lighten(@color, 8%), darken(@color, 5%));
  border-color: darken(@color, 12%);
}

@button-color-blue: desaturate(lighten(#0075a2, 20%), 45%);
@button-color-green: #60b044;
@button-color-cyan: adjust-hue(@button-color-green, 60deg);
@button-color-purple: adjust-hue(@button-color-green, 180deg);
@button-color-yellow: saturate(spin(@button-color-green, -60deg), 20%);
@button-color-orange: lighten(saturate(spin(@button-color-green, -80deg), 20%), 10%);
@button-color-red: @color-red;
//@button-color-red: saturate(lighten(adjust-hue(@button-color-green, -100deg), 5%), 10%);

button, .button {
  .wipe-button;
  .button-size(@font-size: 13px, @padding: 12px 20px, @border: 1px);
  display: inline-block;
  font-weight: bold;
  color: #333;
  background-color: #eee;
  background-image: linear-gradient(#fcfcfc, #eee);
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  cursor: pointer;

  &.green {
    .button-color(@color: @button-color-green);
  }

  &.red {
    .button-color(@color: @button-color-red);
  }

  &.blue {
    .button-color(@color: @button-color-blue);
  }

  &.base {
    .button-color(@color: @base-color);
  }

  &.orange {
    .button-color(@color: @button-color-orange);
  }

  &:disabled {
    .button-color(@color: #bbb, @saturate: false);
    border-color: #ccc;
  }
}

div.controls {
  display: flex;
  flex: 0 0 auto;
}

button.icon, .controls > .button, .controls > button {
  &.hidden {
    display: none;
  }
  &:not(:disabled) {
    cursor: pointer;
  }
  flex: 0 0 @input-height;
  width: @input-height;
  height: @input-height;
  padding: 0;
  text-indent: -9999px;
  position: relative;
  &:not(:last-child) {
    margin-right: 5px;
  }
  &:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-position: center center;
    background-repeat: no-repeat;
  }

  &.create {
    &:before {
      background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2232.56%22%20height%3D%2240%22%20viewBox%3D%220%200%2032.559811%2040%22%3E%3Cpath%20d%3D%22M32.56%2031.1h-5.023v-5.024h-3.88V31.1h-5.02v3.877h5.02V40h3.88v-5.023h5.023V31.1zM15.023%2040H0V0h22.767l9.793%209.782v12.664h-3.884V12.21H20.34V3.882H3.883v32.233h11.14V40z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E);
      background-size: auto 24px;
    }
  }

  &.save {
    &:before {
      background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2241.2%22%20viewBox%3D%220%200%2040%2041.200001%22%3E%3Cpath%20d%3D%22M22.967%205.233h4.3V13h-4.3V5.233zM32.7%200H0v41.2h40V7.3L32.7%200zM9.45%203H29.8v12.2H9.45V3zm24.783%2034.933H5.767V21.967h28.466v15.966zM31.25%2026.65H8.75v-2h22.5v2zm0%202.3H8.75v2h22.5v-2zm0%204.3H8.75v2h22.5v-2z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E);
      background-size: 25px auto;
    }
  }

  &.edit {
    background-color: blue;
    background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2230%22%20height%3D%2230%22%20viewBox%3D%220%200%2030%2030%22%3E%3Cpath%20d%3D%22M23.983%2015.8V30H0V6.017h14.19l-2.914%202.91H2.91V27.09h18.162v-8.38l2.91-2.91zm-13.316-1.984l5.503%205.5-7.28%201.648%201.777-7.148zM30%205.666L17.893%2017.77l-5.67-5.668L24.33%200%2030%205.667z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E);
    background-size: 25px auto;
  }

  &.publish {
    &:before {
      background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20410.79999%20271.047%22%20height%3D%22271.047%22%20width%3D%22410.8%22%3E%3Cpath%20d%3D%22M410.8%20178.826c0%2050.852-41.37%2092.22-92.22%2092.22h-36.85v-40h36.847c28.794%200%2052.22-23.425%2052.22-52.22%200-35.412-23.816-53.746-49.18-53.844C320.317%2066.08%20280.983%2040%20242.957%2040c-50.31%200-70.975%2038.08-76.13%2052.662-20.51-29.582-76.18-7.248-64.643%2032.348C67.65%20118.748%2040%20144.748%2040%20178.826c0%2028.795%2023.427%2052.22%2053.222%2052.22h50.512v40H93.222C41.37%20271.046%200%20229.68%200%20178.826%200%20137.42%2027.56%20101.7%2066.153%2090.365c10.854-36.998%2049.784-58.686%2086.933-48.78C175.326%2015.286%20207.86%200%20242.956%200c57.116%200%20105.366%2040.816%20115.782%2095.777%2031.603%2015.203%2052.062%2047.135%2052.062%2083.05zm-271.648%2015.96h33.84v76.26h79.486v-76.26h33.84l-73.582-73.708-73.584%2073.708z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E);
      background-size: 25px auto;
    }
  }

  &.unpublish {
    &:before {
      background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20410.79999%20381.01599%22%20height%3D%22381.016%22%20width%3D%22410.8%22%3E%3Cpath%20d%3D%22M410.8%20178.826c0%2050.852-41.37%2092.22-92.22%2092.22h-36.85v-40h36.847c28.794%200%2052.22-23.425%2052.22-52.22%200-35.412-23.816-53.746-49.18-53.844C320.317%2066.08%20280.983%2040%20242.957%2040c-50.31%200-70.975%2038.08-76.13%2052.662-20.51-29.582-76.18-7.248-64.643%2032.348C67.65%20118.748%2040%20144.748%2040%20178.826c0%2028.795%2023.427%2052.22%2053.222%2052.22h50.512v40H93.222C41.37%20271.046%200%20229.68%200%20178.826%200%20137.42%2027.56%20101.7%2066.153%2090.365c10.854-36.998%2049.784-58.686%2086.933-48.78C175.326%2015.286%20207.86%200%20242.956%200c57.116%200%20105.366%2040.816%20115.782%2095.777%2031.603%2015.204%2052.062%2047.135%2052.062%2083.05zM286.318%20307.308h-33.84v-76.26h-79.486v76.26h-33.84l73.582%2073.708%2073.584-73.708z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E);
      background-size: 25px auto;
    }
  }

  &.cancel {
    &:before {
      background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%220%200%2040%2040%22%3E%3Cpath%20d%3D%22M40%2020c0%2011.046-8.954%2020-20%2020S0%2031.046%200%2020%208.954%200%2020%200s20%208.954%2020%2020zm-3.883%200c0-8.908-7.21-16.116-16.117-16.116-8.908%200-16.117%207.21-16.117%2016.116%200%208.908%207.21%2016.116%2016.117%2016.116%208.908%200%2016.117-7.21%2016.117-16.116zM26.73%2030.34l-6.536-6.537-6.536%206.537-3.51-3.514%206.534-6.536-6.536-6.535%203.513-3.51%206.533%206.533%206.534-6.535%203.514%203.51-6.534%206.537%206.536%206.535-3.512%203.514z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E);
      background-size: 25px auto;
    }
  }

  &.reset {
    &:before {
      background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20384.52637%20411.9975%22%20height%3D%22411.998%22%20width%3D%22384.526%22%3E%3Cpath%20d%3D%22M324.19%2060.334C243.868-19.99%20113.713-20.11%2033.237%2059.97L.107%2026.84%200%20149.676l122.838-.105-31.336-31.334c48.3-47.9%20126.28-47.783%20174.424.363%2048.27%2048.27%2048.27%20126.53%200%20174.796-24.135%2024.134-55.766%2036.2-87.398%2036.2v82.4c52.72%200%20105.44-20.11%20145.664-60.335%2080.446-80.447%2080.446-210.88%200-291.327z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E);
      background-size: auto 22px;
    }
  }

  &.delete {
    &:before {
      background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2040%2048.88409%22%20height%3D%2248.884%22%20width%3D%2240%22%3E%3Cpath%20d%3D%22M40%203.325v4.75H0v-4.75h11.264c1.835%200%203.323-1.49%203.323-3.325h10.827c0%201.836%201.487%203.325%203.322%203.325H40zm-2.163%208.312v37.247H2.163V11.637h35.674zM13.04%2019.04c0-.985-.798-1.782-1.78-1.782-.984%200-1.78.797-1.78%201.78V41.6c0%20.985.796%201.783%201.78%201.783.982%200%201.78-.798%201.78-1.78V19.038zm8.74%200c0-.985-.797-1.782-1.78-1.782s-1.78.797-1.78%201.78V41.6c0%20.985.797%201.783%201.78%201.783s1.78-.798%201.78-1.78V19.038zm8.74%200c0-.985-.796-1.782-1.78-1.782-.982%200-1.78.797-1.78%201.78V41.6c0%20.985.798%201.783%201.78%201.783.984%200%201.78-.798%201.78-1.78V19.038z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E);
      background-size: auto 22px;
    }
  }

  &:disabled {
    &:before {
      opacity: 0.7;
    }
  }
}

.collection.list {
  .container:empty:before, &:empty:before {
    content: 'No models found.';
  }

  .model {
    position: relative;
    background: #fff;

    @border-color: #dddfe3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid @border-color;
    border-bottom: none;
    &:last-child {
      border-bottom: 1px solid @border-color;
    }

    > header {
      flex: 1 1 100%;
      h1 {
        font-size: rem(16);
        margin: 0;
        padding: 0;
        margin-right: 80px - @global-padding;
        //white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        a {
          //white-space: nowrap;
          text-overflow: ellipsis;
        }
      }

      ul {
        .wipe-list();
        font-size: rem(12);
        color: #666;
        line-height: 1.2;
      }
    }

    > .content {
      display: none;
    }
  }
}

.pagination {
  @transition-time: 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: @global-padding;
  margin-bottom: @global-padding;
  .results {
    .number {
      font-size: 1.2em;
      font-weight: bold;
    }
  }

  ul {
    .wipe-list();
    .clear();
    > li {
      display: block;
      float: left;
      top: 0;
      height: 25px;
      width: 25px;
      &:not(:last-child) {
        margin-right: 1px;
      }
      > a {
        background: grey;
        transition: top @transition-time, background @transition-time, padding @transition-time, height @transition-time;
        display: block;
        color: white;
        text-align: center;
        position: relative;
        padding: 0;
        top: 0;
        height: 26px;
        line-height: 26px;
        text-decoration: none;
        &:not(.nav) {
          background: lighten(grey, 20%);
        }
      }
      &.current, &:hover {
        > a.nav {
          height: 32px;
          top: -3px;
          padding-top: 3px;
          //bottom: -3px;
          font-weight: bold;
        }
      }
      &.current {
        > a.nav {
          background: darken(grey, 20%);
        }
      }
      &:hover:not(.current) {
        > a.nav {
          background: darken(grey, 10%);
        }
      }
    }
  }
}

table {
  @border-color-blue: #c1dce8;
  @border-color: #dddfe3;
  width: 100%;
  &.collection {
    td, th {
      padding: 10px;
    }

    thead {
      border: 1px solid @border-color-blue;
      background: #e6f1f6;
    }

    tbody {
      > tr {
        border: 1px solid @border-color-blue;
        border-top: none;
        border-bottom-color: @border-color;
        &:last-child {
          border-bottom-color: @border-color-blue;
        }

        &:nth-child(2n) {
          background: #eee;
        }
      }
    }
    th {
      color: darken(@base-color, 10%);
      font-weight: bold;
      text-align: center;
    }
  }
}
