/* === COMPONENTS — cards.md, buttons.md, inputs.md, badges.md, etc. === */

/* === KPI CARD === */
.kpi-card {
  background: var(--bg-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-base);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-base);
  animation: scaleIn 0.4s ease both;
}

.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }

.kpi-card:hover {
  border-color: var(--border-brand-light);
  background: var(--neutral-secondary-medium);
  box-shadow: var(--shadow-md);
}

.kpi-card .kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.kpi-card .kpi-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--body);
}

.kpi-card .kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.kpi-card .kpi-icon.brand { background: var(--brand-softer); color: var(--fg-brand); }
.kpi-card .kpi-icon.cyan { background: rgba(0, 229, 255, 0.1); color: var(--cyan); }
.kpi-card .kpi-icon.purple { background: rgba(191, 90, 242, 0.1); color: var(--purple); }
.kpi-card .kpi-icon.pink { background: rgba(255, 45, 120, 0.1); color: var(--pink); }

.kpi-card .kpi-value {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-2);
  line-height: 1.1;
}

.kpi-card .kpi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.kpi-card .kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 13px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kpi-card .kpi-trend.up {
  color: var(--fg-success);
  background: rgba(0, 204, 136, 0.1);
}

.kpi-card .kpi-trend.down {
  color: var(--fg-danger);
  background: rgba(255, 51, 102, 0.1);
}

.kpi-card .kpi-chart {
  height: 32px;
  width: 80px;
  flex-shrink: 0;
}

.kpi-card .kpi-chart svg {
  width: 100%;
  height: 100%;
}

.kpi-card .kpi-chart .sparkline {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-card .kpi-chart .sparkline.brand { stroke: var(--brand); }
.kpi-card .kpi-chart .sparkline.cyan { stroke: var(--cyan); }
.kpi-card .kpi-chart .sparkline.purple { stroke: var(--purple); }
.kpi-card .kpi-chart .sparkline.pink { stroke: var(--pink); }

.kpi-card .kpi-chart .sparkline-area {
  fill-opacity: 0.08;
}

.kpi-card .kpi-chart .sparkline-area.brand { fill: var(--brand); }
.kpi-card .kpi-chart .sparkline-area.cyan { fill: var(--cyan); }
.kpi-card .kpi-chart .sparkline-area.purple { fill: var(--purple); }
.kpi-card .kpi-chart .sparkline-area.pink { fill: var(--pink); }

/* === PROGRESS CARD === */
.progress-card {
  background: var(--bg-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-base);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-base);
  animation: scaleIn 0.4s ease both;
}

.progress-card:nth-child(1) { animation-delay: 0.25s; }
.progress-card:nth-child(2) { animation-delay: 0.3s; }
.progress-card:nth-child(3) { animation-delay: 0.35s; }

.progress-card:hover {
  border-color: var(--border-brand-light);
  box-shadow: var(--shadow-md);
}

.progress-card .progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.progress-card .progress-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.progress-card .progress-title-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.progress-card .progress-title-icon.brand {
  background: var(--brand-softer);
  color: var(--fg-brand);
}

.progress-card .progress-title-icon.cyan {
  background: rgba(0, 229, 255, 0.1);
  color: var(--cyan);
}

.progress-card .progress-title-icon.purple {
  background: rgba(191, 90, 242, 0.1);
  color: var(--purple);
}

.progress-card .progress-title-text h4 {
  font-size: 14px;
  font-weight: 500;
  color: var(--heading);
  margin-bottom: 2px;
}

.progress-card .progress-title-text span {
  font-size: 12px;
  color: var(--body-subtle);
}

.progress-card .progress-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--heading);
}

.progress-card .progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--neutral-secondary-medium);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.progress-card .progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s ease;
  animation: progressFill 1s ease both;
}

.progress-card .progress-bar-fill.brand {
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
}

.progress-card .progress-bar-fill.cyan {
  background: linear-gradient(90deg, var(--cyan), var(--teal));
}

.progress-card .progress-bar-fill.purple {
  background: linear-gradient(90deg, var(--purple), var(--indigo));
}

.progress-card .progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.progress-card .progress-stats .current {
  color: var(--heading);
  font-weight: 500;
}

.progress-card .progress-stats .target {
  color: var(--body-subtle);
}

/* === CHART CARD (Sales by Channel) === */
.chart-card {
  background: var(--bg-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-base);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-base);
  animation: fadeInUp 0.4s ease both;
  animation-delay: 0.4s;
}

.chart-card:hover {
  border-color: var(--border-brand-light);
  box-shadow: var(--shadow-md);
}

.chart-card .chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.chart-card .chart-header h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.3px;
}

.chart-card .chart-filter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px;
  background: var(--neutral-secondary-medium);
  border: 1px solid var(--border-default-medium);
  border-radius: var(--radius-default);
  color: var(--body);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.chart-card .chart-filter:hover {
  border-color: var(--border-default-strong);
  color: var(--heading);
}

.chart-card .chart-filter svg {
  width: 14px;
  height: 14px;
  color: var(--body-subtle);
}

/* Channel bars */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.channel-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.channel-item .channel-color {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.channel-item .channel-color.brand { background: var(--brand); }
.channel-item .channel-color.cyan { background: var(--cyan); }
.channel-item .channel-color.purple { background: var(--purple); }
.channel-item .channel-color.pink { background: var(--pink); }

.channel-item .channel-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--body);
  min-width: 70px;
}

.channel-item .channel-bar-track {
  flex: 1;
  height: 8px;
  background: var(--neutral-secondary-medium);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.channel-item .channel-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

.channel-item .channel-bar-fill.brand { background: var(--brand); }
.channel-item .channel-bar-fill.cyan { background: var(--cyan); }
.channel-item .channel-bar-fill.purple { background: var(--purple); }
.channel-item .channel-bar-fill.pink { background: var(--pink); }

.channel-item .channel-percent {
  font-size: 14px;
  font-weight: 600;
  color: var(--heading);
  min-width: 40px;
  text-align: right;
  font-family: var(--font-mono);
}

/* Big chart area */
.chart-visual {
  width: 100%;
  height: 200px;
  margin-bottom: var(--space-6);
}

.chart-visual svg {
  width: 100%;
  height: 100%;
}

/* === OVERVIEW CARD (right column) === */
.overview-card {
  background: var(--bg-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-base);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-base);
  animation: fadeInUp 0.4s ease both;
  animation-delay: 0.45s;
}

.overview-card:hover {
  border-color: var(--border-brand-light);
  box-shadow: var(--shadow-md);
}

.overview-card .overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.overview-card .overview-header h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--heading);
}

.overview-card .overview-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.overview-card .overview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-default);
}

.overview-card .overview-item:last-child {
  border-bottom: none;
}

.overview-item .item-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.overview-item .item-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.overview-item .item-dot.up { background: var(--fg-success); }
.overview-item .item-dot.down { background: var(--fg-danger); }
.overview-item .item-dot.neutral { background: var(--fg-warning); }

.overview-item .item-label {
  font-size: 14px;
  color: var(--body);
}

.overview-item .item-value {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
}

.overview-item .item-trend-text {
  font-size: 12px;
  font-weight: 500;
}

.overview-item .item-trend-text.up { color: var(--fg-success); }
.overview-item .item-trend-text.down { color: var(--fg-danger); }

/* === SIDEBAR OVERLAY (mobile) === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.sidebar-overlay.open {
  opacity: 1;
}
