/* =====================
   DataCoches Dashboard – CSS (tema claro)
   ===================== */

/* Reset mínimo */
.dc-wrap * { box-sizing: border-box; }

/* Paleta / contenedor base */
.dc-wrap {
  --dc-bg: #ffffff;
  --dc-card: #ffffff;
  --dc-text: #1a1a1a;
  --dc-dim: #6b7280;
  --dc-accent: #2563eb;
  --dc-border: #e5e7eb;

  background: var(--dc-bg);
  color: var(--dc-text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* centrado y ancho */
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 16px;
}

/* Padding mayor en pantallas grandes */
@media (min-width: 640px) {
  .dc-wrap {
    padding: 20px 24px;
  }
}

@media (min-width: 1024px) {
  .dc-wrap {
    padding: 24px 32px;
  }
}

/* Header */
.dc-header { margin-bottom: 16px; }
.dc-title { margin: 0 0 6px; font-size: 1.4rem; font-weight: 700; color: #111827; }
.dc-subtitle { margin: 0; color: var(--dc-dim); font-size: .95rem; }

/* =====================
   GRID RESPONSIVE
   ===================== */
/* GRID: 8 columnas por defecto, 1 columna si ancho < 720px */
.dc-grid{
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(8, 1fr);  /* desktop */
}

/* móvil / ventanas estrechas */
@media (max-width: 819px){
  .dc-grid{ grid-template-columns: 1fr; }
}

/* evita desbordes de hijos dentro del grid */
.dc-card{ min-width: 0; }
.dc-chart-wrap{ min-width: 0; }
.dc-chart{ width: 100% !important; height: 100% !important; }

/* =====================
   Tarjetas
   ===================== */
.dc-card {
  background: var(--dc-card);
  border: 1px solid var(--dc-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.dc-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.dc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.dc-card-title{
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px 0;
}

/* Descripción al pie de la tarjeta (tablas/gráficos) */
.dc-card-desc{
  font-size: 0.82rem;
  color: #6b7280;
  margin-top: 10px;
  margin-bottom: 0;
  line-height: 1.4;
}


.dc-card.chart .dc-chart-wrap {
  position: relative;
  height: 280px; /* ajusta si quieres más alto */
}

.dc-card.chart canvas {
  width: 100% !important;
  height: 100% !important;
}


/* =====================
   KPI
   ===================== */
.kpi { display: flex; flex-direction: column; gap: 6px; min-height: 90px; }
.dc-kpi-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}
.dc-kpi-value { font-size: 1.4rem; font-weight: 700; color: #111827; }
.dc-kpi-desc { font-size: .75rem; color: var(--dc-dim); }
.dc-empty .dc-kpi-value, .dc-empty .dc-kpi-desc { opacity: .5; }

/* =====================
   Tabla
   ===================== */
/* === Tabla: cabecera sticky + formato uniforme === */
.dc-wrap .dc-table-wrap {
  max-height: 380px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  background: #fff;
}

/* === Estructura general de la tabla === */
.dc-wrap .dc-table {
  width: 100%;
  min-height: 290px;
  border-collapse: separate;   /* necesario para sticky */
  border-spacing: 0;
  font-size: .8rem;
  font-variant-numeric: tabular-nums; /* cifras alineadas */
}

/* === Cabecera fija (todas las columnas, incluida la primera) === */
.dc-wrap .dc-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;                /* más alto para que quede por encima del cuerpo */
  background: #f3f4f6;        /* fondo sólido */
  color: #374151;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

/* === Celdas del cuerpo === */
.dc-wrap .dc-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}

/* === Rayado y hover === */
.dc-wrap .dc-table tbody tr:nth-child(odd) td { 
  background: #fafafa; 
}
.dc-wrap .dc-table tbody tr:hover td { 
  background: #f6faff; 
}

/* === Separadores verticales iguales para todas las columnas === */
.dc-wrap .dc-table td, 
.dc-wrap .dc-table th { 
  border-right: 1px solid #f1f5f9; 
}
.dc-wrap .dc-table td:last-child, 
.dc-wrap .dc-table th:last-child { 
  border-right: 0; 
}

/* === Alineación numérica === */
.dc-wrap .dc-table .num { 
  text-align: right; 
  white-space: nowrap; 
}

/* === Columna “modelo” sin sticky en el cuerpo === */
/* Importante: no tocar el th, solo los td */
.dc-wrap .dc-table tbody td.col-modelo {
  position: static;          /* no pegada */
  left: auto;
  z-index: auto;
  border-right: 1px solid #f1f5f9;
  /* no definimos background para mantener el rayado */
}


/* =====================
   Charts
   ===================== */
.dc-chart-wrap { width: 100%; height: 210px; }
.dc-chart { width: 100% !important; height: 100% !important; }
@media (max-width: 768px){ .dc-chart-wrap{ height: 160px; } }

/* =====================
   Posiciones por JS (solo desktop ancho)
   ===================== */
@media (min-width: 1280px){
  .dc-card[data-position] { /* JS aplica grid-column / grid-row */ }
}



/* ====== BLOQUEO / PREVIEW ====== */
.dc-locked{
  position: relative;
}
.dc-locked-content{
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}
.dc-locked-overlay{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  background: rgba(255,255,255,0.55);
  border-radius: 12px;
  backdrop-filter: blur(2px);
}

.dc-locked-badge{
  display: inline-block;
  padding: 6px 10px;
  font-size: .8rem;
  font-weight: 700;
  color: #1f2937;
  background: #e5e7eb;
  border-radius: 999px;
}

.dc-locked-actions{
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.dc-btn{
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  text-decoration: none;
  font-weight: 600;
}
.dc-btn:hover{ background:#f9fafb; }
.dc-btn-primary{
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.dc-btn-primary:hover{ background:#1e4fd1; }


/* Solo el valor del KPI con blur */
.dc-blur-value{
  display: inline-block;
  filter: blur(6px);
}

/* Blur solo en el área del gráfico (no título/desc) */
.dc-chart-wrap.is-locked{
  position: relative;
}
.dc-chart-wrap.is-locked::after{
  content: "";
  position: absolute;
  inset: 0;
  backdrop-filter: blur(4px);
  background: rgba(255,255,255,0.35);
  border-radius: 8px;
  pointer-events: none; /* que no bloquee scroll de la tarjeta */
}


.dc-filters select {
  width: 100%;
  min-height: 42px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
}

.dc-filter-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 4px;
}

@media (max-width: 1024px){
  .dc-filters-grid{
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
}
@media (max-width: 640px){
  .dc-filters-grid{
    grid-template-columns: 1fr !important;
  }
}



.dc-filters-bar{
  margin-bottom:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.dc-filters-grid{
  display:grid;
  gap:12px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}

.dc-filters-actions{
  margin-top:8px;
  display:flex;
  justify-content:flex-end;
}

.dc-btn.dc-btn-primary{
  padding:8px 16px;
  border-radius:999px;
  border:none;
  cursor:pointer;
  font-weight:600;
  background:#2563eb;
  color:#fff;
}

/* Multi filtro */
.dc-multi-filter{
  position:relative;
}

.dc-multi-trigger{
  width:100%;
  text-align:left;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid #d1d5db;
  background:#f9fafb;
  font-size:0.85rem;
  cursor:pointer;
}

.dc-multi-trigger:hover{
  background:#eef2ff;
}

.dc-multi-dropdown{
  position:absolute;
  z-index:20;
  top:110%;
  left:0;
  right:0;
  max-height:260px;
  background:#fff;
  border-radius:10px;
  border:1px solid #e5e7eb;
  box-shadow:0 10px 30px rgba(15,23,42,0.12);
  padding:8px;
  display:none;
  overflow:auto;
}

.dc-multi-dropdown.open{
  display:block;
}

.dc-multi-option{
  display:flex;
  align-items:center;
  gap:6px;
  padding:4px 2px;
  font-size:0.8rem;
}

.dc-multi-option input[type="checkbox"]{
  accent-color:#2563eb;
}

/* Responsive filtros */
@media (max-width:1024px){
  .dc-filters-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (max-width:640px){
  .dc-filters-grid{
    grid-template-columns:1fr;
  }
}


.dc-multi-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:4px 4px 6px;
  border-bottom:1px solid #e5e7eb;
  margin-bottom:4px;
}

.dc-multi-header-label{
  font-size:0.8rem;
  font-weight:600;
  color:#4b5563;
}

.dc-multi-clear{
  border:none;
  background:transparent;
  font-size:0.75rem;
  color:#2563eb;
  cursor:pointer;
  padding:2px 4px;
}

.dc-multi-clear:hover{
  text-decoration:underline;
}



/* ====== Mes de reporte (filtro especial) ====== */
.dc-month-compact {
  background-color: #F1F1F1;
  padding: 10px 14px;
  margin-bottom: 12px;

  /* mitad del ancho del contenedor de filtros */
  max-width: 25%;
  min-width: 300px;  /* evita que se aplaste demasiado en desktop */
}

.dc-month-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dc-month-label {
  font-size: 14px;
  color: #111;
  white-space: nowrap;
}

.dc-month-select {
  min-width: 140px;
  padding: 0px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.15);
  background: #fff;
  font-size: 14px;
  max-height: 35px;
  text-align: center;          /* centra el texto */
  text-align-last: center;     /* clave para Chrome / Edge */
  color: #333
}

.dc-month-select option {
  text-align: center;
}

/* Responsive: en móvil ocupa todo el ancho */
@media (max-width: 900px) {
  .dc-month-compact {
    max-width: 100%;
  }
}



.dc-multi-search{
  padding: 10px 10px 6px 10px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}

.dc-multi-search-input{
  width: 100%;
  height: 30px !important;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  font-size: 14px !important;
  color: #333;
}
.dc-multi-search-input:focus{
  outline: none;
  border-color: rgba(0,0,0,0.25);
}


.dc-filters-actions{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.dc-clear-btn{
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.15);
  background: #F1F1F1;
  color: #333;
  font-weight: 600;
  cursor: pointer;
}

.dc-clear-btn:hover{
  background: #e9e9e9;
}


.dc-btn.dc-btn-secondary{
  background: #F1F1F1;
  color: #333;
  border: 1px solid rgba(0,0,0,0.15);
}

.dc-btn.dc-btn-secondary:hover{
  background: #e9e9e9;
}


.dc-filters-actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}


/* ===== Tabla últimas ventas ===== */
.dc-table-wrap{
  max-height: 360px;         /* ~8–10 filas (ajusta si quieres) */
  overflow-y: auto;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: #fff;
}

.dc-table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.dc-table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  white-space: nowrap;
}

.dc-table tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  white-space: nowrap;
}

.dc-table tbody tr:hover td{
  background: rgba(0,0,0,0.02);
}

.dc-table-muted{
  color: rgba(0,0,0,0.55);
  padding: 14px 12px;
}

/* ==========================
   Tabla PROVINCIAS (sin scroll horizontal)
   ========================== */

/* Asegura que el wrapper NO permita scroll horizontal */
.dc-table-wrap.dc-province-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 300px; /* ajusta a tu gusto (8-10 filas aprox) */
}

/* Tabla ocupa el ancho disponible y no crece por contenido */
.dc-table.dc-table-by-province {
  width: 100%;
  max-width: 100%;
  table-layout: fixed; /* clave para que 50/25/25 se respete */
}

/* Filas compactas */
.dc-table.dc-table-by-province th,
.dc-table.dc-table-by-province td {
  padding: 6px 10px;
  line-height: 1.2;
  font-size: 13px;

  /* evita que el contenido fuerce ancho */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

/* Anchos de columnas */
.dc-table.dc-table-by-province th:nth-child(1),
.dc-table.dc-table-by-province td:nth-child(1) {
  width: 40%;
  text-align: left;
}

.dc-table.dc-table-by-province th:nth-child(2),
.dc-table.dc-table-by-province td:nth-child(2),
.dc-table.dc-table-by-province th:nth-child(3),
.dc-table.dc-table-by-province td:nth-child(3) {
  width: 30%;
  text-align: right;
}

/* Ellipsis solo en Provincia (por si quieres permitir que números no se recorten) */
.dc-table.dc-table-by-province td:nth-child(1) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Evita que alguna celda provoque overflow raro en tablas fixed */
.dc-table.dc-table-by-province td {
  min-width: 0;
}

/* KPI bloqueado (demo) */
.dc-kpi-value.dc-demo-blur{
  display: inline-block;
  filter: blur(5px);
  user-select: none;
}


.dc-demo-blur{
  filter: blur(4px);
  user-select: none;
}



.dc-demo-notice{
  margin-top: 6px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.15);
  font-size: 14px;
  color: #1f2937;
}

.dc-demo-notice p{
  margin: 0;
  line-height: 1.45;
}

.dc-demo-cta{
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  margin-left: 4px;
}

.dc-demo-cta:hover{
  text-decoration: underline;
}


/* Títulos de bloques del tasador */
.dc-tasador-layout .dc-card > h3 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 14px 0;
  line-height: 1.2;
  color: inherit;
}

/* Subtítulos internos (Ventas / Stock) */
.dc-tasador-layout .dc-card h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px 0;
  line-height: 1.3;
  color: inherit;
}
