/* ==========================================================================
   cn-simulator-v2.css — Simulateur CRYPTONYTE (Phase 2)
   Requires: cn-theme.css v16 (CSS variables)
   All classes use cnx-sim- prefix
   ========================================================================== */

/* Tooltip info bubbles */
.cnx-sim-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 128, 255, 0.15);
  color: #4dc3ff;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
  font-style: normal;
  vertical-align: middle;
  margin-left: 6px;
}

.cnx-sim-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e8edf5;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 128, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
}

.cnx-sim-tip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Subcategory label in recap */
.cnx-sim-recap-subcat {
  color: #64748b;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.cnx-simulator-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 60px 16px 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cnx-sim-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #4dc3ff, #00aaff, #0080ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #4dc3ff;
}

.cnx-sim-subtitle {
  text-align: center;
  color: #8899b4;
  font-size: 1rem;
  margin: 0 0 32px;
}

/* Mode toggle */
.cnx-sim-toggle {
  display: flex;
  gap: 0;
  margin: 0 auto 32px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
}

.cnx-sim-toggle-btn {
  padding: 10px 24px;
  border: none;
  background: transparent;
  color: #8899b4;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.25s ease;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.cnx-sim-toggle-btn.active {
  background: rgba(0, 128, 255, 0.15);
  color: #4dc3ff;
  box-shadow: 0 0 12px rgba(0, 128, 255, 0.15);
}

/* Presets */
.cnx-sim-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0 0 40px;
}

.cnx-sim-preset-card {
  background: rgba(12, 18, 35, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cnx-sim-preset-card:hover {
  border-color: rgba(0, 128, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 128, 255, 0.1);
}

.cnx-sim-preset-card.active {
  border-color: rgba(0, 128, 255, 0.45);
  background: rgba(0, 128, 255, 0.1);
}

.cnx-sim-preset-icon {
  font-size: 2rem;
  margin: 0 0 8px;
  display: block;
}

.cnx-sim-preset-name {
  color: #e8edf5;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.cnx-sim-preset-info {
  color: #8899b4;
  font-size: 0.8rem;
}

/* Resource bar */
.cnx-sim-resource-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(12, 18, 35, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 20px 24px;
  margin: 0 0 24px;
  flex-wrap: wrap;
}

.cnx-sim-gauge-wrap {
  flex: 0 0 120px;
  text-align: center;
}

.cnx-sim-gauge {
  width: 100px;
  height: 100px;
  position: relative;
  margin: 0 auto;
}

.cnx-sim-gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.cnx-sim-gauge-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #e8edf5;
  font-family: 'Space Grotesk', monospace;
}

.cnx-sim-gauge-label {
  color: #8899b4;
  font-size: 0.75rem;
  margin-top: 6px;
}

.cnx-sim-gw-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 280px;
}

.cnx-sim-gw-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 8px;
}

.cnx-sim-gw-info {
  flex: 1;
}

.cnx-sim-gw-name {
  color: #e8edf5;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.cnx-sim-gw-specs {
  color: #8899b4;
  font-size: 0.8rem;
  margin: 0 0 6px;
}

.cnx-sim-gw-price {
  color: #4dc3ff;
  font-size: 1rem;
  font-weight: 600;
}

/* 4 Columns layout */
.cnx-sim-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 0 0 40px;
}

.cnx-sim-col {
  background: rgba(12, 18, 35, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px 20px;
  transition: border-color 0.3s ease;
}

.cnx-sim-col.active {
  border-color: var(--cnx-sim-col-color, rgba(0, 128, 255, 0.3));
}

.cnx-sim-col.disabled {
  opacity: 0.5;
}

.cnx-sim-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 20px;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cnx-sim-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.cnx-sim-col-title {
  color: #e8edf5;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cnx-sim-col-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
  border: none;
  flex-shrink: 0;
}

.cnx-sim-col-toggle::after {
  content: '';
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.25s ease;
}

.cnx-sim-col-toggle:checked {
  background: var(--cnx-sim-col-color, #0080ff);
}

.cnx-sim-col-toggle:checked::after {
  transform: translateX(18px);
}

/* Sliders & controls */
.cnx-sim-control {
  margin: 0 0 18px;
}

.cnx-sim-control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 8px;
}

.cnx-sim-control-name {
  color: #e8edf5;
  font-size: 0.85rem;
  font-weight: 500;
}

.cnx-sim-control-value {
  color: #4dc3ff;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Space Grotesk', monospace;
  min-width: 28px;
  text-align: right;
}

.cnx-sim-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.cnx-sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cnx-sim-col-color, #0080ff);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 128, 255, 0.3);
  transition: transform 0.15s ease;
}

.cnx-sim-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.cnx-sim-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cnx-sim-col-color, #0080ff);
  cursor: pointer;
  border: none;
}

.cnx-sim-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.cnx-sim-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cnx-sim-checkbox:checked {
  background: var(--cnx-sim-col-color, #0080ff);
  border-color: var(--cnx-sim-col-color, #0080ff);
}

.cnx-sim-checkbox:checked::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
}

.cnx-sim-checkbox-label {
  color: #e8edf5;
  font-size: 0.85rem;
  cursor: pointer;
}

.cnx-sim-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.cnx-sim-chip {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #e8edf5;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cnx-sim-chip.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.45);
  color: #a78bfa;
}

.cnx-sim-storage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 8px;
  padding: 8px 14px;
  color: #a78bfa;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 8px 0 0;
}

.cnx-sim-storage-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  color: #f59e0b;
}

.cnx-sim-storage-badge.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.cnx-sim-note {
  color: #8899b4;
  font-size: 0.75rem;
  font-style: italic;
  margin: 12px 0 0;
}

.cnx-sim-coming-soon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: #8899b4;
  font-size: 0.9rem;
  font-style: italic;
  text-align: center;
}

/* Carousel */
.cnx-sim-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 0 12px;
  margin: 0 0 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.cnx-sim-carousel::-webkit-scrollbar {
  height: 4px;
}

.cnx-sim-carousel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.cnx-sim-carousel-card {
  flex: 0 0 140px;
  background: rgba(12, 18, 35, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.cnx-sim-carousel-card:hover {
  border-color: rgba(0, 128, 255, 0.3);
  transform: translateY(-2px);
}

.cnx-sim-carousel-card.selected {
  border-color: rgba(0, 128, 255, 0.45);
  background: rgba(0, 128, 255, 0.08);
}

.cnx-sim-carousel-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 4px;
}

.cnx-sim-carousel-name {
  color: #e8edf5;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cnx-sim-carousel-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* Recap */
.cnx-sim-recap {
  background: rgba(12, 18, 35, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 32px 24px;
  margin: 0 0 24px;
}

.cnx-sim-recap-title {
  color: #e8edf5;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 20px;
}

.cnx-sim-recap-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0 0 24px;
  overflow: hidden;
}

.cnx-sim-recap-columns > div {
  min-width: 0;
  overflow: hidden;
}

.cnx-sim-recap-col-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 12px;
  padding: 0 0 8px;
  border-bottom: 2px solid #0080ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cnx-sim-recap-item {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

@media (max-width: 1400px) {
  .cnx-sim-recap-item {
    grid-template-columns: 40px 1fr;
    gap: 6px;
  }
  .cnx-sim-recap-item-price {
    grid-column: 2;
  }
}

.cnx-sim-recap-item:last-child {
  border-bottom: none;
}

.cnx-sim-recap-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
}

.cnx-sim-recap-item-info {
  flex: 1;
  min-width: 0;
}

.cnx-sim-recap-item-name {
  color: #e8edf5;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cnx-sim-recap-item-specs {
  color: #8899b4;
  font-size: 0.75rem;
}

.cnx-sim-recap-item-qty {
  color: #8899b4;
  font-size: 0.8rem;
  white-space: nowrap;
}

.cnx-sim-recap-item-price {
  color: #4dc3ff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

/* Totals */
.cnx-sim-totals {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 0 0;
  margin: 20px 0 0;
}

.cnx-sim-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.cnx-sim-total-label {
  color: #8899b4;
  font-size: 0.9rem;
}

.cnx-sim-total-value {
  color: #e8edf5;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Space Grotesk', monospace;
}

.cnx-sim-total-row.grand {
  padding: 12px 0 0;
  margin: 8px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.cnx-sim-total-row.grand .cnx-sim-total-label {
  color: #e8edf5;
  font-size: 1.1rem;
  font-weight: 700;
}

.cnx-sim-total-row.grand .cnx-sim-total-value {
  color: #4dc3ff;
  font-size: 1.3rem;
  font-weight: 800;
}

.cnx-sim-delivery {
  color: #8899b4;
  font-size: 0.8rem;
  text-align: right;
  margin: 8px 0 0;
}

/* Action buttons */
.cnx-sim-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cnx-sim-btn {
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  border: none;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.cnx-sim-btn-primary {
  background: linear-gradient(135deg, #0080ff, #0066dd);
  color: #fff;
}

.cnx-sim-btn-primary:hover {
  box-shadow: 0 4px 20px rgba(0, 128, 255, 0.3);
  transform: translateY(-1px);
}

.cnx-sim-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #8899b4;
}

.cnx-sim-btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: #e8edf5;
}

.cnx-sim-btn-quote {
  background: linear-gradient(135deg, #25D366, #128C7E);
  border: none;
  color: #fff;
}

.cnx-sim-btn-quote:hover {
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
  transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 1200px) {
  .cnx-sim-columns { grid-template-columns: repeat(2, 1fr); }
  .cnx-sim-presets { grid-template-columns: repeat(3, 1fr); }
  .cnx-sim-recap-columns { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .cnx-sim-columns { grid-template-columns: 1fr; }
  .cnx-sim-presets { grid-template-columns: repeat(2, 1fr); }
  .cnx-sim-resource-bar { flex-direction: column; text-align: center; }
  .cnx-sim-gw-card { flex-direction: column; text-align: center; }
  .cnx-sim-actions { flex-direction: column; }
  .cnx-sim-btn { width: 100%; text-align: center; }
  .cnx-sim-title { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .cnx-sim-presets { grid-template-columns: 1fr; }
  .cnx-simulator-section { padding: 40px 12px 24px; }
}
