/**
 * Split A/B Testing - Frontend Styles
 * Namespaced with .bolt-split- prefix
 */

/* ==============================================
   Variant Visibility
   ============================================== */

[data-split-test] {
  transition: opacity 0.2s ease-in-out;
}

[data-split-hide] {
  opacity: 0;
  visibility: hidden;
}

[data-split-show] {
  opacity: 1;
  visibility: visible;
}

/* Variant blocks - hidden by default */
.split-variant-a,
.split-variant-b,
.split-variant-c,
.split-variant-control,
.split-variant-treatment {
  display: none;
}

/* Show active variant */
.split-variant-a.split-active,
.split-variant-b.split-active,
.split-variant-c.split-active,
.split-variant-control.split-active,
.split-variant-treatment.split-active {
  display: block;
}

/* Inline variants */
span.split-variant-a,
span.split-variant-b,
span.split-variant-c,
span.split-variant-control,
span.split-variant-treatment {
  display: none;
}

span.split-variant-a.split-active,
span.split-variant-b.split-active,
span.split-variant-c.split-active,
span.split-variant-control.split-active,
span.split-variant-treatment.split-active {
  display: inline;
}

/* ==============================================
   Debug Panel
   ============================================== */

.bolt-split-debug-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  line-height: 1.4;
}

.bolt-split-debug-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.bolt-split-debug-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.bolt-split-debug-toggle svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.bolt-split-debug-content {
  position: absolute;
  bottom: 50px;
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: #1a1a2e;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: none;
  color: #e0e0e0;
}

.bolt-split-debug-content.active {
  display: block;
  animation: boltSplitSlideUp 0.2s ease-out;
}

@keyframes boltSplitSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bolt-split-debug-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bolt-split-debug-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.bolt-split-debug-header .bolt-split-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  color: white;
}

.bolt-split-debug-body {
  padding: 12px 16px;
}

.bolt-split-debug-test {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.bolt-split-debug-test:last-child {
  margin-bottom: 0;
}

.bolt-split-debug-test-name {
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bolt-split-type-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
  color: white;
}

.bolt-split-type-badge.price { background: #10b981; }
.bolt-split-type-badge.content { background: #8b5cf6; }
.bolt-split-type-badge.shipping { background: #f59e0b; }
.bolt-split-type-badge.theme { background: #3b82f6; }
.bolt-split-type-badge.checkout { background: #ef4444; }

.bolt-split-debug-variant {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a0a0a0;
}

.bolt-split-variant-badge {
  display: inline-block;
  padding: 3px 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  color: white;
  font-weight: 600;
  font-size: 11px;
}

.bolt-split-debug-no-tests {
  text-align: center;
  padding: 20px;
  color: #808080;
}

.bolt-split-debug-footer {
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
  color: #606060;
  text-align: center;
}

/* ==============================================
   Fade Animation
   ============================================== */

.bolt-split-fade-in {
  animation: boltSplitFadeIn 0.3s ease-out forwards;
}

@keyframes boltSplitFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==============================================
   Responsive
   ============================================== */

@media (max-width: 768px) {
  .bolt-split-debug-panel {
    bottom: 10px;
    right: 10px;
  }
  
  .bolt-split-debug-content {
    width: calc(100vw - 40px);
    right: 0;
  }
}
