// Copyright (c) 2014, 2025, Oracle and/or its affiliates.  Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// WARNING: do not directly import this file, instead import the
//          version in your base theme's directory,
//          for example alta/widgets/_oj.alta.accordion.scss
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@import "../../utilities/oj.utilities";

@if $includeAccordionClasses != false {
  @include module-include-once("common.accordion") {

    /* accordion */
    /* --------------------------------------------------------------- */

    // This is to prevent the flash of unstyled content before the html becomes JET components.
    @if $initialVisibility == hidden {
      oj-accordion:not(.oj-complete) {
        visibility: hidden;
      }
    }

    oj-accordion {
      display: block;
    }

    /*
     * applied to the disabled accordion headerd
     */
    .oj-accordion-collapsible.oj-disabled > .oj-collapsible-header-wrapper {

        color: $textColorDisabled;
        background-color: $headerBgColorDisabled;

      background-image: none;
    }

    /*
     * need to reset margin (bottom) here because it's being set in collapsible
     */
    .oj-collapsible.oj-accordion-collapsible {
      margin: 0;
    }

    /*
     * applied to the accordion header but not to any nested collapsible headers
     */
    .oj-accordion-collapsible > .oj-collapsible-header-wrapper {
      padding-top: 3px;
      padding-bottom: 3px;

        border: 0 solid $headerBorderColor;
        border-width: $listViewHeaderBorderWidth;
        font-size: $header3FontSize;
        background-color: $headerBgColor;

    }

    /*
     * applied to the accordion header but not to any nested collapsible headers
     */
     .oj-accordion-collapsible > .oj-collapsible-header-wrapper > .oj-collapsible-header {
        font-size: $header3FontSize;
        background-color: $headerBgColor;
        @include oj-background-image($headerBgImage);
    }

    /*
     * need to restore top padding for the first nested collapsible,
     * because it's being reset in collapsible
     */
    .oj-collapsible-content > .oj-accordion-collapsible.oj-collapsible:first-child > .oj-collapsible-header-wrapper {
      padding-top: 3px;
    }

    /*
     * need to reset margin because it's being set in collapsible to -7px
     */
    .oj-accordion-collapsible > .oj-collapsible-header-wrapper > .oj-collapsible-header-icon {
      padding: 9px;
      outline-offset: -9px;

      @include oj-ltr() {
        margin: 0;
      }
      @include oj-rtl() {
        margin: 0;
      }
    }

    /*
     * applied to the accordion content but not to any nested collapsible contents
     */
    .oj-accordion-collapsible > .oj-collapsible-wrapper > .oj-collapsible-content {

      padding: $panelPadding;

    }

    /*
     * applied to the accordion header border bottom when collapsed
     */
    .oj-accordion-collapsible.oj-collapsed > .oj-collapsible-header-wrapper {

        border-width: $listViewHeaderBorderWidthCollapsed;
      
    }

    /*
     * applied to the accordion header border for the last child when collapsed
     */
    .oj-accordion-collapsible.oj-collapsed:last-child > .oj-collapsible-header-wrapper {
      border-bottom-width: 1px;
    }
    
  }
}
