/* =====================================================================
   RESULTADOS PANEL - GLOBPAY MERCHANT DASHBOARD
   Tokens: Turquesa #0BB6B5, Fondos #f8fafc, Bordes #e2e8f0, Texto #0f172a
   ===================================================================== */

#view-resultados {
  display: none;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 0 40px 0;
  box-sizing: border-box;
}

#view-resultados.is-active {
  display: block;
}

/* 1. CABECERA Y FILTROS */
.results-header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.results-header-text {
  flex: 1 1 300px;
}

.results-title {
  margin: 0 0 6px 0;
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.results-subtitle {
  margin: 0;
  font-size: 14px;
  color: #64748b;
  line-height: 1.4;
}

.results-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.results-period-select {
  height: 38px;
  padding: 0 32px 0 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: #0f172a;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.results-period-select:focus {
  outline: none;
  border-color: #0BB6B5;
  box-shadow: 0 0 0 3px rgba(11, 182, 181, 0.15);
}

.results-custom-date-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.results-date-input {
  height: 38px;
  padding: 0 10px;
  font-size: 13px;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-sizing: border-box;
}

.results-date-input:focus {
  outline: none;
  border-color: #0BB6B5;
  box-shadow: 0 0 0 3px rgba(11, 182, 181, 0.15);
}

.results-date-separator {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.btn-results-apply-date {
  height: 38px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: #0BB6B5;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-results-apply-date:hover {
  background: #099e9d;
}

.btn-export-results {
  height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-export-results:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-export-results:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-icon-svg {
  width: 16px;
  height: 16px;
  color: #475569;
}

/* 2. BARRA DE DEMOSTRACIÓN */
.results-demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.results-demo-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.results-demo-toggle-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
}

.results-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.results-toggle-slider {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  background-color: #cbd5e1;
  border-radius: 22px;
  transition: background-color 0.2s ease;
}

.results-toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.results-toggle-input:checked + .results-toggle-slider {
  background-color: #0BB6B5;
}

.results-toggle-input:checked + .results-toggle-slider::before {
  transform: translateX(16px);
}

.results-toggle-input:focus-visible + .results-toggle-slider {
  outline: 2px solid #0BB6B5;
  outline-offset: 2px;
}

.results-demo-notice-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  padding: 6px 12px;
  border-radius: 8px;
  max-width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
}

.results-demo-text {
  word-break: break-word;
  line-height: 1.35;
}

.results-demo-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #0BB6B5;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 4px;
}

/* Indicador de carga */
.results-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  margin-bottom: 16px;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: 8px;
  font-size: 13px;
  color: #0f766e;
}

.results-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #99f6e4;
  border-top-color: #0BB6B5;
  border-radius: 50%;
  animation: resultsSpin 0.7s linear infinite;
}

@keyframes resultsSpin {
  to { transform: rotate(360deg); }
}

/* 3. CUATRO INDICADORES SUPERIORES */
.results-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.results-metric-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.results-metric-card:hover {
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07);
}

.results-metric-label {
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  display: block;
  margin-bottom: 8px;
}

.results-metric-value {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.results-metric-caption {
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.3;
}

/* 4. FILA MEDIA: GRÁFICO Y MODALIDADES */
.results-grid-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.results-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}

.results-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.results-card-title {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.results-card-subtitle {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

/* SVG Chart Container */
.results-chart-container {
  width: 100%;
  height: 240px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-svg-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Tooltip flotante en SVG Chart */
.results-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #0f172a;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translate(-50%, -120%);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}

.results-chart-tooltip::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px 4px 0 4px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
}

.results-chart-empty-state {
  text-align: center;
  color: #94a3b8;
  font-size: 13.5px;
  padding: 40px 10px;
}

/* Modalidades de Pago (Progress bars) */
.results-modalities-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 6px;
}

.results-modality-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.results-modality-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.results-modality-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-modality-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.results-modality-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.results-modality-stats {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
}

.results-modality-pct {
  color: #64748b;
  font-weight: 400;
  font-size: 12.5px;
  margin-left: 4px;
}

.results-progress-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.results-progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* Colores armónicos de modalidades */
.dot-contraentrega { background: #64748b; }
.fill-contraentrega { background: #64748b; }

.dot-pago-completo { background: #0891b2; }
.fill-pago-completo { background: #0891b2; }

.dot-abono { background: #0BB6B5; }
.fill-abono { background: #0BB6B5; }

/* 5. FILA INFERIOR: RESUMEN Y LOGÍSTICA */
.results-grid-bottom {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* Tabla Resumen */
.results-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.results-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.results-summary-table th {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.results-summary-table th.th-num,
.results-summary-table td.td-num {
  text-align: right;
}

.results-summary-table td {
  padding: 12px 12px;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
}

.results-table-row-clickable {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.results-table-row-clickable:hover {
  background-color: #f0fdfa;
}

.results-table-row-clickable:focus-visible {
  outline: 2px solid #0BB6B5;
  background-color: #f0fdfa;
}

.results-modality-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.results-nav-icon {
  width: 14px;
  height: 14px;
  color: #0BB6B5;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.results-table-row-clickable:hover .results-nav-icon {
  opacity: 1;
  transform: translateX(2px);
}

.results-summary-table tfoot td {
  padding: 14px 12px;
  font-weight: 700;
  color: #0f172a;
  border-top: 2px solid #cbd5e1;
  border-bottom: none;
  background: #f8fafc;
}

.results-table-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  color: #64748b;
}

.results-hint-icon {
  width: 14px;
  height: 14px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* Tarjeta Logística */
.results-logistics-card {
  display: flex;
  flex-direction: column;
}

.logistics-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-pending-dropi {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  letter-spacing: 0.02em;
}

.results-logistics-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.logistics-rates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0 16px 0;
}

.logistics-rate-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.logistics-rate-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 6px;
}

.logistics-rate-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: #94a3b8;
  line-height: 1;
}

.logistics-message {
  margin: 0 0 16px 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}

.btn-logistics-action {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: #0BB6B5;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}

.btn-logistics-action:hover {
  color: #099e9d;
  transform: translateX(2px);
}

/* 6. NOTA AL PIE */
.results-footnote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.5;
}

.results-footnote-icon {
  width: 16px;
  height: 16px;
  color: #94a3b8;
  flex-shrink: 0;
  margin-top: 1px;
}

.results-footnote p {
  margin: 0;
}

/* =====================================================================
   RESPONSIVIDAD Y DISPOSITIVOS MÓVILES
   ===================================================================== */

@media (max-width: 1024px) {
  .results-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-grid-two-col {
    grid-template-columns: 1fr;
  }

  .results-grid-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .results-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .results-header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .results-period-select,
  .btn-export-results {
    width: 100%;
    justify-content: center;
  }

  .results-custom-date-wrap {
    flex-direction: column;
    width: 100%;
  }

  .results-date-input,
  .btn-results-apply-date {
    width: 100%;
  }

  .results-metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .results-metric-card {
    padding: 14px;
  }

  .results-metric-label {
    font-size: 12px;
  }

  .results-metric-value {
    font-size: 22px;
  }

  .results-metric-caption {
    font-size: 11px;
  }

  .results-card {
    padding: 16px;
  }

  .results-demo-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .results-demo-notice-banner {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .results-metrics-grid {
    grid-template-columns: 1fr;
  }
}
