/* ============================================
   COMPONENTS — Cards, Tables, Buttons, Sliders
   ============================================ */

/* ---- SECTION NAV BAR ---- */
.section-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-8);
  margin-top: var(--space-12);
  border-top: 1px solid var(--surface-2);
  gap: var(--space-4);
}

.section-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 240px;
  text-align: left;
}

.section-nav-btn:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 193, 213, 0.05);
}

.section-nav-btn[disabled] {
  opacity: 0.3;
  cursor: default;
}

.section-nav-prev { flex-direction: row; }
.section-nav-next { flex-direction: row-reverse; text-align: right; }

.section-nav-arrow {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.section-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-nav-hint {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  opacity: 0.5;
  white-space: nowrap;
}

/* ---- CARDS ---- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card-flat:hover { transform: none; box-shadow: none; }

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

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* KPI Card */
.kpi-card {
  background: var(--surface-1);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all var(--transition-base);
}

.kpi-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 193, 213, 0.1);
}

.kpi-card .kpi-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.kpi-card .kpi-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.kpi-card .kpi-value.large {
  font-size: 2.25rem;
}

.kpi-card .kpi-detail {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.kpi-card .kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: var(--space-2);
}

.kpi-delta.positive {
  background: rgba(34, 197, 94, 0.15);
  color: var(--positive);
}

.kpi-delta.negative {
  background: rgba(239, 68, 68, 0.15);
  color: var(--negative);
}

/* ---- TABLES ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--surface-2);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--surface-2);
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover td {
  background: var(--surface-2);
}

.data-table .num {
  font-family: var(--font-mono);
  font-weight: 500;
  text-align: right;
}

.data-table .highlight {
  font-weight: 700;
  color: var(--text-primary);
}

.data-table .total-row td {
  font-weight: 700;
  border-top: 2px solid var(--accent);
  background: rgba(0, 193, 213, 0.05);
}

.table-container {
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-scroll {
  max-height: 600px;
  overflow-y: auto;
}

/* Virtual scroll table */
.virtual-table {
  position: relative;
  overflow: auto;
  max-height: 70vh;
}

/* Sortable headers */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--text-primary);
}

.data-table th.sortable::after {
  content: '↕';
  margin-left: var(--space-1);
  opacity: 0.4;
}

.data-table th.sort-asc::after { content: '↑'; opacity: 1; }
.data-table th.sort-desc::after { content: '↓'; opacity: 1; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { filter: brightness(1.15); }

.btn-accent {
  background: var(--accent);
  color: var(--surface-0);
}

.btn-accent:hover { filter: brightness(1.15); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--surface-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.btn-ghost.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-baseline.active {
  background: rgba(0, 193, 213, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* ---- SCENARIO BUTTONS ---- */
.scenario-buttons {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.scenario-btn {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.scenario-btn:hover {
  color: var(--text-primary);
  background: var(--surface-1);
}

.scenario-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 193, 213, 0.08);
}

.scenario-btn.pessimiste.active { border-color: var(--warning); color: var(--warning); }
.scenario-btn.realiste.active { border-color: var(--accent); color: var(--accent); }
.scenario-btn.optimiste.active { border-color: var(--positive); color: var(--positive); }

/* ---- SLIDERS ---- */
.slider-group {
  margin-bottom: var(--space-4);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.slider-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

.slider-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  min-width: 60px;
  text-align: right;
}

.slider-value.pulsing {
  animation: pulse-value 300ms ease-out;
}

@keyframes pulse-value {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); color: var(--primary-light); }
  100% { transform: scale(1); }
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to right,
    var(--accent) var(--pct, 0%),
    var(--surface-2) var(--pct, 0%)
  );
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  background: var(--surface-2);
  height: 6px;
  border-radius: var(--radius-full);
  border: none;
}

input[type="range"]::-moz-range-progress {
  background: var(--accent);
  height: 6px;
  border-radius: var(--radius-full);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(0, 193, 213, 0.4);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 10px rgba(0, 193, 213, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Slider category accordion */
.slider-category {
  border-bottom: 1px solid var(--surface-2);
  margin-bottom: var(--space-1);
}

.slider-category:last-child {
  border-bottom: none;
}

.slider-category-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  background: none;
  border: none;
  padding: var(--space-3) 0;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color var(--transition-fast);
  text-align: left;
}

.slider-category-toggle:hover {
  color: var(--text-primary);
}

.slider-category-toggle .nav-chevron {
  margin-left: auto;
  font-size: var(--text-base);
  transition: transform var(--transition-fast);
  line-height: 1;
}

.slider-category.open .slider-category-toggle {
  color: var(--text-primary);
}

.slider-category.open .slider-category-toggle .nav-chevron {
  transform: rotate(90deg);
}

.slider-category-content {
  display: none;
  padding-bottom: var(--space-3);
}

.slider-category.open .slider-category-content {
  display: block;
}

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-go { background: rgba(1, 150, 58, 0.15); color: var(--primary); }
.badge-idf { background: rgba(0, 193, 213, 0.15); color: var(--accent); }
.badge-risk-red { background: rgba(239, 68, 68, 0.15); color: var(--negative); }
.badge-risk-orange { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-risk-green { background: rgba(34, 197, 94, 0.15); color: var(--positive); }
.badge-custom {
  background: rgba(127, 124, 255, 0.15);
  color: var(--accent-secondary);
}

/* ---- FILTER PILLS ---- */
.filter-pill {
  padding: var(--space-2) var(--space-4);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill:hover { color: var(--text-primary); }

.filter-pill.active {
  background: rgba(0, 193, 213, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- TABS ---- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--surface-2);
  margin-bottom: var(--space-6);
}

.tab {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
}

.tab:hover { color: var(--text-primary); }

.tab.active {
  color: var(--accent);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

/* ---- TOOLTIP ---- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 50;
}

.tooltip:hover::after { opacity: 1; }

/* ---- SEARCH INPUT ---- */
.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-0);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-secondary);
}

/* ---- SCROLL REVEAL ---- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.stagger > .reveal:nth-child(5) { transition-delay: 320ms; }
.stagger > .reveal:nth-child(6) { transition-delay: 400ms; }
.stagger > .reveal:nth-child(7) { transition-delay: 480ms; }

/* ---- TOOLTIP INFO ---- */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tooltip-btn {
  background: none;
  border: 1.5px solid var(--text-secondary);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--space-1);
  padding: 0;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.tooltip-btn:hover,
.tooltip-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 193, 213, 0.1);
}

.tooltip-bubble {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--text-primary);
  line-height: 1.6;
  width: 240px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  pointer-events: none;
}

.tooltip-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--accent);
}

.tooltip-btn.active + .tooltip-bubble {
  display: block;
}

/* ---- MODAL / DRAWER ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 40, 0.8);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface-1);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 640px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: var(--text-xl);
  cursor: pointer;
}

/* ---- GANTT FLOATING TOOLTIP ---- */
#gantt-tooltip {
  position: fixed;
  z-index: 300;
  max-width: 280px;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 150ms ease, transform 150ms ease;
}

#gantt-tooltip.gantt-tooltip--visible {
  opacity: 1;
  transform: scale(1);
}

.gantt-tooltip__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.gantt-tooltip__period {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.gantt-tooltip__desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- GO CONDITIONNEL BANNER ---- */
.go-banner {
  background: var(--gradient-hero);
  padding: var(--space-20) var(--space-8);
  text-align: center;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.go-banner h1 {
  font-size: 5rem;
  color: var(--positive);
  margin-bottom: var(--space-4);
  text-shadow: 0 0 60px rgba(34, 197, 94, 0.3);
}

.go-banner .go-subtitle {
  font-size: var(--text-2xl);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-12);
}

.go-banner .go-stat {
  font-family: var(--font-display);
  font-size: var(--text-kpi);
  font-weight: 700;
  color: var(--accent);
}
