@import "variables";
@import "mixins";



// ----- CONTENT SECTION RELATED STYLES ----- //

.content-section {
    display: flex;
    flex-direction: column; // This ensures the top-popup is on top of loading-content
    background: $background-primary;
    min-height: calc(100vh - 64px);
    position: relative;
}

.top-popup {
    width: 100%;
    position: -webkit-sticky;
    position: sticky;
    z-index: 900;
    top: 80px;
    left: 0;
    background: $background-secondary;
    text-align: center;
    padding: 10px 0;

    .nav-link:not(.active) {
        opacity: 0.5;
    }
}

.nav-link-wrapper {
    display: inline-block;
}

.nav-link {
    display: inline-block;
    padding: 10px 20px;
    margin: 0 10px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    color: white;
    transition: background 0.3s ease;

    &.active {
        border-bottom: 2px solid white;
        opacity: 1; // ensure the active link is always visible
        color: white;
    }
    
    &:hover {
        color: white;
    }
}


.tabs-content {
    flex: 1;
    // add padding to top only
    padding: 50px 0 0 0;
}

.background-color-section1 {
    background-color: $background-primary;
}

.background-color-section2 {
    background-color: $background-primary-off;
}

.card--primary {
    @include card-base($background-primary, $card-border);
    @include typography($font-color-header-primary, $font-color-primary);
    @include plot-styling($plot-background-color-primary, $plot-font-color-primary);


    .insight-value {
        color: $insight-value-primary-color;
    }
    .indicator-up {
        color: green;
    }
    .indicator-down {
        color: red;
    }
    .indicator-neutral {
        color: gray;
    }
}

.card--secondary {
    @include card-base($background-secondary, $card-border);
    @include typography($font-color-header-secondary, $font-color-secondary);
    @include plot-styling($plot-background-color-secondary, $plot-font-color-secondary);

    .insight-value {
        color: $insight-value-secondary-color;
    }
    .indicator-up {
        color: lighten(green, 15%);
    }
    .indicator-down {
        color: lighten(red, 10%);
    }
    .indicator-neutral {
        color: gray;
    }
}



.plot-title-primary {
    padding-top: 20px;
    padding-bottom: 20px;
    text-align: center;
}

.explanation-paragraph {
    padding: 20px 25px;
    text-align: justify;
    @include explanation-text();
    border: 2px solid darken($background-primary, 15%);
    border-radius: 8px;
    background-color: rgba($background-primary, 0.7);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    margin-left: auto;
    margin-right: auto;

    &:hover {
        box-shadow: 0 7px 18px rgba(0, 0, 0, 0.16);
        transform: translateY(-3px);
    }
}

.tooltip-custom {
    padding-left: 30px;

    .ph-info {
        font-size: 48px;
        color: $blue3;
        transition: color 0.5s ease, transform 0.5s ease;

        &:hover {
            color: darken($blue3, 10%);
            transform: scale(1.1);
        }
    }

    .tooltip-content {
        @include explanation-text();
        padding: 20px 25px;
        text-align: justify;
        border: 2px solid darken($background-primary, 15%);
        border-radius: 8px;
        background-color: $background-primary;
        color: darken($font-color-primary, 10%);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
        transition: all 0.5s ease;
        width: auto;
        min-width: 550px;
        max-width: 750px;
        visibility: hidden;
        opacity: 0;
        position: absolute;
        z-index: 1000;
        top: 50%;
        left: 110px; // Moved further to the right
        transform: translateY(-50%) scale(0.95);
        max-height: 300px;
        overflow-y: auto;

        &::after {
            content: "";
            position: absolute;
            top: 50%;
            left: -20px;
            border-width: 10px 10px 10px 0;
            border-color: transparent $background-primary transparent transparent;
            transform: translateY(-50%);
            z-index: -1; // Ensure it doesn't overlap the tooltip but is still visible
        }
    }

    &:hover .tooltip-content {
        visibility: visible;
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

.dbc-tooltip-custom {

    opacity: 1 !important;  

    .tooltip-inner {
        padding: 20px 25px;
        text-align: justify;
        border: 2px solid darken($background-primary, 15%);
        border-radius: 8px;
        background-color: $background-primary;
        color: darken($font-color-primary, 10%);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
        width: auto;
        min-width: 350px;
        max-width: 550px;        
    }          
}











.options {
    margin-top: 50px;
}

.card-graph-half,
.card-graph-third,
.card-graph-two-thirds,
.graphs-container {
    background-color: #fff;
    @extend %card-style;
}

.card-graph-half {
    width: 50%;
}

.card-graph-third {
    width: 33%;
}

.card-graph-two-thirds {
    width: 66%;
}

.card-ruleset {
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    transition: 0.3s;
    overflow: auto;
}

.card-ruleset pre,
.card-ruleset code {
    font-size: 16px;
}

.card-ruleset pre {
    text-align: left;
    line-height: 1.5;
    background-color: $background-secondary;
    border-radius: 5px;
    padding: 10px;
    overflow-x: auto;
}

.meal-header-title,
.insight-value-name,
.value-name,
.value-name-large {
    @extend %roboto-font;
}

.meal-header-title {
    font-weight: 400;
    font-size: 14pt;
    text-align: center;
    width: 100%;
    margin-bottom: 18px;
    border-bottom: 1px solid $card-border;
}

.metric-vis-element {
    width: 33%;
    font-size: 10pt;
    margin-bottom: 20px;
    @extend %card-style;
    text-align: left;
}

.metric-vis-name {
    background-color: $sidebar-background-color;
    padding: 5px;
    font-weight: 700;
}

.card-header {
    padding: 4px;
    text-align: center;
    font-weight: 400;
    font-size: large;
    border-bottom: 1px solid $border-color;
}

.insight-container {
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    transition: 0.3s;
}

.minimal-insight-container {
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 3px 6px rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 180px;
    height: 140px;
}

// Table view cell
.metric-insight-cell-container {
  padding: 10px;
  margin: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 3px 6px rgba(0, 0, 0, 0.05); // Softer shadows
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background-color: $background-primary-off;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2), 0 9px 30px rgba(0, 0, 0, 0.2);
    background-color: lighten($background-primary-off, 10%);
  }
}

// Table view cell alt
.metric-insight-cell-container-alt {
  @extend .metric-insight-cell-container;
  background-color: darken($background-primary-off, 5%);
}


.insight-value-name,
.value-name,
.value-name-large {
    font-size: 13px;
    display: block;
    align-items: flex-end;
    letter-spacing: 0.05em;
    flex: none;
    order: 0;
    align-self: stretch;
    flex-grow: 0;
}

.insight-value {
    font-size: 20px;
    text-align: center;
    letter-spacing: 0.09em;
    flex: none;
    order: 1;
    align-self: stretch;
    flex-grow: 0;
}

.value-name-large {
    font-size: 18px;
}

.metric-vis-prop-key,
.metric-vis-prop-value {
    min-width: 10px;
    display: inline-block;
    padding: 2px 5px;
    margin: 0px 5px 0px 0px;
    font-weight: 500;
}

.metric-vis-prop-key {
    background-color: rgb(100, 100, 100);
    color: #fff;
}

.metric-vis-prop-value {
    background-color: rgb(204, 204, 204);
}

.value-value {
    @include font-settings($roboto-font-settings);
    font-size: 20px;
    letter-spacing: 0.09em;
    color: $value-color;
    flex: none;
    order: 1;
    align-self: stretch;
    flex-grow: 0;
}

.loader-wrapper>div {
    visibility: visible !important;
}


// CONTENT SPECIFIC TO CAGE OVERVIEW SIDEBAR
// Switch selection
.cage-overview-select-view {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  margin-bottom: 10px;

  .single-cage-view-icon, .table-cage-view-icon {
    font-size: 26px;
  }
  .single-cage-view-icon {
    margin-right: 10px;
  }

  .table-cage-view-icon {
    margin-left: 10px;
  }
  .cage-view-text {
    margin: 0px 10px;
    font-size: 26px;
   }
}

.cage-overview-title-text {
    margin: 0px 10px;
    font-size: 26px;
    text-align: center;
}

// Table cell size selection radiogroup
.cage-overview-radio-group .form-check {
  display: block;
  min-height: 1.5rem;
  padding-left: 0;
  margin-bottom: 0.125rem;
  margin-right: 0;
}

.cage-overview-radio-group .btn {
    padding: 0.375rem 0.75rem;
    width: 40px;
    font-family: map-get($roboto-font-settings, 'font-family');
    font-style: map-get($roboto-font-settings, 'font-style');
    font-weight: map-get($roboto-font-settings, 'font-weight');
    font-size: 16px;
    color: $font-color-primary;
    background-color: $background-primary;
    border: 1px solid $theme-color-1;
    border-radius: 8px;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

    &:hover {
        color: $font-color-primary;
        border-color: darken($theme-color-1, 10%);
    }
}

.cage-overview-radio-group .btn-check:checked + .btn,
.cage-overview-radio-group .btn.active,
.cage-overview-radio-group .btn.show,
.cage-overview-radio-group .btn:first-child:active,
.cage-overview-radio-group :not(.btn-check) + .btn:active {
    background-color: $theme-color-1;
    border-color: darken($theme-color-1, 10%);
}

.cage-overview-metric-icon-table{
    font-size: 48px;
}
.cage-overview-metric-icon-card{
    font-size: 40px;
}

// Sidebar
.sidebar-tooltip-hover-to-show {
  position: fixed;
  left: 10px;
  top: 70%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: left top;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  color: white;
  padding: 0px;
  border-radius: 0px;
  cursor: pointer;
  opacity: 1;
  visibility: visible;
}

.tooltip-text {
  white-space: nowrap;
  font-size: 24px;
  margin: 0;
}

.tooltip-icon {
  margin-bottom: -10px;
}


#cage-overview-sidebar-trigger {
    position: fixed;
    left: 0;
    top: 0;
    width: 20px;
    height: 100vh;
    background-color: transparent;
}

#cage-overview-sidebar {
    transition: width 0.5s ease;
    width: 0;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: $background-primary-off;
    z-index: 901;
    overflow-x: hidden;
    opacity: 0;
}

#cage-overview-sidebar-trigger:hover + #cage-overview-sidebar,
#cage-overview-sidebar:hover {
    width: 400px;
    opacity: 1;
}

.cage-overview-sidebar-content {
    transition: opacity ease-in 0.8s;
    padding-top: 100px;
    padding-left: 20px;
    color: transparent;
    opacity: 0;
}

#cage-overview-sidebar:hover .cage-overview-sidebar-content {
    opacity: 1.0;
    color: $heading-font-color;
}


// Tooltip
.cage-overview-metric-tooltip .tooltip-inner {
    font-size: 26px;
    background-color: $background-primary-off;
    color: $font-color-primary;
    text-align: center;
    max-width: 500px;
    padding: 10px
}


// Button part of each metric
.metric-toggle-button {
  width: 100%;
  transition: background-color 0.3s ease;
  background-color: rgba($background-primary-off, 0.5);
  border: none;
  border-radius: 15px;
  padding: 10px;
  cursor: pointer;

  &:active {
    background-color: rgba($background-primary-off, 0.5);
  }

  &:hover, &:focus {
    background-color: rgba(lighten($background-primary-off, 10%), 0.5);
  }

  .button-content {
    display: flex;
    align-items: center;
    width: 100%;

    .icon-element {
      flex-shrink: 0;
    }

    .toggle-metric-text {
      flex-grow: 1;
      font-size: 22px;
      background-color: transparent;
      justify-content: center;
      text-align: center;
      font-weight: bold;
      margin: 0;
      padding: 0 1rem;
    }

    .selected-icon-element {
      opacity: 0;
      transition: opacity 0.3s ease;
      padding-right: 10px;
    }
  }
}

.metric-toggle-button-on {
  background-color: rgba($background-primary-off, 0.5);
  &:active {
    background-color: rgba($background-primary-off, 0.5);
  }

  &:hover, &:focus {
    background-color: rgba(lighten($background-primary-off, 10%), 0.5);
  }

  .button-content {
      .selected-icon-element {
        opacity: 1;
        padding-right: 10px;
      }
  }
}
// Override bootstrap defaults
.metric-toggle-button.btn, .metric-toggle-button.btn:hover, .metric-toggle-button.btn:focus, .metric-toggle-button.btn:active {
  --bs-btn-bg: transparent;
  --bs-btn-active-bg: transparent;
  --bs-btn-active-border-color: transparent;
  --bs-btn-border-color: transparent;
}

.cages-reports-table-container {
    overflow-x: auto; /* Enables horizontal scrolling */
    display: block;
    flex-direction: column;
    width: 100%;
    border-radius: 10px;
}

.cages-reports-table-inner {
    min-width: 500px;
    padding: 10px;
}

.cages-reports-table-container .cages-reports-table-inner .row {
    flex-wrap: nowrap !important;
}

.cages-reports-table-cage-name-cell {
  margin: auto;  
  font-size: 20px;
}

.cages-reports-table-header-metric-title {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  min-height: 75px;
  margin-bottom: 0;
}

.daily-feeding-tab-parent {
    .tab-container{
        justify-content: right !important;
        border-bottom: solid; 
        height: 50px;
    }
}

.daily-feeding-tab {
    background: lighten($background-primary, 10%);
    border-radius: 5px 5px 0px 0px;
    text-decoration: none;
    font-size: 19px;
    font-weight: bold;
    color: $sidebar-font-color;
    opacity: 0.7;
    max-width: 200px;
    padding-top: 10px !important;
    padding-bottom: 15px !important;
    display: flex;
}

.daily-feeding-tab--selected {
    border: transparent !important;
    color: black !important;
    opacity: 1; 
}

.daq-toggleswitch--light__indicator {
    &--on{
        display: none;
    }
    &--off{
        display: none;
    }
}

.daq-toggleswitch {
    display: flex;
    justify-content: center;
    margin: 0 auto;
}