/**
 * BrightCushion - Digital Twin Styles (Version Compacte)
 * Interface légère et visuelle - OPTIMISÉE MOBILE
 */

/* ==================== CONTAINER ==================== */
.digital-twin-simple {
  margin-top: 60px;
  background: rgba(5, 15, 30, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: var(--radius);
  padding: 50px 40px;
  position: relative;
  overflow: hidden;
}

.digital-twin-simple::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(90deg, rgba(212, 175, 55, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(212, 175, 55, 0.02) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
  opacity: 0.3;
}

/* ==================== INTRO ==================== */
.twin-intro {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
  z-index: 1;
}

.twin-intro p {
  font-size: 18px;
  color: var(--muted);
  margin: 0;
  max-width: 600px;
  margin: 0 auto;
}

/* ==================== CONTROLS COMPACTS ==================== */
.twin-controls-compact {
  max-width: 900px;
  margin: 0 auto 40px;
  position: relative;
  z-index: 1;
}

.toggles-inline {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Toggle Switch Compact */
.toggle-switch-compact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-switch-compact:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.3);
}

.toggle-switch-compact input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 48px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #666;
  top: 3px;
  left: 3px;
  transition: all 0.3s ease;
}

.toggle-switch-compact input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--gold), var(--gold-600));
  box-shadow: 0 0 15px var(--gold-glow);
}

.toggle-switch-compact input:checked + .toggle-slider::before {
  transform: translateX(24px);
  background: #0b0b0b;
}

.toggle-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

/* ==================== PIPELINE VISUAL ==================== */
.twin-pipeline-visual {
  margin: 50px 0 40px;
  position: relative;
  z-index: 1;
}

.pipeline-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 40px 30px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.1);
  border-radius: 12px;
}

.pipeline-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  background: rgba(10, 26, 42, 0.8);
  border: 2px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  min-width: 120px;
  transition: all 0.4s ease;
}

.pipeline-block.active-rpa {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2);
}

.pipeline-block.active-ai {
  border-color: rgba(168, 85, 247, 0.5);
  background: rgba(168, 85, 247, 0.08);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.2);
}

.pipeline-block.active-data {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.block-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  flex-shrink: 0;
}

.block-icon svg {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.pipeline-block.active-rpa .block-icon {
  color: #10b981;
}

.pipeline-block.active-rpa .block-icon svg {
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
}

.pipeline-block.active-ai .block-icon {
  color: #a855f7;
}

.pipeline-block.active-ai .block-icon svg {
  filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

.pipeline-block.active-data .block-icon {
  color: #3b82f6;
}

.pipeline-block.active-data .block-icon svg {
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.4));
}

.block-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.block-tech {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  transition: all 0.4s ease;
}

.block-tech.tech-rpa {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.block-tech.tech-ai {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

.block-tech.tech-data {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.pipeline-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  opacity: 0.5;
  user-select: none;
  flex-shrink: 0;
}

.pipeline-arrow svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* ==================== MÉTRIQUES COMPACTES ==================== */
.twin-metrics-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  max-width: 700px;
  margin: 0 auto 40px;
  position: relative;
  z-index: 1;
}

.metric-compact {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.metric-compact:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}

.metric-value-big {
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
  transition: all 0.5s ease;
}

.metric-value-big.improving {
  color: #10b981;
  animation: pulse-metric 0.6s ease;
}

@keyframes pulse-metric {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.metric-label-simple {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ==================== COMPONENTS CATALOG ==================== */
.components-catalog {
  max-width: 1000px;
  margin: 50px auto 40px;
  padding: 30px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 12px;
  position: relative;
  z-index: 1;
}

.components-catalog h4 {
  text-align: center;
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.catalog-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 30px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.catalog-category {
  background: rgba(10, 26, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 16px;
  transition: all 0.3s ease;
}

.catalog-category:hover {
  border-color: rgba(212, 175, 55, 0.3);
  transform: translateY(-2px);
}

.catalog-header {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.catalog-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.catalog-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-tag {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.3s ease;
  cursor: default;
}

.catalog-tag.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.catalog-tag[data-tech="rpa"].active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.catalog-tag[data-tech="ai"].active {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.3);
  color: #a855f7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.catalog-tag[data-tech="data"].active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pipeline-block {
  animation: fadeIn 0.5s ease;
}

/* ==================== SCROLLBARS MINIMALISTES ==================== */
.pipeline-container::-webkit-scrollbar,
.catalog-grid::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.pipeline-container::-webkit-scrollbar-track,
.catalog-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.pipeline-container::-webkit-scrollbar-thumb,
.catalog-grid::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.3);
  border-radius: 3px;
  transition: background 0.3s ease;
}

.pipeline-container::-webkit-scrollbar-thumb:hover,
.catalog-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.5);
}

/* Firefox scrollbars */
@supports (scrollbar-width: thin) {
  .pipeline-container,
  .catalog-grid {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.3) rgba(0, 0, 0, 0.2);
  }
}

/* ==================== RESPONSIVE OPTIMISÉ MOBILE ==================== */
@media (max-width: 768px) {
  .digital-twin-simple {
    padding: 30px 16px;
    margin-top: 40px;
  }

  .twin-intro p {
    font-size: 16px;
  }

  /* Toggles en ligne compacte sur mobile */
  .toggles-inline {
    gap: 8px;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  .toggle-switch-compact {
    padding: 10px 14px;
    gap: 8px;
    flex-shrink: 0;
  }

  .toggle-slider {
    width: 40px;
    height: 20px;
  }

  .toggle-slider::before {
    width: 14px;
    height: 14px;
    top: 3px;
  }

  .toggle-switch-compact input:checked + .toggle-slider::before {
    transform: translateX(20px);
  }

  .toggle-label {
    font-size: 12px;
    white-space: nowrap;
  }

  /* Pipeline horizontal avec scroll sur mobile */
  .pipeline-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 24px 16px;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
  }

  .pipeline-block {
    min-width: 100px;
    max-width: 100px;
    padding: 16px 12px;
    gap: 8px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .block-icon {
    width: 32px;
    height: 32px;
  }

  .block-icon svg {
    width: 32px;
    height: 32px;
  }

  .block-label {
    font-size: 11px;
    line-height: 1.2;
  }

  .block-tech {
    font-size: 9px;
    padding: 3px 8px;
  }

  .pipeline-arrow {
    flex-shrink: 0;
  }

  .pipeline-arrow svg {
    width: 18px;
    height: 18px;
  }

  /* Métriques en ligne sur mobile */
  .twin-metrics-compact {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 30px;
  }

  .metric-compact {
    padding: 14px 10px;
  }

  .metric-value-big {
    font-size: 24px;
  }

  .metric-label-simple {
    font-size: 10px;
  }

  /* Catalogue avec scroll horizontal sur mobile */
  .components-catalog {
    padding: 20px 16px;
    margin: 40px -16px 30px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .components-catalog h4 {
    font-size: 12px;
  }

  .catalog-subtitle {
    font-size: 11px;
    margin-bottom: 20px;
  }

  .catalog-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .catalog-category {
    padding: 12px;
    flex-shrink: 0;
  }

  .catalog-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .catalog-title {
    font-size: 11px;
  }

  .catalog-items {
    gap: 6px;
  }

  .catalog-tag {
    padding: 5px 10px;
    font-size: 10px;
  }

  /* Indicateur de scroll pour pipeline */
  .pipeline-container::after {
    content: '👉';
    position: sticky;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 100%;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.8), transparent);
    pointer-events: none;
    font-size: 20px;
    opacity: 0.6;
    margin-left: -40px;
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .digital-twin-simple {
    padding: 24px 12px;
  }

  .twin-intro p {
    font-size: 14px;
  }

  .toggle-switch-compact {
    padding: 8px 12px;
  }

  .toggle-label {
    font-size: 11px;
  }

  .pipeline-block {
    min-width: 90px;
    max-width: 90px;
    padding: 14px 10px;
  }

  .block-icon {
    width: 28px;
    height: 28px;
  }

  .block-icon svg {
    width: 28px;
    height: 28px;
  }

  .block-label {
    font-size: 10px;
  }

  .block-tech {
    font-size: 8px;
    padding: 2px 6px;
  }

  .metric-value-big {
    font-size: 20px;
  }

  .metric-label-simple {
    font-size: 9px;
  }

  .catalog-title {
    font-size: 10px;
  }

  .catalog-tag {
    padding: 4px 8px;
    font-size: 9px;
  }
}

/* ==================== PRINT ==================== */
@media print {
  .digital-twin-simple {
    page-break-inside: avoid;
  }

  .toggle-switch-compact {
    display: none;
  }
}
