/* ═══════════════════════════════════════════════════════════════════════════
   PROBABILITIES SECTION V3 - "Allocation Master"
   Design moderne avec barre draggable, lock 100%, presets
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */
.prob-section-v3 {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  animation: fadeIn 0.3s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER V3
   ═══════════════════════════════════════════════════════════════════════════ */
.prob-header-v3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.prob-header-v3 .header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.prob-header-v3 .header-icon-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.prob-header-v3 .header-icon {
  font-size: 28px;
  z-index: 2;
}

.prob-header-v3 .icon-pulse {
  position: absolute;
  inset: -4px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  border-radius: inherit;
  animation: pulse 2s ease-in-out infinite;
  opacity: 0.6;
}

.prob-header-v3 .header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prob-header-v3 .header-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.prob-header-v3 .header-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.prob-header-v3 .header-right .global-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-normal);
}

.prob-header-v3 .global-status.valid {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.prob-header-v3 .global-status.warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.prob-header-v3 .status-icon {
  font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NAVIGATION TABS V3
   ═══════════════════════════════════════════════════════════════════════════ */
.prob-nav-v3 {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.nav-tab-v3 {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
}

.nav-tab-v3:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-tab-v3.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
}

.nav-tab-v3 .tab-icon {
  font-size: 1.1rem;
}

.nav-tab-v3 .tab-badge {
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.nav-tab-v3.active .tab-badge {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-tab-v3 .tab-badge.valid {
  background: var(--success-light);
  color: var(--success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */
.prob-content-v3 {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOOLBAR - Lock & Presets
   ═══════════════════════════════════════════════════════════════════════════ */
.prob-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.prob-toolbar .toolbar-left,
.prob-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Lock Toggle Button */
.lock-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.lock-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.lock-toggle.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.08));
  border-color: var(--success);
  color: var(--success);
}

.lock-toggle .lock-icon {
  font-size: 1rem;
  transition: transform var(--transition-bounce);
}

.lock-toggle.active .lock-icon {
  transform: scale(1.1);
}

/* Auto Balance Button */
.auto-balance-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.auto-balance-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Presets */
.preset-dropdown {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.preset-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.preset-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.preset-btn:active {
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOTAL DISPLAY V3
   ═══════════════════════════════════════════════════════════════════════════ */
.total-display-v3 {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition-normal);
}

.total-display-v3.valid {
  border-color: var(--success);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.total-display-v3.over {
  border-color: var(--danger);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.total-display-v3.under {
  border-color: var(--warning);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.total-bar {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  margin-bottom: var(--space-3);
}

.total-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

.total-display-v3.over .total-fill {
  background: linear-gradient(90deg, var(--warning), var(--danger));
}

.total-overflow {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  background: var(--danger);
  opacity: 0.6;
  animation: pulse 1s ease-in-out infinite;
}

.total-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.total-display-v3.valid .total-value {
  color: var(--success);
}

.total-display-v3.over .total-value {
  color: var(--danger);
}

.total-display-v3.under .total-value {
  color: var(--warning);
}

.total-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.total-display-v3.valid .total-label {
  color: var(--success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALLOCATION BAR - Interactive Draggable
   ═══════════════════════════════════════════════════════════════════════════ */
.allocation-bar-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.allocation-bar {
  display: flex;
  height: 56px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: visible;
  position: relative;
}

.allocation-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  position: relative;
  transition: width 0.15s ease-out;
  overflow: hidden;
}

.allocation-segment:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.allocation-segment:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.allocation-segment.no-width {
  width: 0 !important;
  min-width: 0;
  opacity: 0;
}

.segment-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.segment-emoji {
  font-size: 1.2rem;
}

.segment-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
}

.segment-tooltip {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 10;
}

.allocation-segment:hover .segment-tooltip {
  opacity: 1;
}

/* Drag Handles - Positioned Absolutely at Segment Boundaries */
.drag-handle {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 24px;
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
  background: transparent;
}

.drag-handle::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-full);
  transition: all var(--transition-normal);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

.drag-handle:hover::before,
.drag-handle.dragging::before {
  width: 6px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6), 0 0 4px rgba(0, 0, 0, 0.4);
}

.drag-handle .handle-grip {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity var(--transition-fast);
  user-select: none;
  pointer-events: none;
}

.drag-handle:hover .handle-grip,
.drag-handle.dragging .handle-grip {
  opacity: 1;
}

.drag-handle.dragging {
  transform: translateX(-50%) scale(1.15);
}

.drag-handle.dragging::before {
  background: var(--primary);
  box-shadow: 0 0 16px var(--primary-glow), 0 0 4px rgba(0, 0, 0, 0.4);
}

.allocation-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.allocation-hint .hint-icon {
  font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SLIDERS GRID V3
   ═══════════════════════════════════════════════════════════════════════════ */
.sliders-grid-v3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.slider-card-v3 {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.slider-card-v3::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--item-gradient);
  opacity: 0.8;
}

.slider-card-v3:hover {
  border-color: var(--item-color);
  box-shadow: 0 0 20px rgba(var(--item-color), 0.15);
  transform: translateY(-2px);
}

/* Card Header */
.slider-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.slider-identity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.slider-emoji {
  font-size: 1.4rem;
}

.slider-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.slider-value-display {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.slider-value-display .value-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--item-color);
  font-family: var(--font-mono);
}

.slider-value-display .value-unit {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Visual Slider */
.slider-visual {
  position: relative;
  height: 32px;
  margin-bottom: var(--space-4);
}

.slider-track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  right: 0;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.slider-fill {
  height: 100%;
  background: var(--item-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-fast);
}

.slider-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  z-index: 10;
}

/* Style the range input thumb for browsers that support it */
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--item-color);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slider-input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--item-color);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Controls Row */
.slider-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.control-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.control-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--item-color);
  color: var(--item-color);
}

.control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.control-btn.minus:hover:not(:disabled) {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.control-btn.plus:hover:not(:disabled) {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

.slider-controls .number-input {
  flex: 1;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-align: center;
  outline: none;
  transition: all var(--transition-fast);
}

.slider-controls .number-input:focus {
  border-color: var(--item-color);
  box-shadow: 0 0 0 3px rgba(var(--item-color), 0.15);
}

/* Hide number input spinners */
.slider-controls .number-input::-webkit-outer-spin-button,
.slider-controls .number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.slider-controls .number-input[type=number] {
  -moz-appearance: textfield;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .prob-header-v3 {
    flex-direction: column;
    gap: var(--space-4);
    align-items: flex-start;
  }

  .prob-nav-v3 {
    flex-direction: column;
  }

  .nav-tab-v3 {
    justify-content: flex-start;
  }

  .prob-toolbar {
    flex-direction: column;
    gap: var(--space-3);
  }

  .prob-toolbar .toolbar-left,
  .prob-toolbar .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .preset-dropdown {
    flex-wrap: wrap;
    justify-content: center;
  }

  .sliders-grid-v3 {
    grid-template-columns: 1fr;
  }

  .allocation-bar {
    height: 48px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes segment-highlight {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}

.allocation-segment:hover {
  animation: segment-highlight 0.8s ease-in-out;
}

/* Drag state - disable pointer events on segments while dragging */
.prob-section-v3.dragging .allocation-segment {
  pointer-events: none;
}

.prob-section-v3.dragging .slider-card-v3 {
  pointer-events: none;
  opacity: 0.7;
}
