/**
 * EG Accordion Menus by eCommGenie - Core Styles
 * Version: 1.0.11
 * Author: eCommGenie
 * Author URI: https://ecommgenie.com
 * 
 * Structural layout and responsive behavior for accordion menus
 * Theme customization should be done in eg-menu-accordion-theme.css
 */

/* ==========================================================================
   BASE ACCORDION STRUCTURE
   ========================================================================== */

.eg-menu-accordion-vxp347 {
  position: relative;
  background-color: var(--egma-vxp347-background-color);
  padding: var(--egma-vxp347-padding-y) var(--egma-vxp347-padding-x);
}

/* ==========================================================================
   DESKTOP/TABLET - ALWAYS VISIBLE
   ========================================================================== */

.eg-menu-accordion-vxp347__heading-desktop {
  display: block;
}

.eg-menu-accordion-vxp347__heading-desktop h3 {
  font-family: var(--egma-vxp347-heading-font-family);
  font-style: normal;
  font-weight: 700;
  font-size: var(--egma-vxp347-heading-font-size);
  letter-spacing: var(--egma-vxp347-heading-letter-spacing);
  line-height: 100%;
  margin: 0 0 var(--egma-vxp347-heading-margin-bottom) 0;
  padding: 0;
  color: var(--egma-vxp347-heading-color);
}

/* Ensure heading links also maintain bold weight */
.eg-menu-accordion-vxp347__heading-desktop h3 a {
  font-weight: inherit;
}

/* Hybrid mode: heading link styling */
.eg-menu-accordion-vxp347__title-link {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  transition: opacity 0.2s ease, color 0.2s ease, font-weight 0.2s ease;
}

.eg-menu-accordion-vxp347__title-link:hover,
.eg-menu-accordion-vxp347__title-link:focus {
  color: var(--egma-vxp347-heading-hover-color);
  opacity: var(--egma-vxp347-heading-hover-opacity);
  font-weight: var(--egma-vxp347-heading-hover-font-weight);
}

/* ==========================================================================
   MOBILE - COLLAPSIBLE BUTTON
   ========================================================================== */

.eg-menu-accordion-vxp347__heading-mobile-btn {
  display: none;
  width: 100%;
  background: transparent;
  border: none;
  padding: var(--egma-vxp347-padding-y) var(--egma-vxp347-padding-x);
  margin: calc(var(--egma-vxp347-padding-y) * -1) calc(var(--egma-vxp347-padding-x) * -1);
  cursor: pointer;
  text-align: left;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
}

.eg-menu-accordion-vxp347__heading-mobile-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.eg-menu-accordion-vxp347__heading-mobile-btn:focus {
  outline: 2px solid var(--egma-vxp347-heading-color);
  outline-offset: 2px;
}

.eg-menu-accordion-vxp347__heading-mobile {
  flex: 1;
}

.eg-menu-accordion-vxp347__heading-mobile h3 {
  font-family: var(--egma-vxp347-heading-font-family);
  font-style: normal;
  font-weight: 700;
  font-size: var(--egma-vxp347-heading-font-size);
  letter-spacing: var(--egma-vxp347-heading-letter-spacing);
  line-height: 100%;
  margin: 0;
  padding: 0;
  color: var(--egma-vxp347-heading-color);
}

/* Ensure heading links in mobile also maintain bold weight */
.eg-menu-accordion-vxp347__heading-mobile h3 a {
  font-weight: inherit;
}

/* ==========================================================================
   ACCORDION ICON
   ========================================================================== */

.eg-menu-accordion-vxp347__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 1rem;
  color: var(--egma-vxp347-heading-color);
}

/* Single icon mode: rotate on open */
.eg-menu-accordion-vxp347__icon-inner--single {
  display: inline-flex;
  transition: transform 0.3s ease;
  transform-origin: center;
}

.eg-menu-accordion-vxp347--open .eg-menu-accordion-vxp347__icon-inner--single {
  transform: rotate(180deg);
}

/* Dual icon mode: opacity swap */
.eg-menu-accordion-vxp347__icon-inner--dual {
  position: relative;
  display: inline-flex;
}

.eg-menu-accordion-vxp347__icon-close,
.eg-menu-accordion-vxp347__icon-open {
  display: inline-flex;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.eg-menu-accordion-vxp347__icon-close {
  opacity: 1;
  transform: scale(1);
}

.eg-menu-accordion-vxp347__icon-open {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transform: scale(0.8);
}

.eg-menu-accordion-vxp347--open .eg-menu-accordion-vxp347__icon-close {
  opacity: 0;
  transform: scale(0.8);
}

.eg-menu-accordion-vxp347--open .eg-menu-accordion-vxp347__icon-open {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================================================
   PANEL AND LIST
   ========================================================================== */

.eg-menu-accordion-vxp347__panel {
  /* Always visible on desktop, controlled on mobile */
}

.eg-menu-accordion-vxp347__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--egma-vxp347-gap);
}

.eg-menu-accordion-vxp347__list li {
  margin: 0;
  padding: 0;
}

.eg-menu-accordion-vxp347__link {
  font-family: var(--egma-vxp347-link-font-family);
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  font-size: var(--egma-vxp347-link-font-size);
  letter-spacing: var(--egma-vxp347-link-letter-spacing);
  color: var(--egma-vxp347-link-color);
  text-decoration: none;
  transition: opacity 0.2s ease, color 0.2s ease, font-weight 0.2s ease;
  display: inline-block;
}

.eg-menu-accordion-vxp347__link:hover,
.eg-menu-accordion-vxp347__link:focus {
  color: var(--egma-vxp347-link-hover-color);
  opacity: var(--egma-vxp347-link-hover-opacity);
  font-weight: var(--egma-vxp347-link-hover-font-weight);
}

/* Single link (parent with no children) - Should match heading size */
.eg-menu-accordion-vxp347__single-link {
  padding: var(--egma-vxp347-padding-y) 0;
}

.eg-menu-accordion-vxp347__single-link .eg-menu-accordion-vxp347__link {
  font-weight: 700;
  font-size: var(--egma-vxp347-heading-font-size);
  color: var(--egma-vxp347-heading-color);
}

.eg-menu-accordion-vxp347__single-link .eg-menu-accordion-vxp347__link:hover,
.eg-menu-accordion-vxp347__single-link .eg-menu-accordion-vxp347__link:focus {
  color: var(--egma-vxp347-heading-hover-color);
  opacity: var(--egma-vxp347-heading-hover-opacity);
  font-weight: var(--egma-vxp347-heading-hover-font-weight);
}

/* ==========================================================================
   GROUP CONTAINER
   ========================================================================== */

.eg-menu-accordion-vxp347-group {
  display: flex;
  flex-direction: column;
  gap: var(--egma-vxp347-group-gap);
}

/* Desktop: side-by-side layout option */
@media (min-width: 769px) {
  .eg-menu-accordion-vxp347-group--horizontal {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .eg-menu-accordion-vxp347-group--horizontal .eg-menu-accordion-vxp347 {
    flex: 1 1 200px;
  }
}

/* ==========================================================================
   MOBILE RESPONSIVE BEHAVIOR (JS Required)
   When JS is enabled, mobile view becomes collapsible
   ========================================================================== */

@media (max-width: 768px) {
  /* Hide desktop heading, show mobile button */
  .eg-menu-accordion-vxp347--js-enabled .eg-menu-accordion-vxp347__heading-desktop {
    display: none;
  }
  
  .eg-menu-accordion-vxp347--js-enabled .eg-menu-accordion-vxp347__heading-mobile-btn {
    display: flex;
  }
  
  /* Collapsible panel behavior */
  .eg-menu-accordion-vxp347--js-enabled .eg-menu-accordion-vxp347__panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
  }
  
  .eg-menu-accordion-vxp347--js-enabled.eg-menu-accordion-vxp347--open .eg-menu-accordion-vxp347__panel {
    max-height: 2000px; /* Large enough for content */
  }
  
  /* Add spacing when panel is open */
  .eg-menu-accordion-vxp347--js-enabled.eg-menu-accordion-vxp347--open .eg-menu-accordion-vxp347__panel {
    padding-top: var(--egma-vxp347-heading-margin-bottom);
  }
}

/* ==========================================================================
   NO-JS FALLBACK
   Without JavaScript, everything remains visible
   ========================================================================== */

@media (max-width: 768px) {
  .eg-menu-accordion-vxp347:not(.eg-menu-accordion-vxp347--js-enabled) .eg-menu-accordion-vxp347__heading-mobile-btn {
    display: none;
  }
  
  .eg-menu-accordion-vxp347:not(.eg-menu-accordion-vxp347--js-enabled) .eg-menu-accordion-vxp347__heading-desktop {
    display: block;
  }
  
  .eg-menu-accordion-vxp347:not(.eg-menu-accordion-vxp347--js-enabled) .eg-menu-accordion-vxp347__panel {
    display: block;
  }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Focus visible for keyboard navigation */
.eg-menu-accordion-vxp347__link:focus-visible {
  outline: 2px solid var(--egma-vxp347-link-color);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .eg-menu-accordion-vxp347__icon-inner--single,
  .eg-menu-accordion-vxp347__icon-close,
  .eg-menu-accordion-vxp347__icon-open,
  .eg-menu-accordion-vxp347__panel,
  .eg-menu-accordion-vxp347__link,
  .eg-menu-accordion-vxp347__title-link {
    transition: none !important;
  }
}