/* ==========================================================================
   FTS Tabs
   Purpose:
   - Tab / accordion layout for Beaver Builder
   - Horizontal tabs on desktop
   - Accordion behavior on tablet / mobile
   - Light / dark label variants
   ========================================================================== */


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

.fts-tabs {
  --tabs-accent: var(--ocean);
  --tabs-text: var(--midnight);
  --tabs-muted: var(--slate);
  --tabs-bg: var(--white);
  --tabs-border: var(--cream);

  font-family: var(--font-sans);
  color: var(--midnight);
}

.fts-tabs__panel[hidden] {
  display: none !important;
}

/* ==========================================================================
   Tab label color variants
   Purpose:
   - Let authors choose dark or light tab labels only
   ========================================================================== */

.fts-tabs--dark {
  --tabs-label-color: var(--midnight);
}

.fts-tabs--light {
  --tabs-label-color: var(--white);
}

/* ==========================================================================
   Tab list
   Purpose:
   - Layout for the tab headers
   ========================================================================== */

.fts-tabs__list {
  display: flex;
  gap: 2.5rem;
  margin-bottom: 1rem;
}

.fts-tabs--horizontal .fts-tabs__list {
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
}

.fts-tabs--vertical .fts-tabs__list {
  display: inline-flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 200px;
  min-width: 180px;
  margin-bottom: 0;
  margin-right: 1.25rem;
  border-bottom: 0;
}


/* ==========================================================================
   Tab buttons
   Purpose:
   - Interactive tab labels
   ========================================================================== */

.fts-tabs__tab {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0.25rem 0;
  font-weight: 600;
  font-size: clamp(14px, 1.2vw, 16px);
  color: var(--tabs-label-color);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.fts-tabs__tab:hover {
  color: var(--ocean);
  /* background-color: none !important; */
  background: none !important;
  border: none !important;
}

.fts-tabs__tab[aria-selected="true"] {
  color: var(--sky);
  background: none !important;
  border: none !important;
}

.fts-tabs__tab:focus-visible {
  color: var(--sky);
  background: none !important;
  border: none !important;
}


/* ==========================================================================
   Label and icon
   Purpose:
   - Control label casing and icon placement
   ========================================================================== */

.fts-tabs__label {
  order: 1;
  text-transform: uppercase;
  font-weight: 600;
}

.fts-tabs__icon {
  display: inline-flex;
  order: 0;
}

.fts-tabs__tab[data-icon-position="right"] .fts-tabs__label {
  order: 0;
}

.fts-tabs__tab[data-icon-position="right"] .fts-tabs__icon {
  order: 1;
}


/* ==========================================================================
   Panels
   Purpose:
   - Panel container styling and spacing cleanup
   ========================================================================== */

.fts-tabs__panel {
  background: var(--tabs-bg);
  padding: 1rem;
}

.fts-tabs__panel-inner > :first-child {
  margin-top: 0;
}

.fts-tabs__panel-inner > :last-child {
  margin-bottom: 0;
}


/* ==========================================================================
   Vertical layout
   Purpose:
   - Tab list and panel layout when orientation is vertical
   ========================================================================== */

.fts-tabs--vertical {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

.fts-tabs--vertical .fts-tabs__panel {
  align-self: stretch;
  min-height: 100%;
  display: flex;
}

.fts-tabs--vertical .fts-tabs__panel-inner {
  flex: 1 1 auto;
}


/* ==========================================================================
   Variants
   Purpose:
   - Optional visual variants
   ========================================================================== */

.fts-tabs--minimal .fts-tabs__panel {
  border: 0;
  background: transparent;
  padding: 0.25rem 0;
}


/* ==========================================================================
   Responsive accordion
   Purpose:
   - Convert tabs to accordion behavior on smaller screens
   Rules:
   - Applies at 992px and below
   - JS controls panel height animation
   ========================================================================== */

@media (max-width: 992px) {

  /* Hide icon fonts on mobile so the accordion icon can own the right edge */
  .fts-tabs__tab .fts-tabs__icon,
  .fts-tabs__tab i {
    display: none !important;
  }

  .fts-tabs {
    display: block;
  }

  .fts-tabs__list {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    gap: 0;
  }

  .fts-tabs--vertical .fts-tabs__list {
    width: 100% !important;
    min-width: 0;
    margin-right: 0;
    border-right: 0;
  }

  .fts-tabs__tab {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    border-bottom: 1px solid var(--tabs-border);
    position: relative;
    padding-right: 2.25rem;
  }

  .fts-tabs__label {
    display: block;
    margin-right: 0;
  }

  /* Plus / minus icon pinned right */
  .fts-tabs__tab::after {
    font-family: "dashicons";
    content: "\f543";
    font-size: 1rem;
    line-height: 1;
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
  }

  .fts-tabs__tab[aria-selected="true"]::after {
    content: "\f460";
  }

  /* Panel basics, JS handles height animation */
  .fts-tabs__panel {
    border-top: 0;
    overflow: hidden;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    transition: height 0.4s ease-in-out;
  }

  /* Keep panels in flow for animation */
  .fts-tabs__panel[hidden] {
    display: block !important;
    height: 0;
  }

  .fts-tabs__panel-inner {
    padding-top: 0.75rem;
    padding-bottom: 1rem;
  }
}