/* ==========================================================================
   Interactive MP Map & District Education Statistics Dashboard
   Department of School Education, Madhya Pradesh
   ========================================================================== */

:root {
  --mp-navy: var(--gov-navy, #163b75);
  --mp-navy-dark: var(--gov-navy-dark, #0f254a);
  --mp-orange-hover: #f97316;
  --mp-orange-active: #ea580c;
  --mp-orange-light: #fff7ed;
  --mp-card-bg: #ffffff;
  --mp-border: #e2e8f0;
  --mp-text-dark: #0f172a;
  --mp-text-muted: #64748b;
  --mp-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --mp-shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
  --mp-shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);
}

/* Section Container */
.mp-dashboard-section {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 36px 0 40px 0;
  position: relative;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  font-family: inherit;
}

.mp-dashboard-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--mp-navy) 0%,
    #f97316 50%,
    var(--mp-navy) 100%
  );
}

/* Section Header */
.mp-section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(249, 115, 22, 0.12);
  color: #ea580c;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 6px;
  border: 1px solid rgba(249, 115, 22, 0.25);
  letter-spacing: 0.3px;
}

.mp-section-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--mp-navy-dark);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
  position: relative;
  display: inline-block;
  padding-bottom: 8px;
}

.mp-section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 55px;
  height: 3px;
  background: var(--gov-saffron, #f97316);
  border-radius: 9999px;
}

.mp-section-subtitle {
  font-size: 0.92rem;
  color: var(--mp-text-muted);
  max-width: 640px;
  margin: 6px auto 18px auto;
  line-height: 1.4;
  text-align: center;
}

/* Map Card (Reduced Radius) */
.mp-map-card {
  background: var(--mp-card-bg);
  border-radius: 8px;
  box-shadow: var(--mp-shadow-md);
  border: 1px solid var(--mp-border);
  padding: 16px;
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mp-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.mp-map-header-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--mp-navy-dark);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.mp-map-header-title i {
  color: #ea580c;
}

.mp-district-search-wrapper {
  min-width: 200px;
}

.mp-district-select {
  width: 100%;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  padding: 6px 12px;
  background-color: #fff;
  color: var(--mp-navy-dark);
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.mp-district-select:focus {
  border-color: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
  outline: none;
}

/* Map View Container - Enlarged to fill space */
.mp-svg-container {
  width: 100%;
  flex: 1;
  min-height: 380px;
  max-height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #f8fafc;
  border-radius: 6px;
  padding: 4px;
  overflow: hidden;
}

.mp-svg-container svg {
  width: 100%;
  height: 100%;
  max-height: 430px;
  filter: drop-shadow(0 4px 14px rgba(22, 59, 117, 0.15));
  transition: transform 0.25s ease;
}

/* SVG District Styling */
.mp-district-group {
  cursor: pointer;
  outline: none;
}

.mp-district-group .mp-district-path,
.mp-district-group .fil1 {
  fill: #163b75;
  stroke: #ffffff;
  stroke-width: 2px;
  stroke-linejoin: round;
  transition:
    fill 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    stroke-width 0.2s ease,
    filter 0.2s ease;
}

.mp-district-group .mp-district-outline,
.mp-district-group .str0,
.mp-district-group .str1 {
  stroke: #ffffff;
  stroke-width: 2px;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

/* Hover Effect: Vibrant Orange */
.mp-district-group:hover .mp-district-path,
.mp-district-group:hover .fil1 {
  fill: #f97316 !important;
  stroke: #ffffff !important;
  stroke-width: 5px !important;
  filter: drop-shadow(0 0 14px rgba(249, 115, 22, 0.75));
}

/* Active / Selected State: Deep Orange with Prominent Glow */
.mp-district-group.active .mp-district-path,
.mp-district-group.active .fil1 {
  fill: #ea580c !important;
  stroke: #ffffff !important;
  stroke-width: 5px !important;
  filter: drop-shadow(0 0 18px rgba(234, 88, 12, 0.85));
}

/* Map Controls & Legend */
.mp-map-footer-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  font-size: 0.75rem;
  color: var(--mp-text-muted);
}

.mp-legend-items {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mp-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mp-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.mp-legend-color.default {
  background-color: #163b75;
}

.mp-legend-color.selected {
  background-color: #ea580c;
}

/* Floating Tooltip */
.mp-map-tooltip {
  position: fixed;
  background: #0f172a;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(249, 115, 22, 0.4);
  white-space: nowrap;
}

.mp-map-tooltip.visible {
  opacity: 1;
  transform: translate(-50%, -130%);
}

.mp-tooltip-name-hi {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fb923c;
  margin-bottom: 1px;
}

.mp-tooltip-name-en {
  font-size: 0.75rem;
  color: #cbd5e1;
}

/* Statistics Panel (Right Side - Reduced Radius) */
.mp-stats-card {
  background: var(--mp-card-bg);
  border-radius: 8px;
  box-shadow: var(--mp-shadow-md);
  border: 1px solid var(--mp-border);
  padding: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* District Header Badge (Single Row Layout) */
.mp-district-hero {
  background: var(--gov-navy, #78350f) !important;
  color: #ffffff;
  border-radius: 6px;
  padding: 10px 16px;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* Dynamic Portal Theme Support for District Hero */
[data-gov-theme="bronze"] .mp-district-hero {
  background: #78350f !important;
}
[data-gov-theme="green"] .mp-district-hero {
  background: #047857 !important;
}
[data-gov-theme="orange"] .mp-district-hero,
[data-gov-theme="purple"] .mp-district-hero {
  background: #ea580c !important;
}
[data-gov-theme="maroon"] .mp-district-hero {
  background: #9f1239 !important;
}
[data-gov-theme="saffron"] .mp-district-hero {
  background: #c2410c !important;
}
[data-gov-theme="teal"] .mp-district-hero {
  background: #0e7490 !important;
}
[data-gov-theme="indigo"] .mp-district-hero {
  background: #3730a3 !important;
}
[data-gov-theme="blue"] .mp-district-hero {
  background: #1c4485 !important;
}

.mp-hero-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.mp-hero-district-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  color: #ffffff;
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}

.mp-hero-district-en {
  font-size: 0.95rem;
  font-weight: 500;
  color: #fed7aa;
}

.mp-hero-division-badge {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  color: #fed7aa;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.mp-hero-right {
  display: flex;
  align-items: center;
}

.mp-hero-tag {
  color: #ea580c;
  background: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* KPI Cards Grid (Balanced 2-Column x 3-Row Layout) */
.mp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  flex: 1;
}

.mp-kpi-box {
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
}

.mp-kpi-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

/* Light Solid Background Graphic Accent (Bottom-Right) */
.mp-kpi-box::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -22px;
  width: 95px;
  height: 95px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.46;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.mp-kpi-box:hover::after {
  transform: scale(1.15);
  opacity: 0.65;
}

/* Light Solid Theme Graphic Silhouette (Right / Bottom-Right) */
.mp-kpi-graphic {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 2.2rem;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
  opacity: 0.09;
  transform: rotate(-6deg);
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease;
}

.mp-kpi-box:hover .mp-kpi-graphic {
  transform: rotate(0deg) scale(1.1);
  opacity: 0.15;
}

/* Multicolor Card Themes */
.kpi-theme-schools {
  background: linear-gradient(135deg, #f0f7ff 0%, #e0effe 100%);
  border: 1.5px solid #38bdf8;
}
.kpi-theme-schools::after {
  background-color: #bae6fd;
}
.kpi-theme-schools .mp-kpi-label {
  color: #0369a1;
}
.kpi-theme-schools .mp-kpi-val {
  color: #0c4a6e;
}
.kpi-theme-schools .mp-kpi-sub {
  color: #0284c7;
}
.kpi-theme-schools .mp-kpi-graphic {
  color: #0284c7;
}

.kpi-theme-students {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1.5px solid #4ade80;
}
.kpi-theme-students::after {
  background-color: #bbf7d0;
}
.kpi-theme-students .mp-kpi-label {
  color: #15803d;
}
.kpi-theme-students .mp-kpi-val {
  color: #14532d;
}
.kpi-theme-students .mp-kpi-sub {
  color: #16a34a;
}
.kpi-theme-students .mp-kpi-graphic {
  color: #16a34a;
}

.kpi-theme-teachers {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  border: 1.5px solid #c084fc;
}
.kpi-theme-teachers::after {
  background-color: #e9d5ff;
}
.kpi-theme-teachers .mp-kpi-label {
  color: #7e22ce;
}
.kpi-theme-teachers .mp-kpi-val {
  color: #581c87;
}
.kpi-theme-teachers .mp-kpi-sub {
  color: #9333ea;
}
.kpi-theme-teachers .mp-kpi-graphic {
  color: #9333ea;
}

.kpi-theme-cmrise {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1.5px solid #fb923c;
}
.kpi-theme-cmrise::after {
  background-color: #fed7aa;
}
.kpi-theme-cmrise .mp-kpi-label {
  color: #c2410c;
}
.kpi-theme-cmrise .mp-kpi-val {
  color: #7c2d12;
}
.kpi-theme-cmrise .mp-kpi-sub {
  color: #ea580c;
}
.kpi-theme-cmrise .mp-kpi-graphic {
  color: #ea580c;
}

.kpi-theme-kgbv {
  background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
  border: 1.5px solid #f472b6;
}
.kpi-theme-kgbv::after {
  background-color: #fbcfe8;
}
.kpi-theme-kgbv .mp-kpi-label {
  color: #be185d;
}
.kpi-theme-kgbv .mp-kpi-val {
  color: #831843;
}
.kpi-theme-kgbv .mp-kpi-sub {
  color: #db2777;
}
.kpi-theme-kgbv .mp-kpi-graphic {
  color: #db2777;
}

.kpi-theme-results {
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
  border: 1.5px solid #22d3ee;
}
.kpi-theme-results::after {
  background-color: #a5f3fc;
}
.kpi-theme-results .mp-kpi-label {
  color: #0e7490;
}
.kpi-theme-results .mp-kpi-val {
  color: #164e63;
}
.kpi-theme-results .mp-kpi-sub {
  color: #0891b2;
}
.kpi-theme-results .mp-kpi-graphic {
  color: #0891b2;
}

.mp-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  background: #ffffff !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 2;
}

.mp-kpi-icon.schools {
  color: #0284c7;
}
.mp-kpi-icon.students {
  color: #16a34a;
}
.mp-kpi-icon.teachers {
  color: #9333ea;
}
.mp-kpi-icon.cmrise {
  color: #ea580c;
}
.mp-kpi-icon.kgbv {
  color: #db2777;
}
.mp-kpi-icon.results {
  color: #0891b2;
}

.mp-kpi-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 2;
}

.mp-kpi-label {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 3px;
  line-height: 1.25;
}

.mp-kpi-val {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.mp-kpi-sub {
  font-size: 0.8rem;
  margin-top: 3px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .mp-dashboard-section {
    padding: 30px 0;
  }
  .mp-svg-container {
    min-height: 300px;
  }
  .mp-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .mp-section-title {
    font-size: 1.35rem;
  }
  .mp-kpi-grid {
    grid-template-columns: 1fr;
  }
  .mp-svg-container {
    min-height: 260px;
  }
}
