/* Variables */

:root {
  /* Grid setup */
  --dashboard-grid-cols: 12;
  --dashboard-grid-gap: 25px;
  --dashboard-grid-gap-large: 40px;

  /* Grid sizes */
  --dashboard-grid-size-micro: 2;
  --dashboard-grid-size-mini: 3;
  --dashboard-grid-size-small: 4;
  --dashboard-grid-size-normal: 6;
  --dashboard-grid-size-large: 8;

  /* Colors */
  --dashboard-color-body-bg: #f0f3f7;
  --dashboard-color-panel-bg: #fff;
  --dashboard-color-separator: #e5e5e5;

  --dashboard-color-text-light: #97aab4;

  --dashboard-color-icon: #97aab4;

  --dashboard-color-button-bg: #f0f3f7;
  --dashboard-color-button-border: #d7dadf;
  --dashboard-color-button-text: #354b60;
  --dashboard-color-button-hover-bg: #6c8dae;
  --dashboard-color-button-hover-text: #fff;

  --dashboard-color-th-bg: #fafbfc;

  --dashboard-color-list-hover-bg: #fafbfc;

  --dashboard-color-success: hsl(151, 45%, 47%);
  --dashboard-color-success-bg: hsl(151, 45%, 95%);
  --dashboard-color-warning: hsl(26, 84%, 51%);
  --dashboard-color-warning-bg: hsl(26, 84%, 94%);
  --dashboard-color-error: hsl(4, 74%, 57%);
  --dashboard-color-error-bg: hsl(4, 74%, 96%);
  --dashboard-color-progress: #354b60;
  --dashboard-color-progress-bg: hsl(201, 16%, 80%);

  /* Font sizes */
  --dashboard-fontsize-icon: 1.25em;

  /* Panels */
  --dashboard-card-shadow: 0 5px 15px rgba(0,0,0,.08);
  --dashboard-card-border-radius: 4px;
  --dashboard-card-padding-content-x: 20px;
  --dashboard-card-padding-content-y: 20px;
  --dashboard-card-padding-header-x: 20px;
  --dashboard-card-padding-header-y: 13px;
  --dashboard-card-padding-list-y: 10px;
}

@media (min-width: 768px) {
  :root {
    --dashboard-grid-gap-large: 75px;
  }
}

body.Dashboard {
  background-color: var(--dashboard-color-body-bg);
  min-height: 100vh;
}

.AdminThemeUikit.Dashboard {
  #pw-footer {
    margin-bottom: 0;
  }
}

.AdminThemeReno.Dashboard,
.AdminThemeDefault.Dashboard {
  #main, #breadcrumbs, #headline, #content, #footer {
    background-color: var(--dashboard-color-body-bg);
  }
}

.AdminThemeDefault.Dashboard {
  #breadcrumbs {
    border-color: transparent;
  }
}

/* Remove paragraph margins */

.Dashboard__panel p {
  &:first-child {
    margin-top: 0;
  }
  &:last-child {
    margin-bottom: 0;
  }
}

/* Add UiKit base styles for other admin themes */

.uk-card {
  background: var(--dashboard-color-panel-bg);
  box-shadow: var(--dashboard-card-shadow);
  transition: box-shadow .1s ease-in-out;
  position: relative;
  box-sizing: border-box;
  border-radius: var(--dashboard-card-border-radius);
}

.uk-card-header {
  border-bottom: 1px solid var(--dashboard-color-separator);
}

.uk-card-title {
  margin: 0 !important;
  line-height: 1;
}

.uk-card-small .uk-card-body,
.uk-card-small.uk-card-body {
  padding: var(--dashboard-card-padding-content-y) var(--dashboard-card-padding-content-x);
}

.uk-card-small .uk-card-header {
  padding: var(--dashboard-card-padding-header-y) var(--dashboard-card-padding-header-x);
}

.uk-card-small .uk-card-footer {
  padding: var(--dashboard-card-padding-header-y) var(--dashboard-card-padding-header-x);
}

/* Dashboard without headline */

.DashboardNoHeadline {
  #pw-content-head h1 {
    display: none;
  }
  #pw-content-body {
    padding-top: 20px;
  }
}

/* Module info footer */

.Dashboard__info {
  padding-top: 3em;
  a {
    color: inherit;
  }
}

/* Get started notice */

.Dashboard__getStarted {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 80vh;

  p {
    margin-bottom: 0;
    &:nth-child(2) {
      font-size: 1.25em;
      font-weight: bold;
    }
    &:nth-child(3) {
      a {
        color: inherit;
        text-decoration: underline;
      }
    }
    &:nth-child(4) {
      margin-top: 2em;
    }
  }

  .fa {
    font-size: 4em;
    color: var(--dashboard-color-icon);
  }
}

/* 12-column grid */

.Dashboard__grid {
  display: grid;
  grid-template-columns: repeat(var(--dashboard-grid-cols), 1fr);
  grid-gap: var(--dashboard-grid-gap);
  align-items: stretch;
}

.Dashboard__panel {
  grid-column: span var(--dashboard-grid-cols);
  display: flex;
  flex-direction: column;

  /* Reponsive sizes */

  @media (min-width: 768px) {
    grid-column: span var(--dashboard-grid-size-normal);
    &[data-size='micro'] {
      grid-column: span var(--dashboard-grid-size-micro);
    }
    &[data-size='mini'] {
      grid-column: span var(--dashboard-grid-size-mini);
    }
    &[data-size='small'] {
      grid-column: span var(--dashboard-grid-size-small);
    }
    &[data-size='large'] {
      grid-column: span var(--dashboard-grid-size-large);
    }
    &[data-size='full'] {
      grid-column: span var(--dashboard-grid-cols);
    }
  }

  /* Vertical alignment */

  &[data-align='top'] {
    align-self: start;
  }
  &[data-align='bottom'] {
    align-self: end;
  }
  &[data-align='center'] {
    align-self: center;
  }
}

/* Tabs */

.Dashboard__tabs {
  + .Dashboard__grid {
    margin-top: var(--dashboard-grid-gap-large);
  }
}

.Dashboard__tabs__list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 var(--dashboard-grid-gap);
  padding: 0;
  font-size: 1.25rem;
  font-weight: bold;
  li:not(:first-child) {
    margin-left: .5em;
  }
  li:not(:last-child) {
    margin-right: .5em;
  }
  a {
    color: var(--dashboard-color-text-light);
    text-decoration: none;
    transition: color .2s ease-in-out;
  }
  li a[aria-current='true'],
  a:hover {
    color: inherit;
    text-decoration: none;
  }
}

.Dashboard__tabs__content {
  &[aria-hidden='true'] {
    display: none;
  }
}

.Dashboard__tabs[data-cloak] {
  .Dashboard__tabs__list li:first-child a {
    color: inherit;
  }
  .Dashboard__tabs__content + .Dashboard__tabs__content {
    display: none;
  }
}

.Dashboard__panels > .Dashboard__tabs {
  margin-top: var(--dashboard-grid-gap);
}

/* Groups */

.Dashboard__group {
  display: flex;
  flex-direction: column;
  align-items: stretch;

  /* Added margin on bottom */
  &[data-margin='true'] {
    margin-bottom: var(--dashboard-grid-gap-large);
  }
}

.Dashboard__group__title {
  margin: 0 0 var(--dashboard-grid-gap) 0 !important;
  font-size: 1.25rem;
  font-weight: bold;
  color: inherit;
  .fa {
    display: none;
  }
}

.Dashboard__group .Dashboard__grid {
  flex: 1 0 auto;
  align-content: stretch;

  /* Vertical alignment */
  .Dashboard__group[data-align='top'] & {
    align-content: start;
  }
  .Dashboard__group[data-align='bottom'] & {
    align-content: end;
  }
  .Dashboard__group[data-align='center'] & {
    align-content: center;
  }
  .Dashboard__group[data-align='distribute'] & {
    align-content: space-between;
  }
  .Dashboard__group[data-align='fill'] & {
    align-content: stretch;
  }
}


/* Cards */

.Dashboard__panel {
  min-width: 0;

  &:not(.Dashboard__group) {
    overflow: hidden;
  }

  .uk-card-title {
    font-size: 1rem;
    font-weight: bold;
    color: inherit;

    /* Icon */
    .fa {
      margin-right: .4em;
      font-size: 1.15em;
      position: relative;
      top: .05em;
      opacity: .65;
      display: none;

      .Dashboard[data-icons='true'] & {
        display: inline-block;
      }
    }
  }

  .uk-card-body {
    flex-grow: 1;
  }

  &[data-style-center-title='true'] {
    .uk-card-header {
      text-align: center;
    }
  }

  &[data-style-borders='false'] {
    .uk-card-header,
    .uk-card-footer {
      border: none;
    }
  }

  &[data-style-padding='false'] {
    .uk-card-body {
      padding: 0;
    }
  }

  &[data-style-minimal='true'] {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    .uk-card-header,
    .uk-card-footer {
      border: none;
    }
  }
}

/* Buttons */

.AdminThemeUikit {
  .DashboardButton--light .ui-button {
    background: var(--dashboard-color-button-bg);
    color: var(--dashboard-color-button-text);
    &.ui-state-hover {
      background: var(--dashboard-color-button-hover-bg);
      color: var(--dashboard-color-button-hover-text);
    }
  }
}

/* Remove margin around tables */

.Dashboard__panel {
  .uk-card-body > .pw-table-responsive {
    margin: -20px;
    margin-bottom: -21px;
  }
  .uk-card-body > .AdminDataTable {
    margin-top: -10px;
    margin-bottom: 0px;
  }
  .AdminDataTable {
    .AdminThemeUikit & {
      th {
        background-color: var(--dashboard-color-th-bg);
      }
      th, td {
        &:first-child {
          padding-left: 20px;
        }
        &:last-child {
          padding-right: 20px;
        }
      }
    }
  }
}

/* Pagination */

.DashboardPagination {
  margin: 0;
  > * > * {
    background: var(--dashboard-color-button-bg);
    color: var(--dashboard-color-button-text);
    border-color: var(--dashboard-color-button-border);
    transition: background 200ms, color 200ms, border 200ms;
  }
   > * > :hover,
   > * > :focus {
    background: var(--dashboard-color-button-hover-bg);
    color: var(--dashboard-color-button-hover-text);
    border-color: var(--dashboard-color-button-hover-bg);
  }
  > .uk-active > *,
  > .uk-active > * > * {
    background: var(--dashboard-color-button-hover-bg);
    color: var(--dashboard-color-button-hover-text);
    border-color: var(--dashboard-color-button-hover-bg);
  }
}

.DashboardPaginationSeparator {
  pointer-events: none;
}

.DashboardFooterButtons {
  margin: -.5em;
  display: flex;
  flex-wrap: wrap;
  > * {
    display: inline-block;
    margin: .5em;
  }
  .ui-button {
    margin-right: 0;
  }
}

.DashboardFooterPagination {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  margin-bottom: -.5em;
  margin-right: -1em;
  margin-left: auto;
  padding-left: 1em;
  > * {
    margin-bottom: .5em;
    margin-right: 1em;
  }
}
