/* main data table */
.dataTable {
  border: 0;
  width: 100%;
  padding: 0;
  border-spacing: 0;
  border-collapse: separate;
  margin: 0;

  td {
    border-radius: 1px;
  }

  td .ratio {
    color: #999999;
    display: inline-block;
    visibility: hidden;
    text-align: right;
    margin-right: 4px;
    font-weight: normal;
    .font-default(13px, 18px);
    vertical-align: text-bottom;
  }

  thead {
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    z-index: 10;

    &.with-z-index {
      z-index: 150;
    }
  }

  td.highlight > .ratio {
    visibility: visible;
  }
}

table.dataTable .totalsRow {
  font-weight: bold;
  .ratio {
    display: none;
  }
}

table.dataTable td.label,
table.subDataTable td.label {
  width: 100%;
  white-space: nowrap;
}

table.dataTable img,
table.subDataTable img {
  vertical-align: text-bottom;
}

table.dataTable img {
  border: 0;
  margin-right: 1em;
  margin-left: 0;
}

table.dataTable tr td .icon-outlink {
  color: #aaa;
  margin-right: 0.5em;
  vertical-align: bottom;
  .font-default(13px, 18px);
  padding-left: 1px;
  display: inline-block;
}

table.dataTable tr.subDataTable {
  cursor: pointer;

  td.label span.label {
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    width: inherit;
    display: inline-block;
    vertical-align: text-bottom;
  }
}

table.dataTable th {
  margin: 0;
  text-align: left;
  padding: 6px 6px 6px 12px;
  font-size: 12px;
  font-weight: normal;
  vertical-align: top;
}

// for dataTables in exported widgets ( we do not want to apply this for widgets in dashboard )
body>.widget table.dataTable {
  th {
    background: @theme-color-background-base;
  }
}

// for dataTables in report pages (not for widgets in the dashboard)
.theWidgetContent .card .card-content table.dataTable,
table.dataTable,
table.subDataTable {

  th {
    background: @theme-color-background-base !important;
    border-radius: 0;
    color: @theme-color-text-contrast;

    &:first-child {
      padding-left: 20px;
    }
    &:last-child {
      padding-right: 20px;
    }
  }

  td {
    &:first-child {
      padding-left: 20px;
    }

    &:last-child {
      padding-right: 20px;
    }
  }
}

table.dataTable th.sortable {
  cursor: pointer;
}

table.dataTable th.columnSorted {
  font-weight: bold;
}

table.dataTable td {
  padding: 5px 0 5px 12px;
  background: @theme-color-background-base;
  z-index: 99;
}

table.dataTable td,
table.dataTable td a {
  margin: 0;
  text-decoration: none;
  color: @theme-color-text-light;
}

td.clean {
  background-color: @theme-color-background-base;
}

table.dataTable td.column {
  white-space: nowrap;
}

.dataTable tr.highlight td,
.dataTable_row-highlight td {
  font-weight: bold;
}

tr:nth-last-child(1 of .dataTable_row-group) td {
  border-bottom: 3px solid @theme-color-background-tinyContrast !important;
}

table.dataTable th.label,
table.dataTable td.label,
table.subActionsDataTable td.label,
table.actionsDataTable td.label {
  border-top: 0;
  border-left: 0;
  left: 0;
  z-index: 1;
  background-clip: padding-box;

  &.first {
    position: sticky; position: -webkit-sticky;
  }
}

.dataTableActions table.dataTable th.label {
  /* Ensures tables have enough space to display subtable on click, and prevent the jumping effect */
  min-width: 250px;
}

table.dataTable span.label.highlighted {
  font-style: italic;
}

.widget div.dataTable:not(.isComparing) table.dataTable tbody > tr > td:not(.cellSubDataTable):first-child {
  padding-left: 12px;
}

/* the cell containing the subdatatable */
table.dataTable tr td.cellSubDataTable {
  &, .widget & {
    margin: 0;
    border-left: 0;
    padding: 6px 20px 6px;
  }
}

.cellSubDataTable > .dataTable {
  padding: 6px 0 0;
}

/* A link in a column in the DataTable */
table.dataTable td #urlLink {
  display: none;
}

.subDataTable > .dataTableWrapper {
  width: 95%;
}

.sortIconContainer {
  float: left;
  position: relative;
}

.sortIcon {
  margin: 0;
  position: absolute;
}

.datatableHeaderMessage, .datatableFooterMessage {
  color: #888;
  text-align: left;
  margin: 10px;
  margin-left: 1px;
}

.dataTablePages {
  margin: 10px;
  color: @theme-color-text;
  font-weight: normal;
  .font-default(13px, 14px);
}

.dataTableSearchInput {
  display: inline-block;
  opacity: 0;
  color: #adadad !important;
  min-height: 30px !important;
  padding-left: 25px !important;
  transition: opacity 0.3s ease !important;
  box-shadow: 0 0 !important;
  visibility: hidden;
  height: 1rem !important;
  width: calc(~'100% - 25px') !important;
}

.searchAction:hover {
  .dataTableSearchInput {
    &:hover,
    &:focus {
      color: #333 !important;
    }
  }
}

.searchAction {
  transition: width 0.3s ease !important;
  text-align: left !important;
  padding-left: 10px;
  position: relative;
  cursor: pointer;

  .icon-search {
    display: inline-block;
    cursor: pointer;
    z-index: 1;
    position: absolute;
    top: 8px;
    left: 8px;
  }

  .icon-close {
    display: none;
  }
}

.searchAction.searchActive {
  cursor: text;

  .dataTableSearchInput {
    visibility: visible;
    opacity: 1;
  }

  .icon-close {
    display: inline-block;
    font-size: 10px;
    cursor: pointer;
    position: absolute;
    top: 12px;
    right: 10px;
    color: #adadad !important;
    &:hover,
    &:focus {
      color: #333 !important;
    }
  }
  .icon-search {
    cursor: pointer;
    color: #adadad !important;
    &:hover,
    &:focus {
      color: #333 !important;
    }
  }
}

.dataTableNext,
.dataTablePrevious {
  font-size: 12px;
  color: #184A83;
  cursor: pointer;
  visibility: hidden;
  text-decoration: underline;
  &:hover {
    text-decoration: underline;
  }
  @media print{
    display: none;
  }
}

.datatableRelatedReports {
  color: #808080;
  font-size: 12px;
  padding-bottom: 5px;
  margin-top: 6px;
  @media print{
    display: none;
  }

  span {
    color: @theme-color-link;
    cursor: pointer;
    font-weight: normal;
    text-decoration: underline;

    &:hover {
      text-decoration: underline;
    }
  }
}

.dataTableFeatures {
  text-align: center;

  &.hasEvolution {
    .dataTableFooterIcons {
      margin-top: 17px;
    }
  }
}

.dataTablePaginationControl {
  margin: 5px 0 !important;
}

.dataTableFeatures .loadingPiwik {
  font-size: 13px;
  display: inline-block;
  padding-bottom: 13px;
}

.dataTable .loadingPiwikBelow {
  padding-bottom: 5px;
  display: block;
  text-align: center;
}

.dataTable.isComparingBarViz {
  padding-left: 10px;
  padding-top: 10px;
  position: relative;
  left: -10px;
  top: -10px;
}

.widget .dataTableFeatures {
  border-bottom-style: none !important;
}


// customizing footer appearance for row evolution graph
.ui-dialog .dataTableVizEvolution {

  .dataTableFooterIcons {
    display: block;
  }

  .dataTableFeatures {
    border-bottom-style: none !important;
    margin-top: 0 !important;
  }
}

.dataTableFooterWrap {
  position: relative;
  float: left;
  margin-left: 10px;
}

.dataTableFooterWrap select {
  float: left;
  margin: 1px 0 1px 10px;
}

.tableIcon {
  text-decoration: none;

  &:hover {
    text-decoration: none;
  }

  &.activeIcon {
    background-color: @theme-color-background-tinyContrast;
  }
}

.tableIconsGroup > span > span {
  position:relative;
  float:left;
}

.dataTableFooterActiveItem {
  display: none;
  position: absolute;
  top: -6px;
  left: 0;
}


.exportToFormatItems img {
  vertical-align: middle;
  margin: -4px -3px -2px 2px;
}

.tableIconsGroup {
  float: left;
  padding-right: 4px;
}

.tableIconsGroup .tableIcon span {
  margin-right: 5px;
  margin-left: 5px;
}

.tableIconsGroup img {
  vertical-align: bottom;
}

.tableIconsGroupActive {
  display: block;
  float: left;
  background: #dcdacf;
  border-radius: 2px;
}

.tableIconsGroupActive .tableIcon {
  background: none;
}

.tableIconsGroupActive .tableIcon:hover {
  background: #e9e8e1;
}

.dataTableSpacer {
  clear: both;
}

/* Actions table */
.dataTableActions table.dataTable tr td.label {
  background-image: none;
}

/* levels higher than 4 have a default padding left */
.actionsDataTable tr td.label {
  padding-left: 7em;
}

tr.level0 td.label {
  padding-left: 20px !important;
}

.widget {
  div.dataTable:not(.isComparing) table.dataTable tr.level0 td.label,
  div.dataTable:not(.isComparing) table.dataTable th {
    padding-left: 12px !important;
  }
}

tr.level1 td.label {
  padding-left: 2.5em !important;

  .widget & {
    padding-left: 28px !important;
  }
}

tr.level2 td.label {
  padding-left: 3.5em !important;
}

tr.level3 td.label {
  padding-left: 4.5em !important;
}

tr.level4 td.label {
  padding-left: 5em !important;
}
tr.level5 td.label {
  padding-left: 5.5em !important;
}
tr.level6 td.label {
  padding-left: 6em !important;
}
tr.level7 td.label {
  padding-left: 6.5em !important;
}
tr.level8 td.label {
  padding-left: 7em !important;
}
tr.level9 td.label {
  padding-left: 7.5em !important;
}
tr.level10 td.label {
  padding-left: 8em !important;
}
tr.level11 td.label {
  padding-left: 8.5em !important;
}
tr.level12 td.label {
  padding-left: 9em !important;
}

table.dataTable td.label img {
  max-height: 16px;
}

.pk-emptyDataTable {
  padding-top: 20px;
  padding-bottom: 10px;
  padding-left: 1px;
}

.widget .pk-emptyDataTable {
  padding-left: 0;
  padding-top: 33px;
  text-align: center;
}

.helpDate {
  color: #777777;
  font-size: 11px;
  font-style: italic;
  padding: 4px;
  text-align: right;
  display: block;
}

body .ui-tooltip.rowActionTooltip {
  font-size: 11px;
  padding: 3px 5px 3px 6px;
}

table.dataTable span.cell-tooltip {
  cursor: default;
}

.dataTable .jqplot-graph {
  > div {
    position: relative;
  }
}

td.cellSubDataTable .loadingPiwik {
  padding:0;
}

.dataTable .searchReset {
  position:relative;

  img {
    position: absolute;
    top: 4px;
    left: -15px;
    cursor: pointer;
    display: inline;
  }
}

.dataTableControls {
  text-align: left;
  padding-left: 0 !important;

  &.col {
    padding-right: 0;
  }

  .dropdown-content {
    a {
      &:hover {
        text-decoration: none;
      }
    }
  }

  .dataTableAction {
    border: 0;
    border: none;
    border-radius: 2px;
    display: inline-block;
    height: 36px;
    line-height: 36px;
    outline: 0;
    width: 36px;
    text-transform: uppercase;
    vertical-align: middle;
    text-decoration: none !important;
    text-align: center;
    font-size: 16px;
    color: @theme-color-brand !important;
    opacity: 0.7;
    &:hover {
      color: @theme-color-brand !important;
      opacity: 1;
      background-color: @theme-color-background-base;
      text-decoration: none !important;
    }

    .icon-export {
      margin-top: 8px;
      display: block;
    }

    .icon-more-verti {
      font-size: 18px;
    }

    .periodName {
      padding-left:8px;
      padding-right:8px;
      font-size:16px;
      text-transform:capitalize;
    }
  }

  .activatePeriodsSelection {
    width:auto;
    text-align:left;
    padding-left:8px;
  }
}
.widgetContent {
  div.dataTableScroller {
    overflow-x: scroll;
  }
}
.dataTableHeaderControls {
  margin-top: -10px;
  margin-bottom: 5px;

  .widgetpreview-preview .widget &,
  #dashboardWidgetsArea .widget &,
  .dataTable.isDataTableEmpty:not(.hasSearchKeyword) & {
    display: none;
  }

  .widgetized .dataTable.dataTableVizHtmlTable .dataTableWrapper & {
    margin-top: 0;
  }
}

.theWidgetContent .card .card-content, table.dataTable {
  div.dataTableScroller {
    margin-left: -20px;
    width: ~"calc(100% + 40px)";
  }
}

#dashboard .dataTableFooterNavigation > .row {
  margin-left: 0;
  margin-right: 0;
}

@media only screen and (min-width: 993px) {
  #dashboardWidgetsArea .widget,
  .theWidgetContent .isDataTableEmpty {
    &:hover {
      .limitSelection,
      .dataTableControls .dataTableAction {
        visibility: visible;
      }
    }
    .limitSelection,
    .dataTableControls .dataTableAction {
      visibility: hidden;

      &.forceActionVisible {
        visibility: visible;
      }
    }
  }
  .theWidgetContent .isDataTableEmpty.hasSearchKeyword {
    .limitSelection,
    .dataTableControls .dataTableAction {
      visibility: visible;
    }
  }
}

@media only screen and (max-width: 700px) {
  table.dataTable th.label,
  table.dataTable td.label,
  table.subActionsDataTable td.label,
  table.actionsDataTable td.label {
    position: static !important;
  }
}
