/* Tabs Module - Mobile-First Design */

/* Base Container */
.tabs-module {
  position: relative;
  width: 100%;
}

/* Mobile First - Accordion Layout (Default) */
.tabs-container {
  width: 100%;
}

/* Accordion Style on Mobile */
.tab-accordion-item {
  border-bottom: 1px solid var(--color-border);
}

.tab-accordion-item:first-child {
  border-top: 1px solid var(--color-border);
}

.tab-accordion-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: transparent;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.3s ease;
  color: inherit;
}

.tab-accordion-button:hover {
  background: var(--color-bg-secondary);
}

.tab-accordion-button.active {
  background: var(--color-primary);
  color: var(--color-bg);
}

.tab-accordion-icon {
  margin-right: 0.5rem;
}

.tab-accordion-arrow {
  transition: transform 0.3s ease;
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.6;
}

.tab-accordion-button.active .tab-accordion-arrow {
  transform: rotate(180deg);
}

.tab-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1rem;
}

.tab-accordion-content.active {
  max-height: 2000px; /* Adjust based on content */
  padding: 1rem;
}

/* Tab Navigation - Hidden on Mobile by Default */
.tabs-nav {
  display: none;
}

.tabs-content-container {
  display: none;
}

/* Dropdown Style Alternative for Mobile */
.tabs-dropdown {
  position: relative;
  width: 100%;
  margin-bottom: 1rem;
}

.tabs-dropdown-button {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius, 8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
}

.tabs-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius, 8px);
  box-shadow: 0 4px 12px var(--color-border);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  z-index: 10;
}

.tabs-dropdown-menu.open {
  max-height: 300px;
  overflow-y: auto;
}

.tabs-dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.tabs-dropdown-item:hover {
  background: var(--color-bg-secondary);
}

/* Desktop Styles */
@media (min-width: 993px) {
  /* Hide mobile layouts */
  .tab-accordion-item {
    display: none;
  }
  
  .tabs-dropdown {
    display: none;
  }
  
  /* Show desktop tab layout */
  .tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    position: relative;
  }
  
  .tabs-content-container {
    display: block;
    position: relative;
    min-height: var(--min-height, 200px);
    background: var(--color-bg);
    border-radius: var(--radius, 8px);
    overflow: hidden;
  }
  
  /* Tab Buttons */
  .tab-button {
    padding: 0.75rem 1.5rem;
    background: var(--color-bg-secondary);
    border: none;
    border-radius: var(--radius, 8px);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
  }
  
  .tab-button:hover {
    background: var(--color-bg-secondary);
    transform: translateY(-2px);
  }
  
  .tab-button.active {
    background: var(--color-primary);
    color: var(--color-bg);
    box-shadow: 0 4px 12px var(--color-border);
  }
  
  .tab-icon {
    font-size: 1.125rem;
  }
  
  /* Tab Content Panels */
  .tab-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: var(--content-padding, 30px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
  }
  
  .tab-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    position: relative;
  }
  
  /* Tab Styles Variations */
  
  /* Pills Style (Default) */
  .tabs-style-pills .tab-button {
    border-radius: 50px;
  }
  
  /* Underline Style */
  .tabs-style-underline .tabs-nav {
    border-bottom: 2px solid var(--color-border);
    gap: 0;
  }
  
  .tabs-style-underline .tab-button {
    background: transparent;
    border-radius: 0;
    position: relative;
    padding-bottom: 1rem;
  }
  
  .tabs-style-underline .tab-button::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
  }
  
  .tabs-style-underline .tab-button.active::after {
    transform: scaleX(1);
  }
  
  .tabs-style-underline .tab-button.active {
    background: transparent;
    color: var(--color-primary);
    box-shadow: none;
  }
  
  /* Boxed Style */
  .tabs-style-boxed .tabs-nav {
    background: var(--color-bg-secondary);
    padding: 0.25rem;
    border-radius: var(--radius, 8px);
  }
  
  .tabs-style-boxed .tab-button.active {
    background: var(--color-bg);
    color: var(--color-text);
    box-shadow: 0 2px 8px var(--color-border);
  }
  
  /* Minimal Style */
  .tabs-style-minimal .tab-button {
    background: transparent;
    color: var(--color-text);
    padding: 0.5rem 1rem;
  }
  
  .tabs-style-minimal .tab-button:hover {
    background: transparent;
    color: var(--color-primary);
  }
  
  .tabs-style-minimal .tab-button.active {
    background: transparent;
    color: var(--color-primary);
    box-shadow: none;
    font-weight: 600;
  }
  
  /* Alignment Variations */
  .tabs-align-center .tabs-nav {
    justify-content: center;
  }
  
  .tabs-align-end .tabs-nav {
    justify-content: flex-end;
  }
  
  .tabs-align-stretch .tabs-nav {
    gap: 0;
  }
  
  .tabs-align-stretch .tab-button {
    flex: 1;
    justify-content: center;
  }
  
  /* Vertical Layout */
  .tabs-vertical {
    display: flex;
    gap: 2rem;
  }
  
  .tabs-vertical .tabs-nav {
    flex-direction: column;
    width: 250px;
    margin-bottom: 0;
  }
  
  .tabs-vertical .tabs-content-container {
    flex: 1;
  }
  
  .tabs-vertical-right {
    flex-direction: row-reverse;
  }
  
  /* Horizontal Bottom */
  .tabs-horizontal-bottom {
    display: flex;
    flex-direction: column-reverse;
  }
  
  .tabs-horizontal-bottom .tabs-nav {
    margin-bottom: 0;
    margin-top: 1.5rem;
  }
}

/* Animation Types */
.tabs-animation-fade .tab-panel {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tabs-animation-slide .tab-panel {
  transition: all 0.3s ease;
}

.tabs-animation-slide .tab-panel:not(.active) {
  transform: translateX(20px);
}

.tabs-animation-fade-slide .tab-panel {
  transition: all 0.3s ease;
}

/* Loading State */
.tab-panel.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.tab-panel.loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Accessibility */
.tab-button:focus-visible,
.tab-accordion-button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .tabs-nav {
    display: none;
  }
  
  .tab-panel {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    page-break-inside: avoid;
  }
  
  .tab-accordion-button {
    display: block;
    font-weight: bold;
    border: none;
  }
  
  .tab-accordion-content {
    max-height: none !important;
    display: block !important;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .tab-panel,
  .tab-button,
  .tab-accordion-content,
  .tab-accordion-arrow {
    transition: none !important;
  }
}