@charset "UTF-8";

/* FC Vision Font Families for NIDA Treemap Faculty Titles */
@font-face {
  font-family: 'FC Vision';
  src: url('../fonts/FCVision-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'FC Vision';
  src: url('../fonts/FCVision-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'FC Vision';
  src: url('../fonts/FCVision-Bold.woff2') format('woff2');
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}



/* Design Tokens - Inherits typography from Elementor / WordPress theme */
:root {
  --font-main: inherit;
  --font-sub: inherit;
  --color-primary: #6C38CC;
  --color-primary-light: #8B5CF6;
  --color-text-main: #1E293B;
  --color-text-muted: #64748B;
  --color-border: #E2E8F0;
  --color-card-bg: #FFFFFF;
  --color-page-bg: transparent;
  --radius-card: 0px; /* Flat border (no curve) to inherit site container structure */
  --radius-tile: 12px;
  --shadow-card: none;
  --shadow-hover: 0 14px 28px rgba(0, 0, 0, 0.12), 0 8px 12px rgba(0, 0, 0, 0.08);
}

/* Scoped layout rules - fully adapts to Elementor container width */
.nida-svc-dashboard-wrapper,
.dashboard-container {
  font-family: inherit;
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-sizing: border-box;
}

.nida-svc-dashboard-wrapper *,
.dashboard-container * {
  box-sizing: border-box;
}

/* Header & Control Bar */
.control-bar {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.control-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-logo-badge {
  background: linear-gradient(135deg, #6C38CC, #2563EB);
  color: white;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.control-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-main);
}

.control-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Segmented Toggle */
.source-toggle {
  display: flex;
  background: #F1F5F9;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.source-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 7px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.source-btn.active {
  background: #ffffff;
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.api-settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  background: white;
  padding: 7px 14px;
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-main);
  transition: all 0.2s ease;
}

.api-settings-btn:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

/* API Settings Modal / Dropdown panel */
.api-panel {
  display: none;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 20px;
  margin-top: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.06);
  animation: fadeInDown 0.3s ease;
}

.api-panel.show {
  display: block;
}

.api-panel-header {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.api-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: flex-end;
}

@media (max-width: 768px) {
  .api-panel-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.form-group input {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--color-primary);
}

.btn-fetch {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  height: 38px;
}

.btn-fetch:hover {
  opacity: 0.9;
}

/* Status Alert */
.status-toast {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.status-toast.success {
  background: #ECFDF5;
  color: #065F46;
}

.status-toast.warning {
  background: #FFFBEB;
  color: #92400E;
}

.status-toast.error {
  background: #FEF2F2;
  color: #991B1B;
}

/* Main Cards */
.chart-card {
  background: var(--color-card-bg);
  border-width: var(--sec-border-width, 1px);
  border-style: solid;
  border-color: var(--sec-border-color, var(--color-border));
  border-radius: var(--sec-border-radius, 0px);
  box-shadow: var(--sec-box-shadow, none);
  padding: 32px 36px;
  position: relative;
  transition: box-shadow 0.3s ease, border-color 0.2s ease, border-radius 0.2s ease;
  animation: cardFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.chart-card:nth-child(2) {
  animation-delay: 0.15s;
}

.chart-card-header {
  margin-bottom: 24px;
}

.chart-title {
  font-size: 28px;
  font-weight: 500;
  color: #1E293B;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.chart-subtitle {
  font-size: 15px;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* Card 2 Header & New KPI Metrics Bar (Matching Mockup) */
.treemap-card-header {
  margin-bottom: 20px;
}

.treemap-metrics-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding: 0 2px;
}

.treemap-kpi-group {
  display: flex;
  align-items: center;
  gap: 32px;
}

.kpi-metric-item {
  display: flex;
  flex-direction: column;
}

.kpi-metric-label {
  font-size: 13px;
  color: #64748B;
  margin-bottom: 5px;
  font-weight: 400;
  line-height: 1.3;
}

.kpi-metric-val {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kpi-num {
  font-size: 30px;
  font-weight: 500;
  color: #1E293B;
  line-height: 1;
  letter-spacing: -0.4px;
}

.kpi-unit {
  font-size: 15px;
  font-weight: 400;
  color: #1E293B;
}

.kpi-metric-divider {
  width: 1px;
  height: 44px;
  background-color: #E2E8F0;
}

/* Year Control on the Right (Pill Selector) */
.treemap-year-control {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.year-control-label {
  font-size: 13px;
  color: #64748B;
  font-weight: 400;
  cursor: pointer;
  line-height: 1.3;
}

.year-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 175px;
}

.year-select-pill {
  width: 100%;
  height: 42px;
  background-color: #FFFFFF;
  background-image: none !important;
  border: 1px solid #CBD5E1;
  border-radius: 9999px;
  padding: 0 38px 0 22px;
  font-size: 15px;
  font-weight: 500;
  color: #1E293B;
  cursor: pointer;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.year-select-pill:hover {
  border-color: #94A3B8;
}

.year-select-pill:focus {
  outline: none;
  border-color: #6C38CC;
  box-shadow: 0 0 0 3px rgba(108, 56, 204, 0.12);
}

.year-select-arrow {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* Ensure no pseudo-element arrow conflicts with the SVG arrow */
.year-dropdown-wrap::after {
  display: none !important;
  content: none !important;
}

/* Legacy filter row fallback if needed */
.filter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  margin-bottom: 24px;
}

.year-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: none !important;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 20px;
  padding: 8px 36px 8px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.year-select:hover {
  border-color: #94A3B8;
  background-color: #F8FAFC;
}

.year-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108, 56, 204, 0.15);
}

/* Custom Highlight Badge on Line Chart */
.line-highlight-badge {
  position: absolute;
  top: 70px;
  right: 180px;
  background: #ffffff;
  border: 1.5px solid #3B82F6;
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.15);
  pointer-events: none;
  animation: badgePop 0.5s ease-out;
  z-index: 5;
}

.line-highlight-badge .badge-year {
  font-size: 11px;
  color: #2563EB;
  font-weight: 500;
}

.line-highlight-badge .badge-val {
  font-size: 15px;
  font-weight: 700;
  color: #1D4ED8;
}

/* Line Chart Container */
.line-chart-wrapper {
  position: relative;
  width: 100%;
  min-height: 350px;
  overflow: visible; /* Prevents tooltip or highlight badge from being clipped */
  border-radius: var(--sec-border-radius, 0px);
}

#line-chart {
  position: relative;
  z-index: 2;
  overflow: visible;
}

/* Tooltip container styling to avoid edge clipping */
.apexcharts-tooltip {
  overflow: visible !important;
  white-space: nowrap !important;
  pointer-events: none !important;
  z-index: 9999 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.apexcharts-tooltip.apexcharts-theme-light {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Ambient Animated Background Graph (Subtle Looping Gray Graphs) */
.chart-bg-animation {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  border-radius: var(--sec-border-radius, 0px);
}

/* Subtle Tech Dot Grid */
.chart-bg-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle, rgba(148, 163, 184, 0.22) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.6;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 100%);
}

/* Seamless Looping Flowing Graph Tracks */
.chart-bg-track {
  position: absolute;
  top: 20px;
  bottom: 30px;
  left: 0;
  width: 200%;
  height: calc(100% - 50px);
  will-change: transform;
}

.track-slow {
  animation: graphLoopScroll 28s linear infinite;
  opacity: 0.95;
}

.track-fast {
  animation: graphLoopScroll 18s linear infinite;
  opacity: 0.85;
}

.chart-bg-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Wave Lines */
.bg-wave-line {
  fill: none;
}

.bg-wave-line.wave-solid {
  stroke: #94A3B8;
  stroke-width: 1.5;
  stroke-opacity: 0.26;
}

.bg-wave-line.wave-dashed {
  stroke: #64748B;
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
  stroke-opacity: 0.24;
}

/* Floating Wave Nodes */
.bg-wave-node {
  fill: #94A3B8;
  fill-opacity: 0.35;
  stroke: #CBD5E1;
  stroke-width: 1.5;
  stroke-opacity: 0.55;
  transform-origin: center;
  transform-box: fill-box;
  animation: bgNodePulse 3s ease-in-out infinite alternate;
}

@keyframes bgNodePulse {
  0% {
    transform: scale(0.85);
    fill-opacity: 0.2;
  }
  100% {
    transform: scale(1.25);
    fill-opacity: 0.65;
  }
}

/* Seamless Horizontal Scrolling Keyframes */
@keyframes graphLoopScroll {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

/* Subtle Tech Light Shimmer Sweep */
.chart-bg-shimmer {
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(148, 163, 184, 0.08) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-20deg);
  animation: bgShimmerSweep 10s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bgShimmerSweep {
  0% {
    left: -40%;
  }
  35%, 100% {
    left: 140%;
  }
}

/* Point Markers & Pulse Animation on Line Chart */
.apexcharts-marker {
  transition: r 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), stroke-width 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}

.apexcharts-marker:hover {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.pulse-point-marker {
  animation: markerHaloPulse 2.2s infinite ease-in-out;
  transform-origin: center;
  transform-box: fill-box;
}

@keyframes markerHaloPulse {
  0% {
    filter: drop-shadow(0 0 2px rgba(108, 56, 204, 0.6));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(108, 56, 204, 0.45));
    transform: scale(1.22);
  }
  100% {
    filter: drop-shadow(0 0 2px rgba(108, 56, 204, 0.6));
    transform: scale(1);
  }
}

/* Treemap Chart Container */
.treemap-outer {
  position: relative;
  width: 100%;
  margin-bottom: 24px;
}

.treemap-grid-container {
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 100%;
  height: 470px;
  border-radius: var(--radius-tile);
  overflow: visible; /* Allows smooth floating hover without edge clipping */
  padding: 4px;
  box-sizing: border-box;
}

.treemap-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-width: 0;
}

.treemap-subrow {
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 100%;
  min-height: 0;
}

.treemap-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--color-text-muted);
  font-size: 16px;
}

/* Treemap Tile with Smooth Floating Hover */
.treemap-tile {
  position: relative;
  box-sizing: border-box;
  color: #ffffff;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  border-radius: var(--radius-tile);
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.2, 0.9, 0.2, 1),
              filter 0.25s ease,
              flex 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
  animation: tileStaggerIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--tile-index, 0) * 0.032s);
  user-select: none;
}

/* Subtle, smooth edge-free hover (No harsh clipping) */
.treemap-tile:hover {
  transform: translateY(-4px);
  z-index: 20;
  box-shadow: 0 16px 30px -4px rgba(0, 0, 0, 0.28), 0 6px 12px -2px rgba(0, 0, 0, 0.12);
  filter: brightness(1.06);
}

/* Light/White Tile Support (e.g. คณะนิติศาสตร์ #FFFFFF) */
.treemap-tile.tile-light {
  color: #1E293B;
  border: 1.5px solid #CBD5E1;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.treemap-tile.tile-light .tile-title {
  color: #0F172A;
  text-shadow: none;
}

.treemap-tile.tile-light .tile-value,
.treemap-tile.tile-light .tile-percent {
  color: #334155;
}

.treemap-tile.tile-light:hover {
  filter: none;
  border-color: #94A3B8;
}

.tile-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  pointer-events: none;
}

.tile-title {
  font-family: 'FC Vision', sans-serif !important;
  font-weight: 500;
  line-height: 1.25;
  word-break: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: font-size 0.3s ease;
}

.tile-value-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 3px;
}

.tile-value {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.96;
}

.tile-percent {
  font-size: 11px;
  opacity: 0.85;
  font-weight: 400;
}

/* Typography Hierarchy by Rank (Top ranking faculties are prominent & larger) */
.treemap-tile.tile-rank-1 {
  padding: 18px 20px;
}
.treemap-tile.tile-rank-1 .tile-title {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.3px;
}
.treemap-tile.tile-rank-1 .tile-value {
  font-size: 15px;
  font-weight: 500;
}
.treemap-tile.tile-rank-1 .tile-percent {
  font-size: 13px;
}

.treemap-tile.tile-rank-2 {
  padding: 16px 18px;
}
.treemap-tile.tile-rank-2 .tile-title {
  font-size: 18px;
  font-weight: 500;
}
.treemap-tile.tile-rank-2 .tile-value {
  font-size: 14.5px;
  font-weight: 500;
}
.treemap-tile.tile-rank-2 .tile-percent {
  font-size: 12px;
}

.treemap-tile.tile-rank-mid {
  padding: 13px 15px;
}
.treemap-tile.tile-rank-mid .tile-title {
  font-size: 15.5px;
  font-weight: 500;
}
.treemap-tile.tile-rank-mid .tile-value {
  font-size: 13.5px;
}
.treemap-tile.tile-rank-mid .tile-percent {
  font-size: 11.5px;
}

.treemap-tile.tile-rank-sm {
  padding: 10px 14px;
  min-height: 60px;
}
.treemap-tile.tile-rank-sm .tile-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.25;
}
.treemap-tile.tile-rank-sm .tile-value-wrap {
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
  margin-top: 2px;
}
.treemap-tile.tile-rank-sm .tile-value {
  font-size: 12px;
}
.treemap-tile.tile-rank-sm .tile-percent {
  font-size: 10.5px;
}

.treemap-tile.tile-rank-mini {
  padding: 8px 12px;
  min-height: 56px;
}
.treemap-tile.tile-rank-mini .tile-title {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.25;
}
.treemap-tile.tile-rank-mini .tile-value-wrap {
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
  margin-top: 2px;
}
.treemap-tile.tile-rank-mini .tile-value {
  font-size: 11.5px;
}
.treemap-tile.tile-rank-mini .tile-percent {
  font-size: 10.5px;
}

@keyframes tileStaggerIn {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chart-title-update {
  animation: titlePulse 0.35s ease;
}

@keyframes titlePulse {
  0% {
    opacity: 0.4;
    transform: translateY(-3px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bottom Legend */
.legend-container {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  padding-top: 14px;
  border-top: 1px solid #F1F5F9;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  user-select: none;
}

.legend-item:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.legend-dot.dot-light {
  border: 1.5px solid #94A3B8;
  box-sizing: border-box;
}

/* Tooltip */
.treemap-tooltip {
  position: fixed;
  display: none;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 180px;
  animation: tipFade 0.15s ease-out;
}

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tooltip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tooltip-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #CBD5E1;
}

.tooltip-row strong {
  color: #FFFFFF;
}

/* Summary stats badge row */
.stats-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: #F8FAFC;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 18px;
}

.stat-box-title {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.stat-box-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2px;
}

/* Animations */
@keyframes cardFadeUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tileEntrance {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes badgePop {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInDown {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tipFade {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive */
@media (max-width: 900px) {
  .chart-card {
    padding: 24px 20px;
  }
  .chart-title {
    font-size: 22px;
    font-weight: 500;
  }
  .line-highlight-badge {
    right: 20px;
    top: 55px;
  }
}

@media (max-width: 768px) {
  .chart-card {
    padding: 20px 16px;
  }
  .chart-title {
    font-size: 20px;
    font-weight: 500;
  }
  .chart-subtitle {
    font-size: 13px;
  }
  .treemap-card-header {
    margin-bottom: 16px;
  }
  .treemap-metrics-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 20px;
  }
  .treemap-kpi-group {
    justify-content: flex-start;
    gap: 20px;
  }
  .kpi-num {
    font-size: 24px;
  }
  .kpi-unit {
    font-size: 13.5px;
  }
  .kpi-metric-divider {
    height: 38px;
  }
  .treemap-year-control {
    width: 100%;
  }
  .year-dropdown-wrap {
    width: 100%;
  }
  .treemap-grid-container {
    height: 580px;
    gap: 8px;
    padding: 2px;
  }
  .treemap-col {
    gap: 8px;
  }
  .treemap-tile {
    padding: 10px 12px !important;
    min-height: 60px;
  }
  .treemap-tile .tile-title {
    font-size: 13.5px !important;
    font-weight: 500 !important;
    line-height: 1.3;
  }
  .treemap-tile .tile-value {
    font-size: 12px !important;
    font-weight: 500;
  }
  .treemap-tile .tile-percent {
    font-size: 11px !important;
  }
  .treemap-tile.tile-rank-1 .tile-title {
    font-size: 15px !important;
  }
  .treemap-tile.tile-rank-2 .tile-title {
    font-size: 14px !important;
  }
  .treemap-tooltip {
    max-width: 230px;
    font-size: 12px;
    padding: 8px 12px;
  }
  .legend-container {
    gap: 6px;
    margin-top: 16px;
  }
  .legend-item {
    font-size: 11.5px;
  }
}
