/* ============================================================
   ventas-local.css - Informe Ventas por Local
   Cards de locales + gráficos comparativos + detalle
   ============================================================ */

/* --- Layout principal --- */
.vl-root { max-width: 1400px; margin: 0 auto; }

/* --- Hero header --- */
.vl-hero {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
  background: var(--surface); border-radius: 12px; padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
}
.vl-hero__info { display: flex; align-items: center; gap: 1rem; }
.vl-hero__icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.25rem;
}
.vl-hero__title { font-size: 1.35rem; font-weight: 800; color: var(--text-primary); }
.vl-hero__sub { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.vl-hero__actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.vl-hero-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-primary); font-size: .8rem;
  cursor: pointer; transition: all .15s;
}
.vl-hero-btn:hover { background: var(--hover); transform: translateY(-1px); }
.vl-hero-btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.vl-hero-btn--primary:hover { opacity: .9; }
.vl-hero-select {
  padding: .5rem .75rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-primary); font-size: .8rem;
}
.vl-date-group { display: flex; align-items: center; gap: .5rem; }
.vl-date-input {
  padding: .4rem .6rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-primary); font-size: .78rem;
}

/* --- KPIs strip --- */
.vl-kpi-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem; margin-bottom: 1.5rem;
}
.vl-kpi {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface); border-radius: 10px; padding: .85rem 1rem;
  border: 1px solid var(--border); transition: transform .15s;
}
.vl-kpi:hover { transform: translateY(-2px); }
.vl-kpi-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.vl-kpi-icon--ok { background: #dcfce7; color: #16a34a; }
.vl-kpi-icon--warn { background: #fef9c3; color: #ca8a04; }
.vl-kpi-icon--accent { background: #dbeafe; color: #2563eb; }
.vl-kpi-icon--danger { background: #fee2e2; color: #dc2626; }
.vl-kpi-icon--purple { background: #ede9fe; color: #7c3aed; }
.vl-kpi-icon--sky { background: #e0f2fe; color: #0284c7; }
.vl-kpi-data { display: flex; flex-direction: column; min-width: 0; }
.vl-kpi-val { font-size: 1.15rem; font-weight: 800; color: var(--text-primary); white-space: nowrap; }
.vl-kpi-lbl { font-size: .7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Cards de locales --- */
.vl-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.vl-card {
  background: var(--surface); border-radius: 12px; padding: 1.25rem;
  border: 1px solid var(--border); transition: all .2s; cursor: pointer;
  position: relative; overflow: hidden;
}
.vl-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.vl-card--active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.vl-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.vl-card__name { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.vl-card__badge {
  font-size: .65rem; padding: 3px 8px; border-radius: 20px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.vl-card__badge--principal { background: #dbeafe; color: #2563eb; }
.vl-card__badge--local { background: #dcfce7; color: #16a34a; }
.vl-card__metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.vl-card__metric { }
.vl-card__metric-lbl { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.vl-card__metric-val { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.vl-card__bar {
  margin-top: .85rem; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.vl-card__bar-fill {
  height: 100%; border-radius: 3px; transition: width .5s ease;
}

/* --- Sección de gráficos --- */
.vl-section {
  background: var(--surface); border-radius: 12px; padding: 1.25rem;
  border: 1px solid var(--border); margin-bottom: 1.25rem;
}
.vl-section__title {
  font-size: .95rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem;
}
.vl-charts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.vl-chart-card {
  background: var(--surface); border-radius: 10px; padding: 1rem;
  border: 1px solid var(--border);
}
.vl-chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.vl-chart-title { font-size: .85rem; font-weight: 700; color: var(--text-primary); }
.vl-chart-wrap { height: 260px; position: relative; }

/* --- Tabla detalle --- */
.vl-detail { margin-top: 1.25rem; }
.vl-detail__tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.vl-detail__tab {
  padding: .5rem 1rem; border-radius: 8px 8px 0 0; font-size: .78rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border: none; background: none;
  transition: all .15s; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.vl-detail__tab:hover { color: var(--text-primary); background: var(--hover); }
.vl-detail__tab--active { color: var(--accent); border-bottom-color: var(--accent); }

.vl-tbl { width: 100%; border-collapse: collapse; font-size: .8rem; }
.vl-tbl th {
  text-align: left; padding: .6rem .75rem; background: var(--hover);
  color: var(--text-muted); font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .3px;
  border-bottom: 1px solid var(--border);
}
.vl-tbl td {
  padding: .6rem .75rem; border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.vl-tbl tr:hover td { background: var(--hover); }
.vl-tbl .text-right { text-align: right; }
.vl-tbl .font-bold { font-weight: 700; }

/* --- Ranking bar inline --- */
.vl-rank-bar {
  height: 8px; border-radius: 4px; background: var(--border); position: relative; overflow: hidden;
}
.vl-rank-fill { height: 100%; border-radius: 4px; }

/* --- Forma pago badges --- */
.vl-fp-badge {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem;
  padding: 3px 10px; border-radius: 6px; background: var(--hover);
  color: var(--text-primary); font-weight: 600;
}
.vl-fp-bar {
  width: 100%; height: 20px; border-radius: 10px; overflow: hidden;
  display: flex; margin-top: .5rem;
}
.vl-fp-segment { height: 100%; transition: width .5s ease; }

/* --- Skeleton loading --- */
.vl-sk-root { animation: vlPulse 1.5s infinite; }
.vl-sk-bar { height: 64px; background: var(--hover); border-radius: 12px; margin-bottom: 1rem; }
.vl-sk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.vl-sk-card { height: 80px; background: var(--hover); border-radius: 10px; }
.vl-sk-card--lg { height: 200px; }

@keyframes vlPulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* --- Responsive --- */
@media (max-width: 768px) {
  .vl-hero { flex-direction: column; align-items: flex-start; }
  .vl-cards { grid-template-columns: 1fr; }
  .vl-charts { grid-template-columns: 1fr; }
  .vl-kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .vl-card__metrics { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .vl-kpi-strip { grid-template-columns: 1fr; }
}
