/**
 * @license
 * Copyright Akveo. All Rights Reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 */

@use '../../styles/theming' as *;

@mixin nb-accordion-item-header() {
  border-bottom-width: nb-theme(accordion-header-border-width);
  border-bottom-style: nb-theme(accordion-header-border-style);
  border-bottom-color: nb-theme(accordion-header-border-color);
  color: nb-theme(accordion-header-text-color);
  font-family: nb-theme(accordion-header-text-font-family);
  font-size: nb-theme(accordion-header-text-font-size);
  font-weight: nb-theme(accordion-header-text-font-weight);
  line-height: nb-theme(accordion-header-text-line-height);
  padding: nb-theme(accordion-padding);

  @include nb-headings();
}

@mixin nb-accordion-theme() {
  nb-accordion {
    display: block;
    box-shadow: nb-theme(accordion-shadow);
    border-radius: nb-theme(accordion-border-radius);
  }

  nb-accordion-item-header {
    position: relative;
    @include nb-accordion-item-header();

    .expansion-indicator {
      position: absolute;
      @include nb-ltr(right, 1rem);
      @include nb-rtl(left, 1rem);
    }
  }

  nb-accordion-item {
    background-color: nb-theme(accordion-item-background-color);
    color: nb-theme(accordion-item-text-color);
    font-family: nb-theme(accordion-item-text-font-family);
    font-size: nb-theme(accordion-item-text-font-size);
    font-weight: nb-theme(accordion-item-text-font-weight);
    line-height: nb-theme(accordion-item-text-line-height);

    &.disabled nb-accordion-item-header {
      color: nb-theme(accordion-header-disabled-text-color);
      cursor: default;
    }

    &:first-child {
      border-top-left-radius: nb-theme(accordion-border-radius);
      border-top-right-radius: nb-theme(accordion-border-radius);
    }
    &:last-child {
      border-bottom-left-radius: nb-theme(accordion-border-radius);
      border-bottom-right-radius: nb-theme(accordion-border-radius);

      &.collapsed nb-accordion-item-header {
        border-bottom: none;
      }
    }
  }

  nb-accordion-item:not(.collapsed) + nb-accordion-item nb-accordion-item-header {
    border-top-color: nb-theme(accordion-header-border-color);
    border-top-style: nb-theme(accordion-header-border-style);
    border-top-width: nb-theme(accordion-header-border-width);
  }

  nb-accordion-item-body .item-body {
    flex: 1;
    -ms-flex: 1 1 auto;
    overflow: auto;
    padding: nb-theme(accordion-padding);
    position: relative;
  }
}
