/* ==========================================
   STATS — Dark Theme Contract
   Spójne z rentownosc / costs / obrot
   ========================================== */

/* === Validation Tiles — Wspólne style walidacji === */
@import './validation-tiles.css';

/* ===================================================
   PERIOD NAVIGATION — prev / label / next
   Używa .btn-nav z dashboard.css dla spójnego rozmiaru
   =================================================== */
.stats-period-nav {
  display: flex;
  align-items: center;
}

/* Icon-only nav buttons — nadpisz padding btn-nav */
.stats-nav-btn.btn-nav {
  padding-left: 10px;
  padding-right: 10px;
  justify-content: center;
}

.stats-nav-btn .ui-icon {
  width: 14px;
  height: 14px;
}

.stats-nav-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 120px;
  text-align: center;
  padding: 0 4px;
}

/* ===================================================
   KPI STRIP — 8 klikalnych kart w rzędzie
   =================================================== */
.stats-kpi-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1200px) {
  .stats-kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .stats-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===================================================
   KPI CARD — flat dark, bez gradientów
   =================================================== */
.stats-metric-card {
  background: rgba(30, 30, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.stats-metric-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(40, 40, 40, 0.98);
}

/* Stan aktywny */
.stats-metric-card.active {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.08);
}

.stats-metric-card.active .metric-label {
  color: #60a5fa;
}

/* Treść karty KPI */
.metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
}

.metric-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.metric-icon-right {
  display: inline-flex;
  align-items: flex-end;
  color: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.metric-icon-right .ui-icon {
  width: 32px !important;
  height: 32px !important;
}

.metric-delta {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 3px;
}

.metric-delta--pos { color: #34d399; }
.metric-delta--neg { color: #f87171; }
.metric-delta--neu { color: var(--text-secondary); }

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================================================
   HERO METRIC — aktywny KPI na dużo
   =================================================== */
.stats-hero-section {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: rgba(30, 30, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  margin-bottom: 20px;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  min-height: 92px;
}

.stats-hero-left { flex: 1; min-width: 0; }

.stats-hero-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #60a5fa;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stats-hero-value {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-top: 4px;
  line-height: 1.15;
}

.stats-hero-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.stats-hero-right {
  text-align: right;
  flex-shrink: 0;
}

.stats-hero-delta-value {
  font-size: 1rem;
  font-weight: 600;
}

.stats-hero-delta-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===================================================
   CHART SECTION — persystentny wykres
   =================================================== */
.stats-chart-section {
  background: rgba(30, 30, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.stats-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stats-chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.stats-chart-body {
  position: relative;
  height: 260px;
}

.stats-chart-body canvas {
  height: 260px !important;
}

/* ===================================================
   EMPTY STATE
   =================================================== */
.stats-hero-empty {
  background: rgba(30, 30, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 64px 32px;
  text-align: center;
  margin-bottom: 20px;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

.stats-hero-empty .empty-message {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===================================================
   PERIOD TABS — aktywny tab wewnątrz statsPeriodTabs
   =================================================== */
#statsPeriodTabs .period-item.active-period {
  background: rgba(59, 130, 246, 0.10);
  border-color: rgba(59, 130, 246, 0.40);
  color: #60a5fa;
}

/* icon size override for btn-nav with icon */
.stats-period-nav .btn-nav .ui-icon {
  width: 14px;
  height: 14px;
}

/* Legacy — zachowane dla kompatybilności */
.stats-hero-header {
  max-width: 1600px;
  margin: 0 auto 16px;
}
