/* Product Tab Navigation System CSS */
/* Based on UI Design Specifications from 02-ui-design-output.md */

/* Tab Container */
.product-tabs-wrapper {
  position: static;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 35;
}

.product-tabs-wrapper.sticky {
  position: fixed;
  top: 0; /* At very top of screen */
  left: 0;
  right: 0;
  z-index: 50; /* Above header */
  
  /* Enhanced Elevation */
  box-shadow: 
    0 8px 32px rgba(23, 29, 52, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(63, 181, 168, 0.1);
  
  /* Backdrop Enhancement */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Primary Tab Container */
.product-tabs {
  background: linear-gradient(135deg, #171d34 0%, #2a3549 100%);
  border-bottom: 3px solid #3fb5a8;
  box-shadow: 0 4px 20px rgba(23, 29, 52, 0.15);
  padding: 0;
  position: relative;
  z-index: 35;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.product-tabs-wrapper.sticky .product-tabs {
  background: linear-gradient(135deg, #171d34 0%, #1e293b 100%);
  border-bottom-color: #3fb5a8;
  border-bottom-width: 4px;
}

/* Tab List Container */
.tab-list {
  display: flex;
  justify-content: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.tab-list::-webkit-scrollbar {
  display: none;
}

/* Scroll Container for Fade Edges */
.tab-scroll-container {
  position: relative;
  overflow: hidden;
}

/* Left Fade Edge */
.tab-scroll-container::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(to right, #171d34, transparent);
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Right Fade Edge */
.tab-scroll-container::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(to left, #171d34, transparent);
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Show fade edges when scrollable */
.tab-scroll-container.scrollable-left::before {
  opacity: 1;
}

.tab-scroll-container.scrollable-right::after {
  opacity: 1;
}

/* Individual Tab Design */
.product-tab {
  /* Layout */
  min-width: 200px;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  
  /* Typography */
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  letter-spacing: -0.01em;
  
  /* Base Styling */
  background: transparent;
  border: none;
  border-radius: 0;
  color: #cbd5e1; /* slate-300 */
  cursor: pointer;
  position: relative;
  overflow: hidden;
  
  /* Transitions */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Touch Targets */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Modern Tab Separators - Using ::before to avoid conflicts with hover ::after */
.product-tab:not(:last-child)::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 32px;
  /* Fallback solid color */
  background: rgba(63, 181, 168, 0.6);
  /* Enhanced gradient */
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(63, 181, 168, 0.4) 20%,
    rgba(63, 181, 168, 0.8) 50%,
    rgba(63, 181, 168, 0.4) 80%,
    transparent 100%
  );
  z-index: 2;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Separator on Hover */
.product-tab:hover:not(:last-child)::before {
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(63, 181, 168, 0.5) 15%,
    rgba(63, 181, 168, 1) 50%,
    rgba(63, 181, 168, 0.5) 85%,
    transparent 100%
  );
  height: 36px;
  box-shadow: 0 0 8px rgba(63, 181, 168, 0.4);
}

/* Separator for Sticky State */
.product-tabs-wrapper.sticky .product-tab:not(:last-child)::before {
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(63, 181, 168, 0.5) 20%,
    rgba(63, 181, 168, 0.9) 50%,
    rgba(63, 181, 168, 0.5) 80%,
    transparent 100%
  );
  height: 36px;
}

/* Active Tab Separator Enhancement */
.product-tab.active:not(:last-child)::before {
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 20%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.3) 80%,
    transparent 100%
  );
  height: 40px;
  box-shadow: 0 0 12px rgba(63, 181, 168, 0.6);
}

/* Tab Text Wrapper */
.tab-text {
  position: relative;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  
  /* German-optimized Typography */
  word-spacing: -0.02em;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  
  /* Professional text rendering */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* Ensure readability */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Bottom Border for Active State - Move to use a different approach to avoid ::before conflict */
.product-tab {
  border-bottom: 3px solid transparent;
  transition: border-bottom-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover State */
.product-tab:hover {
  color: #ffffff;
  background: rgba(63, 181, 168, 0.1);
  transform: translateY(-2px);
  border-bottom-color: rgba(63, 181, 168, 0.4);
}

/* Hover Animation Effect */
.product-tab::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.6s;
}

.product-tab:hover::after {
  left: 100%;
}

/* Active State */
.product-tab.active {
  color: #ffffff;
  background: rgba(63, 181, 168, 0.15);
  transform: translateY(-3px);
  font-weight: 600;
  border-bottom-color: #3fb5a8;
  box-shadow: 
    0 0 0 1px rgba(63, 181, 168, 0.2),
    0 3px 12px rgba(63, 181, 168, 0.6),
    0 8px 16px rgba(23, 29, 52, 0.3);
}

/* Focus State (Accessibility) */
.product-tab:focus-visible {
  outline: none;
  box-shadow: 
    0 0 0 2px #3fb5a8,
    0 0 0 4px rgba(63, 181, 168, 0.2);
  z-index: 1;
}

.product-tab:focus-visible .tab-text {
  text-shadow: 0 0 4px rgba(63, 181, 168, 0.8);
}

/* Loading State */
.product-tab.loading {
  pointer-events: none;
  opacity: 0.7;
  cursor: wait;
}

.product-tab.loading .tab-text {
  opacity: 0;
}

.product-tab.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid #3fb5a8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: none;
  box-shadow: none;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mobile Responsive Design */
@media (max-width: 1024px) {
  .tab-list {
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px;
    gap: 0;
    scroll-snap-type: x mandatory;
  }
  
  .product-tab {
    scroll-snap-align: center;
    min-width: 160px; /* Slightly smaller on tablet */
    flex-shrink: 0;
  }
  
  /* Adjust separator height for tablet */
  .product-tab:not(:last-child)::before {
    height: 28px;
  }
  
  .product-tab:hover:not(:last-child)::before,
  .product-tabs-wrapper.sticky .product-tab:not(:last-child)::before {
    height: 32px;
  }
  
  .product-tab.active:not(:last-child)::before {
    height: 36px;
  }
}

@media (max-width: 640px) {
  .product-tab {
    min-width: 140px; /* Mobile optimized */
    height: 56px;
    font-size: 15px;
    padding: 0 16px;
  }
  
  .product-tabs {
    border-bottom-width: 2px;
  }
  
  /* Mobile separator adjustments */
  .product-tab:not(:last-child)::before {
    height: 24px;
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(63, 181, 168, 0.5) 25%,
      rgba(63, 181, 168, 0.8) 50%,
      rgba(63, 181, 168, 0.5) 75%,
      transparent 100%
    );
  }
  
  .product-tab:hover:not(:last-child)::before,
  .product-tabs-wrapper.sticky .product-tab:not(:last-child)::before {
    height: 28px;
  }
  
  .product-tab.active:not(:last-child)::before {
    height: 32px;
  }
}

/* Touch-friendly sizing (44px minimum) */
@media (max-width: 768px) {
  .product-tab {
    /* WCAG Touch Target Compliance */
    min-height: 56px; /* Exceeds 44px minimum */
    min-width: 140px; /* Exceeds 44px minimum */
    
    /* Enhanced Touch Response */
    -webkit-tap-highlight-color: rgba(63, 181, 168, 0.2);
  }
  
  /* Optimize for thumb reach */
  .product-tabs {
    padding-bottom: 8px; /* Extra space for thumb */
  }
  
  /* Left thumb zone (most accessible) */
  .product-tab:first-child {
    margin-left: 4px;
  }
  
  /* Right thumb zone */
  .product-tab:last-child {
    margin-right: 4px;
  }
  
  /* Center tabs get priority positioning */
  .product-tab.active {
    scroll-margin: 20px; /* Ensure active tab is visible */
  }
}

/* Touch-specific hover states */
@media (hover: none) and (pointer: coarse) {
  .product-tab:hover {
    transform: none; /* Remove hover lift on touch devices */
    background: transparent;
  }
  
  .product-tab:active {
    background: rgba(63, 181, 168, 0.1);
    transform: scale(0.98);
  }
  
  /* Disable separator hover effects on touch */
  .product-tab:hover:not(:last-child)::before {
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(63, 181, 168, 0.4) 20%,
      rgba(63, 181, 168, 0.7) 50%,
      rgba(63, 181, 168, 0.4) 80%,
      transparent 100%
    );
    height: 32px;
    box-shadow: none;
  }
}

/* Tab Content Area */
.tab-content {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
  display: none;
}

.tab-content.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  display: block;
}

/* Staggered Content Animation */
.tab-content .section {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tab-content.active .section {
  opacity: 1;
  transform: translateY(0);
}

.tab-content.active .section:nth-child(1) { transition-delay: 0.1s; }
.tab-content.active .section:nth-child(2) { transition-delay: 0.2s; }
.tab-content.active .section:nth-child(3) { transition-delay: 0.3s; }

/* Sticky Animation */
@keyframes sticky-slide-down {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.product-tabs-wrapper.sticky {
  animation: sticky-slide-down 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Smooth transition for non-sticky to sticky state */
.product-tabs-wrapper {
  transform: translateY(0);
  opacity: 1;
}

.product-tabs-wrapper.sticky {
  transform: translateY(0);
  opacity: 1;
}

/* Tab Activation Animation */
@keyframes tab-activate {
  0% {
    transform: translateY(0) scale(1);
    color: #cbd5e1;
  }
  50% {
    transform: translateY(-4px) scale(1.02);
    color: #ffffff;
  }
  100% {
    transform: translateY(-3px) scale(1);
    color: #ffffff;
  }
}

.product-tab.active {
  animation: tab-activate 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Active Underline Animation */
@keyframes underline-expand {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

.product-tab.active::before {
  animation: underline-expand 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* GPU Acceleration for Smooth Animations */
.product-tab,
.tab-content {
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.product-tab::before,
.product-tab::after {
  will-change: transform;
  contain: layout;
}

/* Mobile Performance */
@media (max-width: 768px) {
  .product-tab:hover {
    /* Reduce GPU load on mobile */
    will-change: auto;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .product-tab,
  .tab-content,
  .product-tabs-wrapper {
    animation: none !important;
    transition: none !important;
  }
  
  .product-tab.active {
    transform: translateY(-2px);
  }
  
  .tab-content.active {
    opacity: 1;
    transform: translateY(0);
  }
  
  /* Disable separator transitions for reduced motion */
  .product-tab:not(:last-child)::before {
    transition: none !important;
  }
}

/* Subtle Separator Glow Animation */
@keyframes separator-glow {
  0%, 100% {
    opacity: 0.6;
    filter: brightness(1);
  }
  50% {
    opacity: 0.8;
    filter: brightness(1.2);
  }
}

.product-tab.active:not(:last-child)::before {
  animation: separator-glow 2s ease-in-out infinite;
}

/* Disable glow animation for reduced motion users */
@media (prefers-reduced-motion: reduce) {
  .product-tab.active:not(:last-child)::before {
    animation: none !important;
  }
}

/* Tab Content Spacing */
.tab-content-wrapper {
  min-height: 70vh; /* Prevent layout shift during tab switches */
}

/* Loading State for Tab Switching */
.tab-switching .product-tab:not(.active) {
  opacity: 0.6;
  pointer-events: none;
}

.tab-switching .tab-content {
  filter: blur(2px);
  opacity: 0.8;
}