/* ==========================================================================
   reportes.css — Estilos Modernos y Responsivos para el Centro de Reportes
   ========================================================================== */

/* ── Encabezado y Navegación ──────────────────────────────────────────────── */
.reportes-header-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.reportes-nav-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}
.reportes-header-nav .title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Pestañas de Selección de Reportes (Tabs) ──────────────────────────────── */
.reportes-nav-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px 2px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 16px;
  scrollbar-width: thin;
}
.reportes-nav-tabs::-webkit-scrollbar {
  height: 4px;
}
.reportes-nav-tabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.reporte-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  color: var(--text-muted, #64748b);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.reporte-tab-btn i {
  width: 17px;
  height: 17px;
}
.reporte-tab-btn:hover {
  background: var(--surface-hover, #f8fafc);
  color: var(--text, #0f172a);
  border-color: #cbd5e1;
}
.reporte-tab-btn.active {
  background: var(--primary, #0d9488);
  color: #ffffff;
  border-color: var(--primary, #0d9488);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.28);
}
.reporte-tab-btn.active i {
  color: #ffffff;
}

/* ── Barra de Filtros Responsiva ─────────────────────────────────────────── */
.reportes-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  background: var(--surface-alt, #f8fafc);
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0);
  margin-bottom: 20px;
}
.rpt-filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 160px;
  min-width: 140px;
}
.rpt-filter-item label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
}
.rpt-filter-item label i {
  width: 13px;
  height: 13px;
}
.rpt-filter-item select,
.rpt-filter-item input {
  height: 38px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 13px;
  color: #1e293b;
  transition: border-color 0.15s ease;
  width: 100%;
}
.rpt-filter-item select:focus,
.rpt-filter-item input:focus {
  outline: none;
  border-color: var(--primary, #0d9488);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.rpt-filter-search {
  flex: 2 1 240px;
}
.rpt-filter-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.rpt-filter-actions button {
  height: 38px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
}

/* ── Tarjetas KPI Ejecutivas ──────────────────────────────────────────────── */
.reportes-kpis-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.reporte-kpi-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.reporte-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.reporte-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.reporte-kpi-icon i {
  width: 22px;
  height: 22px;
}
.reporte-kpi-icon.teal   { background: #ccfbf1; color: #0d9488; }
.reporte-kpi-icon.green  { background: #dcfce7; color: #16a34a; }
.reporte-kpi-icon.blue   { background: #dbeafe; color: #2563eb; }
.reporte-kpi-icon.amber  { background: #fef3c7; color: #d97706; }
.reporte-kpi-icon.purple { background: #f3e8ff; color: #9333ea; }
.reporte-kpi-icon.rose   { background: #ffe4e6; color: #e11d48; }

.reporte-kpi-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.reporte-kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reporte-kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.reporte-kpi-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
}
.report-loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  color: #64748b;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ── Gráficas Lineales Horizontales ───────────────────────────────────────── */
.reportes-charts-wrapper {
  margin-bottom: 24px;
}
.reportes-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}
.report-chart-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}
.report-chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.report-chart-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.report-chart-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  text-transform: uppercase;
}
.report-chart-canvas-box {
  position: relative;
  height: 300px;
  width: 100%;
}

/* ── Tabla de Detalle Interactiva ─────────────────────────────────────────── */
.reportes-table-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.reportes-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.reportes-table-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.reportes-table-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.reportes-table-search input {
  height: 34px;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  width: 220px;
}
.reportes-table-wrap {
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
}
.reportes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.reportes-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.reportes-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}
.reportes-table tr:hover td {
  background: #f8fafc;
}
.reportes-table tfoot td {
  background: #f8fafc;
  font-weight: 800;
  border-top: 2px solid #cbd5e1;
  padding: 10px 12px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.reportes-table .text-right {
  text-align: right;
}
.reportes-table .text-center {
  text-align: center;
}
.reportes-table .num-gtq {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
}
.reportes-table .tag-sku {
  font-family: monospace;
  font-weight: 700;
  background: #f1f5f9;
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* Badges de Estado */
.rpt-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.rpt-badge.green  { background: #dcfce7; color: #166534; }
.rpt-badge.blue   { background: #dbeafe; color: #1e40af; }
.rpt-badge.amber  { background: #fef3c7; color: #92400e; }
.rpt-badge.purple { background: #f3e8ff; color: #6b21a8; }
.rpt-badge.red    { background: #fee2e2; color: #991b1b; }
.rpt-badge.gray   { background: #f1f5f9; color: #475569; }

/* ── Sub-navegación / Segmentación de Trámite ────────────────────────────── */
.reportes-subnav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 8px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.subnav-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}
.subnav-label i {
  width: 14px;
  height: 14px;
  color: var(--primary, #0d9488);
}
.subnav-pills-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.subnav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
.subnav-pill i {
  width: 14px;
  height: 14px;
}
.subnav-pill:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.subnav-pill.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}
.subnav-pill.active i {
  color: #38bdf8;
}

/* ── Responsividad ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .reportes-nav-tabs {
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }
  .reporte-tab-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  .reportes-filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .rpt-filter-item,
  .rpt-filter-search {
    width: 100%;
    min-width: 100%;
  }
  .rpt-filter-actions {
    justify-content: flex-end;
  }
  .reportes-charts-grid {
    grid-template-columns: 1fr;
  }
  .report-chart-canvas-box {
    height: 260px;
  }
  .reporte-kpi-value {
    font-size: 18px;
  }
}
