/**
 * EcoMine - Normalization Wizard Styles
 * =====================================
 * Wizard de 5 pasos para normalización de capas raster
 * Diseño coherente con el resto de la aplicación EcoMine
 */

/* ============================================================
   VARIABLES (heredadas del sistema de diseño)
   ============================================================ */
:root {
  --nw-bg: #1a1a1a;
  --nw-bg-secondary: #141414;
  --nw-bg-card: #242424;
  --nw-bg-card-hover: #2e2e2e;
  --nw-bg-input: #1e1e1e;
  --nw-text: #f5f5f5;
  --nw-text-secondary: #a3a3a3;
  --nw-text-muted: #737373;
  --nw-border: #333;
  --nw-border-light: #2a2a2a;
  --nw-accent: #10b981;
  --nw-accent-hover: #059669;
  --nw-warning: #f59e0b;
  --nw-error: #ef4444;
  --nw-info: #6b7280;
}

/* ============================================================
   MODAL OVERLAY
   ============================================================ */
.norm-wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 9999 !important;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.norm-wizard-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

/* ============================================================
   WIZARD CONTAINER
   ============================================================ */
.norm-wizard {
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  background: var(--nw-bg);
  border: 1px solid var(--nw-border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.3s ease;
  z-index: 10000 !important;
  position: relative;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================================
   HEADER
   ============================================================ */
.norm-wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--nw-bg-secondary);
  border-bottom: 1px solid var(--nw-border);
}

.norm-wizard-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.norm-wizard-title-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--nw-accent), #047857);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.norm-wizard-title h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--nw-text);
  margin: 0;
}

.norm-wizard-title span {
  font-size: 0.8rem;
  color: var(--nw-text-muted);
}

.norm-wizard-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--nw-border);
  color: var(--nw-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.norm-wizard-close:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--nw-error);
  color: var(--nw-error);
}

/* ============================================================
   STEPPER (Indicador de pasos)
   ============================================================ */
.norm-wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px;
  background: var(--nw-bg-secondary);
  border-bottom: 1px solid var(--nw-border-light);
  gap: 8px;
}

.norm-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.norm-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--nw-bg-card);
  border: 2px solid var(--nw-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--nw-text-muted);
  transition: all 0.3s;
  position: relative;
}

.norm-step.active .norm-step-number {
  background: var(--nw-accent);
  border-color: var(--nw-accent);
  color: white;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.1);
  }
}

.norm-step.completed .norm-step-number {
  background: var(--nw-accent);
  border-color: var(--nw-accent);
  color: transparent; /* Ocultar número */
}

.norm-step.completed .norm-step-number::before {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  font-size: 0.75rem;
  color: white; /* Check blanco */
}

.norm-step-label {
  font-size: 0.8rem;
  color: var(--nw-text-muted);
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.norm-step.active .norm-step-label {
  color: var(--nw-text);
  font-weight: 500;
}

.norm-step-connector {
  width: 40px;
  height: 2px;
  background: var(--nw-border);
  transition: background 0.3s;
}

.norm-step.completed + .norm-step-connector,
.norm-step-connector.completed {
  background: var(--nw-accent);
}

@media (max-width: 900px) {
  .norm-step-label {
    display: none;
  }
  .norm-step-connector {
    width: 24px;
  }
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.norm-wizard-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.norm-wizard-step {
  display: none;
  animation: slideIn 0.3s ease;
}

.norm-wizard-step.active {
  display: block;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Step intro header */
.norm-step-intro {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--nw-border-light);
}

.norm-step-intro-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--nw-accent);
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.norm-step-intro h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--nw-text);
  margin: 0 0 8px 0;
}

.norm-step-intro p {
  font-size: 0.95rem;
  color: var(--nw-text-secondary);
  margin: 0;
}

/* ============================================================
   STEP 1: CONTEXTO Y DIAGNÓSTICO
   ============================================================ */
.norm-diagnosis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
}

@media (max-width: 900px) {
  .norm-diagnosis-grid {
    grid-template-columns: 1fr;
  }
}

/* Panel genérico */
.norm-panel {
  background: var(--nw-bg-card);
  border: 1px solid var(--nw-border);
  border-radius: 12px;
  overflow: hidden;
}

.norm-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--nw-border-light);
}

.norm-panel-header i {
  color: var(--nw-accent);
  font-size: 14px;
}

.norm-panel-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--nw-text);
  margin: 0;
  flex: 1;
}

.norm-btn-calculate-histogram {
  padding: 6px 12px;
  background: var(--nw-accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.norm-btn-calculate-histogram:hover {
  background: var(--nw-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.norm-btn-calculate-histogram:disabled {
  background: #555;
  cursor: not-allowed;
  opacity: 0.5;
}

.norm-btn-calculate-histogram i {
  color: white;
  font-size: 12px;
}

.norm-empty-histogram {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  text-align: center;
  padding: 20px;
}

.norm-panel-body {
  padding: 16px;
}

/* Panel A: Identificación de capa */
.norm-layer-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.norm-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.norm-info-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--nw-text-muted);
}

.norm-info-value {
  font-size: 0.875rem;
  color: var(--nw-text);
  font-weight: 500;
}

.norm-info-value.mono {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 0.8rem;
}

/* Selector de extensión */
.norm-extent-selector {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--nw-border-light);
}

.norm-extent-options {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.norm-extent-option {
  flex: 1;
  padding: 12px;
  background: var(--nw-bg-input);
  border: 2px solid var(--nw-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.norm-extent-option:hover {
  border-color: var(--nw-text-muted);
}

.norm-extent-option.selected {
  border-color: var(--nw-accent);
  background: rgba(16, 185, 129, 0.1);
}

.norm-extent-option input {
  display: none;
}

.norm-extent-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--nw-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.norm-extent-option.selected .norm-extent-radio {
  border-color: var(--nw-accent);
}

.norm-extent-option.selected .norm-extent-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nw-accent);
}

.norm-extent-text {
  font-size: 0.8rem;
  color: var(--nw-text);
}

/* Panel B: Diagnóstico estadístico */
.norm-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.norm-stat-item {
  background: var(--nw-bg-input) !important;
  padding: 16px 12px !important;
  border-radius: 8px !important;
  text-align: center !important;
  min-height: 80px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 8px !important;
}

.norm-stat-value {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  font-family: 'SF Mono', 'Courier New', monospace !important;
  display: block !important;
  margin-bottom: 6px !important;
  opacity: 1 !important;
  visibility: visible !important;
  line-height: 1.6 !important;
  text-align: center !important;
  min-height: 28px !important;
  width: 100% !important;
  letter-spacing: 0.5px !important;
}

/* Target specific stat IDs with maximum specificity */
#norm-stat-min,
#norm-stat-max,
#norm-stat-mean,
#norm-stat-median,
#norm-stat-std,
#norm-stat-nodata-pct {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  font-family: 'SF Mono', 'Courier New', monospace !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  line-height: 1.6 !important;
  text-align: center !important;
  min-height: 28px !important;
  width: 100% !important;
  letter-spacing: 0.5px !important;
}

.norm-stat-label {
  font-size: 0.7rem;
  color: var(--nw-text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.norm-percentiles {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--nw-border-light);
}

.norm-percentile-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.norm-percentile-item span {
  color: #ffffff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.norm-percentiles-title {
  font-size: 0.75rem;
  color: var(--nw-text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.norm-percentiles-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.norm-percentile-item {
  background: var(--nw-bg-input);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
}

.norm-percentile-item span:first-child {
  color: var(--nw-text-muted);
}

.norm-percentile-item span:last-child {
  color: var(--nw-text);
  font-weight: 500;
  margin-left: 4px;
  font-family: monospace;
}

.norm-skew-indicator {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}

.norm-skew-indicator.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.norm-skew-indicator.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #9ca3af;
}

.norm-skew-indicator.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

/* Panel C: Histograma */
.norm-histogram-panel {
  grid-column: span 2;
}

@media (max-width: 900px) {
  .norm-histogram-panel {
    grid-column: span 1;
  }
}

.norm-histogram-container {
  position: relative !important;
  width: 100% !important;
  height: 250px !important;
  min-height: 250px !important;
  background: rgba(0,0,0,0.1) !important;
}

#norm-histogram-chart {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  height: 250px !important;
  max-height: 250px !important;
  min-height: 250px !important;
  z-index: 1 !important;
  position: relative !important;
}

.norm-histogram-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--nw-border-light);
}

.norm-log-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--nw-text-secondary);
  cursor: pointer;
}

.norm-log-toggle input {
  display: none;
}

.norm-toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--nw-bg-input);
  border: 1px solid var(--nw-border);
  border-radius: 10px;
  position: relative;
  transition: all 0.2s;
}

.norm-toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--nw-text-muted);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
}

.norm-log-toggle input:checked + .norm-toggle-switch {
  background: var(--nw-accent);
  border-color: var(--nw-accent);
}

.norm-log-toggle input:checked + .norm-toggle-switch::after {
  transform: translateX(16px);
  background: white;
}

.norm-diagnosis-text {
  flex: 1;
  text-align: right;
  font-size: 0.8rem;
  color: var(--nw-text-secondary);
  font-style: italic;
}

/* ============================================================
   STEP 2: OBJETIVO DE TRANSFORMACIÓN
   ============================================================ */
.norm-objective-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

@media (max-width: 700px) {
  .norm-objective-options {
    grid-template-columns: 1fr;
  }
}

.norm-objective-card {
  background: var(--nw-bg-card);
  border: 2px solid var(--nw-border);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.norm-objective-card:hover {
  border-color: var(--nw-text-muted);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.norm-objective-card.selected {
  border-color: var(--nw-accent);
  background: rgba(16, 185, 129, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.norm-objective-card input {
  display: none;
}

.norm-objective-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.norm-objective-card[data-value="analysis"] .norm-objective-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(4, 120, 87, 0.2));
  color: var(--nw-accent);
}

.norm-objective-card[data-value="visual"] .norm-objective-icon {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(109, 40, 217, 0.2));
  color: #fb923c;
}

.norm-objective-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--nw-text);
  margin-bottom: 8px;
}

.norm-objective-desc {
  font-size: 0.85rem;
  color: var(--nw-text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.norm-objective-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.norm-objective-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--nw-text-muted);
}

.norm-objective-feature i {
  color: var(--nw-accent);
  font-size: 10px;
}

.norm-objective-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.norm-objective-card[data-value="analysis"] .norm-objective-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--nw-accent);
}

.norm-objective-card[data-value="visual"] .norm-objective-badge {
  background: rgba(139, 92, 246, 0.15);
  color: #fb923c;
}

/* ============================================================
   LAYER SELECTOR (STEP 1)
   ============================================================ */
.norm-layer-selector-panel {
  max-width: 900px;
  margin: 0 auto 24px auto;
}

.norm-layer-selector {
  width: 100%;
  padding: 12px 16px;
  background: var(--nw-bg-card);
  border: 1px solid var(--nw-border);
  border-radius: 10px;
  color: var(--nw-text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.norm-layer-selector:focus {
  outline: none;
  border-color: var(--nw-accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.norm-layer-selector option {
  background: var(--nw-bg-card);
  color: var(--nw-text);
  padding: 8px;
}

.norm-layer-selector option:disabled {
  color: var(--nw-text-muted);
}

/* ============================================================
   STEP 3: CATÁLOGO DE MÉTODOS
   ============================================================ */
.norm-methods-search {
  max-width: 900px;
  margin: 0 auto 24px auto;
  position: relative;
}

.norm-methods-search i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--nw-text-muted);
  font-size: 14px;
  pointer-events: none;
}

.norm-methods-search input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--nw-bg-card);
  border: 1px solid var(--nw-border);
  border-radius: 10px;
  color: var(--nw-text);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.norm-methods-search input:focus {
  outline: none;
  border-color: var(--nw-accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.norm-methods-search input::placeholder {
  color: var(--nw-text-muted);
}

.norm-methods-container {
  max-width: 900px;
  margin: 0 auto;
}

.norm-method-family {
  margin-bottom: 24px;
}

.norm-method-family-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--nw-bg-card);
  border: 1px solid var(--nw-border);
  border-radius: 12px 12px 0 0;
  cursor: pointer;
}

.norm-method-family-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.norm-method-family[data-family="linear"] .norm-method-family-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #6b7280;
}

.norm-method-family[data-family="statistical"] .norm-method-family-icon {
  background: rgba(139, 92, 246, 0.15);
  color: #fb923c;
}

.norm-method-family[data-family="transform"] .norm-method-family-icon {
  background: rgba(236, 72, 153, 0.15);
  color: #ec4899;
}

.norm-method-family[data-family="fuzzy"] .norm-method-family-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.norm-method-family[data-family="quantile"] .norm-method-family-icon {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}

.norm-method-family-title {
  flex: 1;
}

.norm-method-family-title h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--nw-text);
  margin: 0;
}

.norm-method-family-title span {
  font-size: 0.75rem;
  color: var(--nw-text-muted);
}

.norm-method-family-toggle {
  color: var(--nw-text-muted);
  transition: transform 0.2s;
}

.norm-method-family.expanded .norm-method-family-toggle {
  transform: rotate(180deg);
}

.norm-method-variants {
  display: none;
  padding: 8px;
  background: var(--nw-bg-secondary);
  border: 1px solid var(--nw-border);
  border-top: none;
  border-radius: 0 0 12px 12px;
}

.norm-method-family.expanded .norm-method-variants {
  display: block;
}

.norm-method-variant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.norm-method-variant:hover {
  background: var(--nw-bg-card);
  transform: translateX(4px);
}

.norm-method-variant.selected {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  transform: translateX(4px);
}

.norm-method-variant input {
  display: none;
}

.norm-method-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--nw-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.norm-method-variant.selected .norm-method-radio {
  border-color: var(--nw-accent);
}

.norm-method-variant.selected .norm-method-radio::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--nw-accent);
}

.norm-method-info h5 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nw-text);
  margin: 0 0 4px 0;
}

.norm-method-info p {
  font-size: 0.75rem;
  color: var(--nw-text-muted);
  margin: 0;
}

.norm-method-recommended {
  margin-left: auto;
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.15);
  border-radius: 4px;
  font-size: 0.65rem;
  color: var(--nw-accent);
  text-transform: uppercase;
  font-weight: 600;
}

/* ============================================================
   STEP 4: PARÁMETROS Y PREVISUALIZACIÓN
   ============================================================ */
.norm-params-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto 1fr;
  gap: 20px;
  height: calc(90vh - 280px);
  min-height: 500px;
}

@media (max-width: 1000px) {
  .norm-params-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* Panel A: Orientación del criterio */
.norm-orientation-panel {
  grid-column: 1;
  grid-row: 1;
}

.norm-orientation-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.norm-orientation-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--nw-bg-input);
  border: 2px solid var(--nw-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.norm-orientation-option:hover {
  border-color: var(--nw-text-muted);
}

.norm-orientation-option.selected {
  border-color: var(--nw-accent);
  background: rgba(16, 185, 129, 0.08);
}

.norm-orientation-option input {
  display: none;
}

.norm-orientation-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--nw-bg-card);
  color: var(--nw-text-muted);
}

.norm-orientation-option.selected .norm-orientation-icon {
  background: var(--nw-accent);
  color: white;
}

.norm-orientation-text h5 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--nw-text);
  margin: 0;
}

.norm-orientation-text span {
  font-size: 0.7rem;
  color: var(--nw-text-muted);
}

/* Panel B: Parámetros del método */
.norm-method-params-panel {
  grid-column: 1;
  grid-row: 2;
  overflow-y: auto;
  min-height: 200px;
}

.norm-param-group {
  margin-bottom: 16px;
}

.norm-param-label {
  display: block;
  font-size: 0.75rem;
  color: var(--nw-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.norm-param-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--nw-bg-input);
  border: 1px solid var(--nw-border);
  border-radius: 8px;
  color: var(--nw-text);
  font-size: 0.875rem;
  transition: all 0.15s;
}

.norm-param-input:focus {
  outline: none;
  border-color: var(--nw-accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.norm-param-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.norm-param-slider {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.norm-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--nw-bg-input);
  -webkit-appearance: none;
  appearance: none;
}

.norm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--nw-accent);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.norm-slider-value {
  text-align: center;
  font-size: 0.8rem;
  color: var(--nw-text-secondary);
  font-family: monospace;
}

.norm-param-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--nw-bg-input);
  border: 1px solid var(--nw-border);
  border-radius: 8px;
  color: var(--nw-text);
  font-size: 0.875rem;
  cursor: pointer;
}

/* Panel C: Previsualización cartográfica */
.norm-preview-map-panel {
  grid-column: 2;
  grid-row: 1 / 3;
}

@media (max-width: 1000px) {
  .norm-preview-map-panel {
    grid-column: 1;
    grid-row: 3;
    height: 350px;
  }
}

.norm-map-container {
  height: 100%;
  min-height: 300px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--nw-bg-input);
}

.norm-map-split {
  display: flex;
  height: 100%;
}

.norm-map-side {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

.norm-map-side-label {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--nw-text);
  z-index: 10;
}

.norm-map-canvas {
  flex: 1;
  background: #1a1a1a;
}

.norm-map-divider {
  width: 4px;
  background: var(--nw-accent);
  cursor: col-resize;
  position: relative;
}

.norm-map-divider::after {
  content: '⋮';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
}

.norm-legend {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  padding: 10px;
  z-index: 10;
}

.norm-legend-gradient {
  width: 20px;
  height: 100px;
  border-radius: 4px;
  /* Invertido: abajo verde (0 = mejor), arriba rojo (1 = peor) */
  background: linear-gradient(to bottom, #d73027, #fc8d59, #ffffbf, #91cf60, #1a9850);
  margin-bottom: 8px;
}

.norm-legend-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100px;
  font-size: 0.65rem;
  color: var(--nw-text-muted);
}

/* Panel D: Histograma antes/después */
.norm-histogram-compare {
  margin-top: 20px;
}

.norm-histogram-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.norm-histogram-single {
  background: var(--nw-bg-input);
  border-radius: 8px;
  padding: 12px;
}

.norm-histogram-single h5 {
  font-size: 0.75rem;
  color: var(--nw-text-muted);
  margin: 0 0 10px 0;
  text-transform: uppercase;
}

.norm-histogram-canvas {
  height: 120px;
}

.norm-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 0.8rem;
}

.norm-alert.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.norm-alert.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #9ca3af;
}

.norm-alert i {
  margin-top: 2px;
}

/* ============================================================
   STEP 5: APLICAR Y TRAZABILIDAD
   ============================================================ */
.norm-apply-container {
  max-width: 700px;
  margin: 0 auto;
}

.norm-apply-section {
  background: var(--nw-bg-card);
  border: 1px solid var(--nw-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.norm-apply-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--nw-text);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.norm-apply-section h4 i {
  color: var(--nw-accent);
}

.norm-output-name {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.norm-output-name .norm-param-group {
  flex: 1;
  margin: 0;
}

.norm-output-name button {
  padding: 10px 16px;
  background: var(--nw-bg-input);
  border: 1px solid var(--nw-border);
  border-radius: 8px;
  color: var(--nw-text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.norm-output-name button:hover {
  border-color: var(--nw-accent);
  color: var(--nw-accent);
}

.norm-checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--nw-bg-input);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 10px;
}

.norm-checkbox-option:last-child {
  margin-bottom: 0;
}

.norm-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--nw-border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s;
}

.norm-checkbox-option input {
  display: none;
}

.norm-checkbox-option input:checked + .norm-checkbox {
  background: var(--nw-accent);
  border-color: var(--nw-accent);
}

.norm-checkbox-option input:checked + .norm-checkbox::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10px;
  color: white;
}

.norm-checkbox-text h5 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--nw-text);
  margin: 0 0 4px 0;
}

.norm-checkbox-text p {
  font-size: 0.75rem;
  color: var(--nw-text-muted);
  margin: 0;
}

.norm-version-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.norm-version-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.norm-version-label {
  font-size: 0.7rem;
  color: var(--nw-text-muted);
  text-transform: uppercase;
}

.norm-version-value {
  font-size: 0.85rem;
  color: var(--nw-text);
  font-family: monospace;
}

.norm-traceability-preview {
  background: var(--nw-bg-input);
  border-radius: 8px;
  padding: 12px;
  font-family: 'SF Mono', monospace;
  font-size: 0.75rem;
  color: var(--nw-text-secondary);
  max-height: 150px;
  overflow-y: auto;
}

.norm-traceability-preview pre {
  margin: 0;
  white-space: pre-wrap;
}

/* ============================================================
   FOOTER (Navigation)
   ============================================================ */
.norm-wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--nw-bg-secondary);
  border-top: 1px solid var(--nw-border);
}

.norm-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.norm-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.norm-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.norm-btn-secondary {
  background: var(--nw-bg-card);
  border: 1px solid var(--nw-border);
  color: var(--nw-text);
}

.norm-btn-secondary:hover {
  background: var(--nw-bg-card-hover);
  border-color: var(--nw-text-muted);
}

.norm-btn-primary {
  background: var(--nw-accent);
  border: none;
  color: white;
}

.norm-btn-primary:hover {
  background: var(--nw-accent-hover);
}

.norm-btn-primary:disabled {
  background: var(--nw-bg-card);
  color: var(--nw-text-muted);
  cursor: not-allowed;
}

.norm-btn-success {
  background: linear-gradient(135deg, var(--nw-accent), #047857);
  border: none;
  color: white;
  padding: 12px 24px;
}

.norm-btn-success:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.norm-btn-success.loading {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  cursor: wait;
  position: relative;
  overflow: hidden;
}

.norm-btn-success.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ============================================================
   LOADING & EMPTY STATES
   ============================================================ */
.norm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--nw-text-muted);
}

.norm-loading i {
  font-size: 32px;
  margin-bottom: 16px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.norm-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.norm-empty-state i {
  font-size: 48px;
  color: var(--nw-text-muted);
  margin-bottom: 16px;
}

.norm-empty-state h4 {
  color: var(--nw-text);
  margin: 0 0 8px 0;
}

.norm-empty-state p {
  color: var(--nw-text-muted);
  font-size: 0.875rem;
}

/* ============================================================
   TOOLTIPS
   ============================================================ */
.norm-tooltip {
  position: relative;
  cursor: help;
  color: var(--nw-text-muted);
  transition: color 0.2s;
}

.norm-tooltip:hover {
  color: var(--nw-accent);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .norm-wizard {
    max-height: 100vh;
    border-radius: 0;
  }

  .norm-wizard-header {
    padding: 12px 16px;
  }

  .norm-wizard-content {
    padding: 16px;
  }

  .norm-wizard-footer {
    padding: 12px 16px;
  }

  .norm-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
  }

  .norm-step-intro {
    margin-bottom: 24px;
    padding-bottom: 16px;
  }

  .norm-step-intro h3 {
    font-size: 1.25rem;
  }

  .norm-objective-options,
  .norm-histogram-dual {
    grid-template-columns: 1fr;
  }

  .norm-params-grid {
    grid-template-columns: 1fr;
  }
}

/* === Hotfix: evitar histograma 0x0 (refuerzo) === */
.norm-histogram-container {
  width: 100% !important;
  min-height: 300px !important;
  overflow: visible !important;
}
#norm-histogram-chart {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 250px !important;
}

/* ============================================================
   ZOOM SLIDERS (Large visual sliders for histogram zoom)
   ============================================================ */
.norm-zoom-slider-large {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right,
    rgba(16, 185, 129, 0.15) 0%,
    rgba(16, 185, 129, 0.25) 50%,
    rgba(16, 185, 129, 0.15) 100%);
  outline: none;
  cursor: pointer;
  border: 1px solid rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
}

.norm-zoom-slider-large:hover {
  background: linear-gradient(to right,
    rgba(16, 185, 129, 0.2) 0%,
    rgba(16, 185, 129, 0.35) 50%,
    rgba(16, 185, 129, 0.2) 100%);
  border-color: rgba(16, 185, 129, 0.5);
}

.norm-zoom-slider-large::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  cursor: grab;
  border: 3px solid #1a1a1a;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(16, 185, 129, 0.5);
  transition: all 0.2s;
}

.norm-zoom-slider-large::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 0 0 4px rgba(16, 185, 129, 0.3);
}

.norm-zoom-slider-large::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.norm-zoom-slider-large::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  cursor: grab;
  border: 3px solid #1a1a1a;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(16, 185, 129, 0.5);
  transition: all 0.2s;
}

.norm-zoom-slider-large::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 0 0 4px rgba(16, 185, 129, 0.3);
}

.norm-zoom-slider-large::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.norm-zoom-slider-large::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 5px;
  background: transparent;
}

.norm-zoom-slider-large::-moz-range-track {
  height: 10px;
  border-radius: 5px;
  background: transparent;
}

/* Hover effect on reset button */
#norm-btn-reset-zoom:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

/* ============================================================
   ZOOM SLIDER BIDIRECCIONAL - MINIMALISTA Y ANCHO
   ============================================================ */
.norm-zoom-bidirectional {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease;
}

.norm-zoom-bidirectional:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Thumb para Webkit (Chrome, Safari, Edge) */
.norm-zoom-bidirectional::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  cursor: grab;
  border: 2px solid #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
}

.norm-zoom-bidirectional::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow:
    0 3px 12px rgba(0, 0, 0, 0.5),
    0 0 0 4px rgba(255, 255, 255, 0.2);
}

.norm-zoom-bidirectional::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

/* Thumb para Firefox */
.norm-zoom-bidirectional::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  cursor: grab;
  border: 2px solid #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
}

.norm-zoom-bidirectional::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow:
    0 3px 12px rgba(0, 0, 0, 0.5);
}

.norm-zoom-bidirectional::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.norm-zoom-bidirectional::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}


/* Spinner animation for histogram modal */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Histogram button hover effect */
#norm-btn-open-histogram:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

#norm-btn-open-histogram:active {
  transform: translateY(0);
}

/* Close button hover */
#norm-btn-close-histogram:hover {
  background: rgba(255, 255, 255, 0.2);
}

