/* ==========================================================================
   Harmony Plus Solution Map - CSS Stylesheet
   ========================================================================== */

/* --- Design System & CSS Variables --- */
:root {
  /* Colors - Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-header: #0a2540;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-light: #ffffff;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;
  --accent-color: #0f172a;
  --glow-color: rgba(15, 23, 42, 0.05);
  
  /* Brand Theme Colors */
  --header-bg: linear-gradient(135deg, #0a2540 0%, #1e3a8a 100%);
  --header-text: #ffffff;
  
  /* Solutions Palette - 11 Colors */
  /* EdTech Solutions */
  --sol-1: #4f46e5;
  --sol-1-bg: rgba(79, 70, 229, 0.1);
  --sol-2: #8b5cf6;
  --sol-2-bg: rgba(139, 92, 246, 0.1);
  --sol-3: #d946ef;
  --sol-3-bg: rgba(217, 70, 239, 0.1);
  --sol-4: #ec4899;
  --sol-4-bg: rgba(236, 72, 153, 0.1);
  /* BPaaS Solutions */
  --sol-5: #0ea5e9;
  --sol-5-bg: rgba(14, 165, 233, 0.1);
  --sol-6: #06b6d4;
  --sol-6-bg: rgba(6, 182, 212, 0.1);
  --sol-7: #14b8a6;
  --sol-7-bg: rgba(20, 184, 166, 0.1);
  --sol-8: #10b981;
  --sol-8-bg: rgba(16, 185, 129, 0.1);
  --sol-9: #84cc16;
  --sol-9-bg: rgba(132, 204, 22, 0.1);
  --sol-10: #eab308;
  --sol-10-bg: rgba(234, 179, 8, 0.1);
  --sol-11: #f97316;
  --sol-11-bg: rgba(249, 115, 22, 0.1);

  /* Dimensions & Transitions */
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.02);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --bg-header: #030712;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-color: #374151;
  --border-light: #1f2937;
  --accent-color: #f3f4f6;
  --glow-color: rgba(59, 130, 246, 0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.2), 0 2px 4px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -2px rgba(0,0,0,0.15);
  
  --sol-1-bg: rgba(79, 70, 229, 0.2);
  --sol-2-bg: rgba(139, 92, 246, 0.2);
  --sol-3-bg: rgba(217, 70, 239, 0.2);
  --sol-4-bg: rgba(236, 72, 153, 0.2);
  --sol-5-bg: rgba(14, 165, 233, 0.2);
  --sol-6-bg: rgba(6, 182, 212, 0.2);
  --sol-7-bg: rgba(20, 184, 166, 0.2);
  --sol-8-bg: rgba(16, 185, 129, 0.2);
  --sol-9-bg: rgba(132, 204, 22, 0.2);
  --sol-10-bg: rgba(234, 179, 8, 0.2);
  --sol-11-bg: rgba(249, 115, 22, 0.2);
}

/* --- Base Styles --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* --- Background Glow Effects --- */
.bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-color) 0%, rgba(255,255,255,0) 70%);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
  transition: background var(--transition-normal);
}

.bg-glow-1 {
  top: -100px;
  right: -100px;
}

.bg-glow-2 {
  bottom: 200px;
  left: -200px;
}

/* --- Header --- */
.app-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 2.25rem;
  height: 2.25rem;
  color: #60a5fa;
  animation: float 4s ease-in-out infinite;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

.brand-name span {
  color: #60a5fa;
  font-weight: 400;
}

.header-title-area h1 {
  font-size: 1.75rem;
  font-weight: 900;
  margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
}

.header-title-area p {
  font-size: 0.9rem;
  color: #93c5fd;
  font-weight: 300;
}

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

/* Buttons */
.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--header-text);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

[data-theme="dark"] .btn-icon {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Toggle Theme Icons visibility */
.sun-icon { display: block; }
.moon-icon { display: none; }

[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }

.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: var(--header-text);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.6);
}

/* --- Layout Container --- */
.app-container {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}

/* Info Banner */
.info-banner {
  background: var(--bg-secondary);
  border-left: 4px solid var(--sol-1);
  padding: 1rem 1.5rem;
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.info-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.925rem;
  color: var(--text-secondary);
}

.info-icon {
  color: var(--sol-1);
  flex-shrink: 0;
}

/* ==========================================================================
   Map Grid - Desktop Layout
   ========================================================================== */

.map-section-wrapper {
  overflow-x: auto;
  padding-bottom: 1.5rem;
  margin-bottom: 2.5rem;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
}

.map-grid-container {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr minmax(180px, 220px);
  grid-template-rows: auto 1fr auto;
  width: 100%;
  background: var(--bg-secondary);
  padding: 1.5rem;
  gap: 12px;
}

@media (max-width: 1024px) {
  .map-grid-container {
    min-width: 1100px; /* Force scroll on smaller screens to prevent squeezing text */
  }
}

/* Corner Spacers */
.grid-corner-spacer {
  background: transparent;
}

.grid-bottom-right-spacer {
  background: transparent;
}

/* --- 1. Phase Headers (Top Row) --- */
.phase-headers-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.phase-header {
  background: #1e3a8a;
  color: #ffffff;
  padding: 0.75rem 1rem 0.75rem 1.75rem;
  display: flex;
  align-items: center;
  position: relative;
  transition: all var(--transition-normal);
}

/* Chevron clip-path for continuous arrow shape */
.phase-headers-container > .phase-header {
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%, 15px 50%);
}

.phase-headers-container > .phase-header:first-child {
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);
  padding-left: 1.25rem;
  border-top-left-radius: var(--border-radius-sm);
  border-bottom-left-radius: var(--border-radius-sm);
}

.phase-headers-container > .phase-header:last-child {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 15px 50%);
  border-top-right-radius: var(--border-radius-sm);
  border-bottom-right-radius: var(--border-radius-sm);
}

.phase-arrow-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.phase-icon-wrapper {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.phase-icon-wrapper i {
  width: 1.2rem;
  height: 1.2rem;
  color: #93c5fd;
}

.phase-info {
  display: flex;
  flex-direction: column;
}

.phase-time {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
}

.phase-desc {
  font-size: 0.725rem;
  opacity: 0.85;
  font-weight: 300;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* Phase header active / highlight states when hovered */
.phase-header.active-col {
  background: #1d4ed8;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2);
}

/* --- 2. Domain Headers (Left Column) --- */
.domain-headers-container {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  gap: 12px;
}

.domain-header {
  background: #1e40af;
  color: #ffffff;
  padding: 1.25rem 1rem;
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.domain-icon-wrapper {
  background: rgba(255, 255, 255, 0.1);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.domain-icon-wrapper i {
  width: 1.4rem;
  height: 1.4rem;
  color: #60a5fa;
}

.domain-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.domain-letter {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  opacity: 0.9;
  line-height: 1;
}

.domain-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.domain-header.active-row {
  background: #2563eb;
  transform: translateX(4px);
}

/* --- Vertical Delivered Value Title Header --- */
.vertical-value-main-header {
  background: #1e3a8a;
  color: #ffffff;
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
}

/* --- Horizontal Delivered Value Title Header --- */
.horizontal-value-main-header {
  background: #1e3a8a;
  color: #ffffff;
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
}

/* ==========================================================================
   Central Grid Cells
   ========================================================================== */
.map-grid-cells {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 12px;
}

.map-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

/* Subtle card indicator */
.map-cell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  transition: background var(--transition-normal);
}

.map-cell:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

.cell-tasks {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-item {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  position: relative;
  padding-left: 0.75rem;
}

.task-item::before {
  content: '•';
  color: var(--text-muted);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* --- Badges Styling --- */
.cell-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  color: #ffffff;
  transition: all var(--transition-normal);
  user-select: none;
}

.badge-1 { background-color: var(--sol-1); }
.badge-2 { background-color: var(--sol-2); }
.badge-3 { background-color: var(--sol-3); }
.badge-4 { background-color: var(--sol-4); }
.badge-5 { background-color: var(--sol-5); }
.badge-6 { background-color: var(--sol-6); }
.badge-7 { background-color: var(--sol-7); }
.badge-8 { background-color: var(--sol-8); }
.badge-9 { background-color: var(--sol-9); }
.badge-10 { background-color: var(--sol-10); }
.badge-11 { background-color: var(--sol-11); }

/* --- Right Side: Vertical Delivered Value Cards --- */
.vertical-values-container {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  gap: 12px;
}

.vertical-value-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  border-left: 4px solid #1e40af;
}

.v-card-icon {
  background: rgba(30, 64, 175, 0.08);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .v-card-icon {
  background: rgba(96, 165, 250, 0.1);
}

.v-card-icon i {
  width: 1.1rem;
  height: 1.1rem;
  color: #1e40af;
}

[data-theme="dark"] .v-card-icon i {
  color: #60a5fa;
}

.v-card-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

/* --- Bottom Row: Horizontal Delivered Value Cards --- */
.horizontal-values-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.horizontal-value-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  border-top: 4px solid #1e3a8a;
}

.h-card-icon {
  background: rgba(30, 58, 138, 0.08);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .h-card-icon {
  background: rgba(96, 165, 250, 0.1);
}

.h-card-icon i {
  width: 1.1rem;
  height: 1.1rem;
  color: #1e3a8a;
}

[data-theme="dark"] .h-card-icon i {
  color: #60a5fa;
}

.h-card-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ==========================================================================
   Focus & Selection Modes (Interactive Highlighting)
   ========================================================================== */

/* Body/Container states driven by Javascript selection */

/* Dim out everything when a solution is focused */
.focus-active .map-cell,
.focus-active .domain-header,
.focus-active .phase-header,
.focus-active .vertical-value-card,
.focus-active .horizontal-value-card {
  opacity: 0.25;
  filter: grayscale(40%);
}

.focus-active .badge {
  opacity: 0.25;
}

/* Keep focused items bright and colorful */
.focus-active .map-cell.sol-focused {
  opacity: 1;
  filter: none;
  transform: translateY(-2px);
  border-width: 2px;
}

/* Active headers of active cells */
.focus-active .phase-header.col-focused,
.focus-active .domain-header.row-focused,
.focus-active .vertical-value-card.row-focused,
.focus-active .horizontal-value-card.col-focused {
  opacity: 1;
  filter: none;
}

/* Color specific borders and glow states on focused cells */
.focus-active[data-active-sol="1"] .map-cell.sol-focused {
  border-color: var(--sol-1);
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.25);
}
.focus-active[data-active-sol="1"] .map-cell.sol-focused::before { background: var(--sol-1); }

.focus-active[data-active-sol="2"] .map-cell.sol-focused {
  border-color: var(--sol-2);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.25);
}
.focus-active[data-active-sol="2"] .map-cell.sol-focused::before { background: var(--sol-2); }

.focus-active[data-active-sol="3"] .map-cell.sol-focused {
  border-color: var(--sol-3);
  box-shadow: 0 0 15px rgba(217, 70, 239, 0.25);
}
.focus-active[data-active-sol="3"] .map-cell.sol-focused::before { background: var(--sol-3); }

.focus-active[data-active-sol="4"] .map-cell.sol-focused {
  border-color: var(--sol-4);
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.25);
}
.focus-active[data-active-sol="4"] .map-cell.sol-focused::before { background: var(--sol-4); }

.focus-active[data-active-sol="5"] .map-cell.sol-focused {
  border-color: var(--sol-5);
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.25);
}
.focus-active[data-active-sol="5"] .map-cell.sol-focused::before { background: var(--sol-5); }

.focus-active[data-active-sol="6"] .map-cell.sol-focused {
  border-color: var(--sol-6);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.25);
}
.focus-active[data-active-sol="6"] .map-cell.sol-focused::before { background: var(--sol-6); }

.focus-active[data-active-sol="7"] .map-cell.sol-focused {
  border-color: var(--sol-7);
  box-shadow: 0 0 15px rgba(20, 184, 166, 0.25);
}
.focus-active[data-active-sol="7"] .map-cell.sol-focused::before { background: var(--sol-7); }

.focus-active[data-active-sol="8"] .map-cell.sol-focused {
  border-color: var(--sol-8);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.25);
}
.focus-active[data-active-sol="8"] .map-cell.sol-focused::before { background: var(--sol-8); }

.focus-active[data-active-sol="9"] .map-cell.sol-focused {
  border-color: var(--sol-9);
  box-shadow: 0 0 15px rgba(132, 204, 22, 0.25);
}
.focus-active[data-active-sol="9"] .map-cell.sol-focused::before { background: var(--sol-9); }

.focus-active[data-active-sol="10"] .map-cell.sol-focused {
  border-color: var(--sol-10);
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.25);
}
.focus-active[data-active-sol="10"] .map-cell.sol-focused::before { background: var(--sol-10); }

.focus-active[data-active-sol="11"] .map-cell.sol-focused {
  border-color: var(--sol-11);
  box-shadow: 0 0 15px rgba(249, 115, 22, 0.25);
}
.focus-active[data-active-sol="11"] .map-cell.sol-focused::before { background: var(--sol-11); }

/* Pulsing badge highlight style */
.focus-active .map-cell.sol-focused .badge.badge-active {
  opacity: 1;
  transform: scale(1.3);
  box-shadow: 0 0 8px currentColor;
  z-index: 2;
}

/* ==========================================================================
   Legend Section (Bottom Area)
   ========================================================================== */
.legend-section {
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.legend-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.legend-header h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.legend-header h2 span {
  font-size: 1.15rem;
  color: var(--text-secondary);
}

.legend-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.legend-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 170px;
}

.legend-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.legend-number {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1rem;
}

/* Color classes for header icons/circles */
.color-1 .legend-number { background-color: var(--sol-1); }
.color-2 .legend-number { background-color: var(--sol-2); }
.color-3 .legend-number { background-color: var(--sol-3); }
.color-4 .legend-number { background-color: var(--sol-4); }
.color-5 .legend-number { background-color: var(--sol-5); }
.color-6 .legend-number { background-color: var(--sol-6); }
.color-7 .legend-number { background-color: var(--sol-7); }
.color-8 .legend-number { background-color: var(--sol-8); }
.color-9 .legend-number { background-color: var(--sol-9); }
.color-10 .legend-number { background-color: var(--sol-10); }
.color-11 .legend-number { background-color: var(--sol-11); }

.legend-card h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.legend-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.4;
  flex-grow: 1;
}

.legend-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
  transition: color var(--transition-fast);
}

.badge-count {
  font-weight: 700;
  color: var(--text-primary);
}

.legend-card-footer i {
  width: 1rem;
  height: 1rem;
  transition: transform var(--transition-fast);
}

/* Legend card hover states */
.legend-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

.legend-card:hover .legend-card-footer i {
  transform: translateX(3px);
}

/* Specific glows based on solution theme on hover */
.legend-card[data-solution="1"]:hover,
.legend-card[data-solution="1"].active-card {
  border-color: var(--sol-1);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.15), 0 0 15px rgba(59, 130, 246, 0.1);
  background-color: var(--sol-1-bg);
}
.legend-card[data-solution="2"]:hover,
.legend-card[data-solution="2"].active-card {
  border-color: var(--sol-2);
  box-shadow: 0 10px 15px -3px rgba(0, 164, 180, 0.15), 0 0 15px rgba(0, 164, 180, 0.1);
  background-color: var(--sol-2-bg);
}
.legend-card[data-solution="3"]:hover,
.legend-card[data-solution="3"].active-card {
  border-color: var(--sol-3);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.15), 0 0 15px rgba(16, 185, 129, 0.1);
  background-color: var(--sol-3-bg);
}
.legend-card[data-solution="4"]:hover,
.legend-card[data-solution="4"].active-card {
  border-color: var(--sol-4);
  box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.15), 0 0 15px rgba(139, 92, 246, 0.1);
  background-color: var(--sol-4-bg);
}
.legend-card[data-solution="5"]:hover,
.legend-card[data-solution="5"].active-card {
  border-color: var(--sol-5);
  box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.15), 0 0 15px rgba(245, 158, 11, 0.1);
  background-color: var(--sol-5-bg);
}

/* Card active/locked state */
.legend-card.active-card {
  border-width: 2px;
}

.legend-card.active-card .legend-card-footer {
  color: var(--text-primary);
  font-weight: 700;
}

.legend-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1rem;
}

/* --- Footer --- */
.app-footer {
  background: var(--bg-secondary);
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}

/* ==========================================================================
   Details Sidebar Drawer
   ========================================================================== */
.details-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  opacity: 0;
  transition: visibility var(--transition-normal), opacity var(--transition-normal);
}

.details-drawer.open {
  visibility: visible;
  opacity: 1;
}

.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.drawer-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 100%;
  background: var(--bg-secondary);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1001;
}

.details-drawer.open .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-category {
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #1e3a8a;
  letter-spacing: 0.1em;
  background: rgba(30, 58, 138, 0.08);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
}

[data-theme="dark"] .drawer-category {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}

.drawer-body {
  padding: 2rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* In-drawer detailing classes */
.drawer-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  line-height: 1.3;
}

.drawer-section {
  margin-bottom: 2rem;
}

.drawer-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.drawer-section-title i {
  width: 1.1rem;
  height: 1.1rem;
}

.drawer-desc-box {
  background: var(--bg-primary);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.drawer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.drawer-list-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.drawer-list-item i {
  color: var(--sol-3);
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.drawer-solution-row-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-primary);
  padding: 0.85rem 1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 0.75rem;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.drawer-solution-row-card:hover {
  transform: translateX(4px);
  border-color: var(--accent-color);
}

.drawer-sol-badge {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.drawer-sol-info {
  display: flex;
  flex-direction: column;
}

.drawer-sol-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-sol-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0px); }
}

@keyframes flash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  50% { transform: scale(1.05); box-shadow: 0 0 25px rgba(37, 99, 235, 0.5); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.flash-highlight {
  animation: flash 1.5s ease-out;
  border-color: #2563eb !important;
  z-index: 10;
}

/* ==========================================================================
   Responsive Styles (Media Queries)
   ========================================================================== */

/* Wide Desktops & Tablets scroll configuration is already set by min-width of grid container */

@media (max-width: 1024px) {
  .app-container {
    padding: 1rem;
  }
  
  .legend-cards-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .header-container {
    grid-template-columns: 1fr auto;
    gap: 1rem;
  }

  .header-title-area {
    grid-column: 1 / span 2;
    text-align: left;
  }

  .legend-cards-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .legend-cards-container {
    grid-template-columns: 1fr;
  }
  
  .btn-outline {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }
}

/* ==========================================================================
   Single Screen Viewport Dashboard Layout (Desktops)
   ========================================================================== */
@media (min-width: 1025px) and (min-height: 600px) {
  html, body {
    height: 100vh;
    overflow: hidden;
  }
  body {
    display: flex;
    flex-direction: column;
  }
  .app-header {
    padding: 0.65rem 1.5rem;
  }
  .header-container {
    gap: 1rem;
  }
  .logo-icon {
    width: 1.75rem;
    height: 1.75rem;
  }
  .brand-name {
    font-size: 1.25rem;
  }
  .header-title-area h1 {
    font-size: 1.35rem;
  }
  .header-title-area p {
    font-size: 0.8rem;
  }
  .btn-icon {
    width: 2.25rem;
    height: 2.25rem;
  }
  .btn-outline {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }
  .app-container {
    padding: 0.5rem 1.5rem 0.5rem 1.5rem;
    gap: 0.4rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
  }
  .info-banner {
    margin-bottom: 0.25rem;
    padding: 0.4rem 0.8rem;
  }
  .info-banner-content {
    font-size: 0.8rem;
  }
  .map-section-wrapper {
    flex: 1;
    margin-bottom: 0.4rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .map-grid-container {
    flex: 1;
    height: 100%;
    padding: 0.5rem;
    gap: 6px;
    grid-template-columns: minmax(130px, 170px) 1fr minmax(130px, 170px);
  }
  
  /* Central Cells styling in 1-screen viewport */
  .map-grid-cells {
    gap: 6px;
  }
  .map-cell {
    padding: 0.35rem 0.5rem;
    gap: 0.2rem;
    border-radius: var(--border-radius-sm);
  }
  .task-item {
    font-size: clamp(10px, 0.75vw, 11.5px);
    line-height: 1.25;
    padding-left: 0.4rem;
  }
  .cell-badges {
    gap: 0.25rem;
  }
  .badge {
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.6rem;
  }
  
  /* Headers in 1-screen viewport */
  .phase-headers-container {
    gap: 3px;
  }
  .phase-header {
    padding: 0.3rem 0.4rem 0.3rem 1.15rem;
  }
  .phase-headers-container > .phase-header:first-child {
    padding-left: 0.65rem;
  }
  .phase-icon-wrapper {
    width: 1.65rem;
    height: 1.65rem;
  }
  .phase-icon-wrapper i {
    width: 0.85rem;
    height: 0.85rem;
  }
  .phase-time {
    font-size: clamp(0.75rem, 0.8vw, 0.9rem);
  }
  .phase-desc {
    font-size: 0.55rem;
    max-width: 100px;
  }
  
  .domain-headers-container {
    gap: 6px;
  }
  .domain-header {
    padding: 0.4rem;
    gap: 0.1rem;
    border-radius: var(--border-radius-sm);
  }
  .domain-icon-wrapper {
    width: 1.65rem;
    height: 1.65rem;
    margin-bottom: 0;
  }
  .domain-icon-wrapper i {
    width: 0.85rem;
    height: 0.85rem;
  }
  .domain-letter {
    font-size: 0.85rem;
  }
  .domain-name {
    font-size: clamp(10px, 0.7vw, 11px);
  }
  
  /* Values Banners in 1-screen viewport */
  .vertical-values-container {
    gap: 6px;
  }
  .vertical-value-card {
    padding: 0.4rem 0.6rem;
    border-radius: var(--border-radius-sm);
    gap: 0.3rem;
  }
  .v-card-icon {
    width: 1.65rem;
    height: 1.65rem;
  }
  .v-card-icon i {
    width: 0.85rem;
    height: 0.85rem;
  }
  .v-card-text {
    font-size: clamp(9px, 0.65vw, 10.5px);
    line-height: 1.25;
  }
  
  .horizontal-values-container {
    gap: 3px;
  }
  .horizontal-value-card {
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius-sm);
    gap: 0.3rem;
  }
  .h-card-icon {
    width: 1.65rem;
    height: 1.65rem;
  }
  .h-card-icon i {
    width: 0.85rem;
    height: 0.85rem;
  }
  .h-card-text {
    font-size: clamp(9px, 0.65vw, 10.5px);
    line-height: 1.25;
  }
  
  .vertical-value-main-header,
  .horizontal-value-main-header {
    font-size: 0.7rem;
    padding: 0.3rem;
  }
  
  /* Legend Section in 1-screen viewport */
  .legend-section {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
  }
  .legend-header {
    margin-bottom: 0.25rem;
  }
  .legend-header h2 {
    font-size: 1rem;
  }
  .legend-header h2 span {
    font-size: 0.8rem;
  }
  .legend-subtitle {
    font-size: 0.7rem;
  }
  .legend-cards-container {
    gap: 0.4rem;
    margin-bottom: 0.25rem;
  }
  .legend-card {
    padding: 0.4rem 0.6rem;
    min-height: unset;
    border-radius: var(--border-radius-sm);
    gap: 0.15rem;
  }
  .legend-card-header {
    margin-bottom: 0.1rem;
    gap: 0.35rem;
  }
  .legend-number {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.75rem;
  }
  .legend-card h3 {
    font-size: 0.8rem;
  }
  .legend-desc {
    font-size: 0.65rem;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .legend-card-footer {
    display: none; /* Hide since details are in drawer */
  }
  .legend-note {
    display: none; /* Hide note to save vertical space */
  }
  .app-footer {
    display: none; /* Hide footer in dashboard view to save space */
  }
}

