:host { display: block; }

.inv-reports-page {
  max-width: 1400px;
  margin: 0 auto;

  .text-end { text-align: end; }
  .text-center { text-align: center; }
  .mono { font-family: monospace; font-size: 0.8rem; }
  .fw-bold { font-weight: 700; }
  .text-success { color: #10b981 !important; font-weight: 700; }
  .text-danger { color: #ef4444 !important; font-weight: 700; }
}

// ─── Page Header ───
.page-header-bar {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 1rem;

  .header-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    i { font-size: 1.25rem; color: white; }
  }

  h1 { margin: 0; font-size: 1.4rem; font-weight: 800; color: #1e293b; }
  p { margin: 0.15rem 0 0; font-size: 0.82rem; color: #94a3b8; }
}

// ─── Filter Bar ───
.filter-bar {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: 1rem;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  flex-wrap: wrap;

  .filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;

    label {
      font-weight: 700;
      font-size: 0.75rem;
      color: #64748b;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
  }
}

// ─── Stats Grid (reuse from stock-card) ───
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: white;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.3s;
  &:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.08); }
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  i { font-size: 1.25rem; color: white; }
}

.stat-info {
  display: flex;
  flex-direction: column;
  .stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: #1e293b; }
  .stat-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; margin-top: 0.2rem; }
}

.stat-decoration {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  top: -40px;
  right: -40px;
  opacity: 0.06;
}

@each $n, $c1, $c2 in (blue, #3b82f6, #2563eb), (green, #10b981, #059669), (amber, #f59e0b, #d97706), (rose, #f43f5e, #e11d48), (purple, #8b5cf6, #7c3aed) {
  .stat-#{$n} {
    border-top: 3px solid $c1;
    .stat-icon-wrap { background: linear-gradient(135deg, $c1, $c2); box-shadow: 0 4px 12px rgba($c1, 0.3); }
    .stat-decoration { background: $c1; }
  }
}

// ─── Charts (reuse from stock-card) ───
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-card {
  background: white;
  border-radius: 1rem;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  overflow: hidden;
}

.chart-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.chart-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  h3 { margin: 0; font-size: 0.95rem; font-weight: 700; color: #1e293b; }
}

.chart-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  i { font-size: 1.1rem; }
}

.chart-body {
  padding: 1rem 1.5rem 1.5rem;
  &.doughnut-chart {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.no-chart-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #94a3b8;
  font-size: 0.9rem;
}

// ─── Section Card (reuse from stock-card) ───
.section-card {
  background: white;
  border-radius: 1rem;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  flex-wrap: wrap;
  gap: 0.75rem;
  h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    i { color: #6366f1; }
  }
}

// ─── Warehouse Cards Grid ───
.warehouse-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.warehouse-card {
  background: white;
  border-radius: 1rem;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  padding: 1.25rem;
  transition: all 0.3s;
  border-top: 3px solid #6366f1;

  &:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.08); }

  .wh-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;

    .wh-icon {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      background: linear-gradient(135deg, #6366f1, #4f46e5);
      display: flex;
      align-items: center;
      justify-content: center;
      i { font-size: 1.1rem; color: white; }
    }

    h4 { margin: 0; font-size: 1rem; font-weight: 700; color: #1e293b; }
    .wh-code { font-size: 0.75rem; font-family: monospace; color: #94a3b8; }
  }

  .wh-stats {
    display: flex;
    gap: 1rem;

    .wh-stat {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.15rem;
      padding: 0.5rem;
      background: #f8fafc;
      border-radius: 8px;

      .wh-stat-value { font-size: 1.1rem; font-weight: 800; color: #1e293b; }
      .wh-stat-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; text-align: center; }
    }
  }
}

// ─── Valuation Group Header ───
.product-group-header {
  .product-code-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    background: rgba(99,102,241,0.1);
    color: #6366f1;
    margin-inline-end: 0.5rem;
  }

  .group-totals {
    display: flex;
    gap: 1.25rem;

    .group-total-item {
      font-size: 0.82rem;
      color: #64748b;
      strong { font-family: monospace; color: #1e293b; font-size: 0.9rem; }
    }
  }
}

// ─── Empty States ───
.empty-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 1rem;
  border: 1px solid rgba(0,0,0,0.05);
  gap: 1rem;

  i { font-size: 3rem; color: #cbd5e1; }
  p { font-size: 0.9rem; color: #94a3b8; margin: 0; }
}

.empty-state-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  gap: 0.75rem;

  i { font-size: 2.5rem; color: #10b981; }
  p { font-size: 0.875rem; color: #64748b; margin: 0; }
}

// ─── Responsive ───
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .warehouse-cards-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
}

// ─── Dark Mode ───
body.dark-mode {
  .header-content {
    h1 { color: var(--color-text-primary); }
    p { color: #64748b; }
  }

  .filter-bar {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.06);
    .filter-field label { color: #94a3b8; }
  }

  .stat-card {
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.06);
  }
  .stat-info {
    .stat-value { color: var(--color-text-primary); }
    .stat-label { color: #94a3b8; }
  }

  .chart-card, .section-card {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.06);
  }
  .chart-header { border-bottom-color: rgba(255, 255, 255, 0.06); }
  .chart-title-wrap h3 { color: var(--color-text-primary); }
  .no-chart-data { color: #64748b; }

  .section-header {
    border-bottom-color: rgba(255, 255, 255, 0.06);
    h3 { color: var(--color-text-primary); }
  }

  .warehouse-card {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.06);
    .wh-header {
      h4 { color: var(--color-text-primary); }
      .wh-code { color: #64748b; }
    }
    .wh-stats .wh-stat {
      background: rgba(8, 12, 26, 0.8);
      .wh-stat-value { color: var(--color-text-primary); }
      .wh-stat-label { color: #94a3b8; }
    }
  }

  .product-group-header {
    .group-totals .group-total-item {
      color: #94a3b8;
      strong { color: var(--color-text-primary); }
    }
  }

  .empty-prompt {
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.06);
    i { color: #64748b; }
    p { color: #94a3b8; }
  }

  .empty-state-inline {
    p { color: #94a3b8; }
  }
}
