/* ==========================================================================
   Accordion Component (.lm-accordion)
   Expandable accordion with icon, label, and optional body content
   ========================================================================== */

/* ==========================================================================
   Base Accordion
   ========================================================================== */

@layer utilities {
  .lm-accordion {
    border-radius: var(--radius-lg, 1rem);
    overflow: hidden;
  }

  /* Background Color Variants */
  .lm-accordion--bg-blue {
    background-color: #F5F8FC;
  }

  .lm-accordion--bg-gray {
    background-color: var(--color-blue-dark-muted-06, rgba(23, 50, 77, 0.06));
  }

  /* Spacing between accordion items (not last child) */
  .lm-accordion:not(:last-child) {
    margin-bottom: 12px;
  }

  @media (min-width: 1024px) {
    .lm-accordion:not(:last-child) {
      margin-bottom: 16px;
    }
  }

  /* ==========================================================================
    Header
    ========================================================================== */

  .lm-accordion__header {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
    width: 100%;
    padding: var(--space-4, 1rem) var(--space-4, 1rem);
    background: transparent;
    border: none;
    text-align: left;
    font-family: inherit;
    cursor: default;

    @media (min-width: 1024px) {
      gap: var(--space-3, 0.75rem);
      padding: var(--space-5, 1.25rem) var(--space-5, 1.25rem);
    }
  }

  /* Clickable header for expandable accordions */
  .lm-accordion--expandable {
    transition: background-color 0.33s ease;
  }

  .lm-accordion--expandable .lm-accordion__header {
    cursor: pointer;
    transition: background-color 0.33s ease;
  }

  .lm-accordion--expandable:hover {
    background-color: rgba(0, 58, 112, 0.05);
  }

  .lm-accordion--expandable .lm-accordion__header:focus-visible {
    outline: 2px solid var(--color-blue, #0077C8);
    outline-offset: -2px;
    border-radius: var(--radius-lg, 1rem);
  }

  /* ==========================================================================
    Icon
    ========================================================================== */

  .lm-accordion__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 38px;
  }

  .lm-accordion__icon-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 38px;
    max-height: 38px;
  }

  @media (min-width: 1024px) {
    .lm-accordion__icon {
      width: 48px;
      min-width: 48px;
    }

    .lm-accordion__icon-img {
      max-width: 48px;
      max-height: 48px;
    }
  }

  /* ==========================================================================
    Label
    ========================================================================== */

  .lm-accordion__label {
    flex: 1;
    min-width: 0;
    font-size: var(--theme-font-size-lg, 20px);
    font-weight: 600;
    line-height: var(--theme-line-height, 1.2);
    color: var(--color-blue-dark, #003A70);
  }

  @media (min-width: 1024px) {
    .lm-accordion__label {
      font-size: var(--theme-font-size-lg, 20px);
    }
  }

  /* Superscript styling */
  .lm-accordion__label sup {
    font-size: 0.65em;
    vertical-align: super;
    line-height: 0;
  }

  /* ==========================================================================
    Toggle Button
    ========================================================================== */

  .lm-accordion__toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;

    @media (min-width: 1024px) {
      width: 40px;
      height: 40px;
    }
  }

  .lm-accordion--bg-gray .lm-accordion__toggle {
    @media (min-width: 1024px) {
      width: 44px;
      height: 44px;
    }
  }

  .lm-accordion__toggle-expand,
  .lm-accordion__toggle-collapse {
    display: block;
    width: 34px;
    height: 34px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;

    @media (min-width: 1024px) {
      width: 40px;
      height: 40px;
    }
  }

  .lm-accordion--bg-gray .lm-accordion__toggle-expand,
  .lm-accordion--bg-gray .lm-accordion__toggle-collapse {
    @media (min-width: 1024px) {
      width: 44px;
      height: 44px;
    }
  }

  /* .lm-accordion__toggle-expand {
    background-image: url(/themes/custom/livmarli/images/icons/expand-icon.svg);
  } */

  .lm-accordion__toggle-icon {
    width: 100% !important;
    height: 100% !important;
    color: var(--color-blue-dark, #003A70);
  }

  .lm-accordion--bg-gray .lm-accordion__toggle-icon {
    color: var(--color-navy, #17324D);
  }

  .lm-accordion__toggle-collapse {
    /* background-image: url(/themes/custom/livmarli/images/icons/collapse-icon.svg); */
    display: none;
  }

  /* Expanded state: show collapse icon, hide expand icon */
  .lm-accordion--expanded .lm-accordion__toggle-expand {
    display: none;
  }

  .lm-accordion--expanded .lm-accordion__toggle-collapse {
    display: block;
  }

  /* ==========================================================================
    Body
    ========================================================================== */

  .lm-accordion__body {
    overflow: hidden;
    transition: max-height 300ms ease-out;
    padding: 0 var(--space-4, 1rem) var(--space-4, 1rem);

    @media (min-width: 1024px) {
      margin-top: calc(var(--space-1, 0.25rem) * -1);
      padding: 0 var(--space-5, 1.25rem) var(--space-5, 1.25rem);
    }
  }

  .lm-accordion__body[hidden] {
    display: block;
    max-height: 0;
    visibility: hidden;
  }

  .lm-accordion__body:not([hidden]) {
    visibility: visible;
  }

  .lm-accordion__body-content {
    padding: var(--space-4, 1rem);
    font-size: var(--theme-font-size, 18px);
    line-height: var(--theme-line-height, 1.4);
    color: var(--color-black, #313131);
    background: var(--color-white, #FFFFFF);
    border-radius: var(--radius-md, 0.5rem);
  }

  /* Lists in body */
  .lm-accordion__body-content ul,
  .lm-accordion__body-content ol {
    margin: 0;
    padding-left: 1.5em;
  }

  .lm-accordion__body-content ul {
    list-style-type: disc;
  }

  .lm-accordion__body-content ol {
    list-style-type: decimal;
  }

  .lm-accordion__body-content li {
    margin-bottom: 0.7em;

    @media (min-width: 1024px) {
      margin-bottom: 0.5em;
    }
  }

  .lm-accordion__body-content li:last-child {
    margin-bottom: 0;
  }

  /* Paragraphs in body */
  .lm-accordion__body-content p {
    margin-bottom: 1em;
  }

  .lm-accordion__body-content p:last-child {
    margin-bottom: 0;
  }

  /* Links in body */
  .lm-accordion__body-content a {
    color: var(--color-blue, #0077C8);
    text-decoration: underline;
  }

  .lm-accordion__body-content a:hover {
    color: var(--color-blue-dark, #003A70);
  }

  /* ==========================================================================
    Static Variant (no body, not expandable)
    ========================================================================== */

  .lm-accordion--static .lm-accordion__header {
    cursor: default;
  }

  .lm-accordion--static .lm-accordion__header:hover {
    background-color: transparent;
  }
}