/* ====================================================
   Global Imports & Theme Variables
   ==================================================== */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

:root {
  /* Dark theme (default) */
  --primary-bg: #0d1117;
  --secondary-button-bg: rgba(255, 255, 255, 0.12);
  --accent-color: #646cff;
  --text-strong: #ffffff;
  --text-medium: #c2c8d6;
  --text-muted: #8f90a6;
  --input-text-color: #ffffff;
  --input-placeholder: #8f90a6;
  --border-muted: #313649;
  --border-radius: 20px;
  --sidebar-width: 24%;
  --high-risk: #ff5252;
  --high-risk-semi: #ff525243;
  --medium-risk: #ff9d45;
  --medium-risk-semi: #ff9c456d;
  --low-risk: #4ade80;
  --low-risk-semi: #4ade8073;
  --radar-color: #60b4f8;
  --info-box-bg: rgb(23 25 34 / 60%);
  --info-box-border: rgb(62 58 81);
  --card-bg: rgb(255 255 255 / 6%);
  --card-border: rgb(255 255 255 / 4%);
  --diff-box-bg: rgb(14 14 14 / 15%);
  --input-bg: rgba(255, 255, 255, 0.11);
  --input-bg-active: rgb(255 255 255 / 6%);
  --input-border: rgba(255, 255, 255, 0.08);
  --nav-bg: #161922;
  --button-hover-bg: rgba(255, 255, 255, 0.15);
  --axis-color: rgba(36, 40, 56, 0.8);
  --circle-color: rgb(40 38 71);
  --circle-5-color: rgb(54 50 112);
  --slice-bg: rgba(215, 213, 251, 0.04);
  --slice-active-bg: rgb(144 150 239 / 15%);
  --slice-border-color: var(--text-medium);
  --log-entry-bg: rgba(255, 255, 255, 0.05);
  --center-circle-background: #c8adef;
  --center-circle-glow: #b08fff;
  --center-circle-border: rgb(255, 255, 255);
  --center-circle-shadow: rgb(255, 255, 255 / 88%);
  --label-bg: rgba(36, 40, 56, 1);
  --vitals-bg: rgba(255, 255, 255, 0.05);
  /* Chart variables */
  --chart-size: 45vw;
  --chart-max-size: 550px;
  --chart-top-margin: 4rem;
}

:root.light-theme {
  --primary-bg: #ffffff;
  --secondary-button-bg: rgba(0, 0, 0, 0.08);
  --accent-color: #5f66e1;
  --text-strong: #1a1f36;
  --text-medium: #4a5072;
  --title-color: #00c96a;
  --text-muted: #6e7290;
  --input-text-color: #1a1f36;
  --input-placeholder: #ffffff;
  --border-muted: #d1d5e8;
  --info-box-bg: rgb(248 249 252 / 88%);
  --info-box-border: rgb(209 213 232);
  --card-bg: rgb(255 255 255 / 60%);
  --diff-box-bg: rgba(247, 247, 247, 0.85);
  --card-border: rgb(255 255, 255 / 60%);
  --input-bg: rgb(255 255 255 / 40%);
  --input-bg-active: rgb(255 255 255 / 40%);
  --input-border: rgb(255 255 255 / 80%);
  --nav-bg: #f4f5f7;
  --button-hover-bg: rgba(0, 0, 0, 0.06);
  --axis-color: #d7d5fb;
  --chart-shadow: inset -66px -92px 77px -2px #ecdef8,
    inset 66px 92px 77px -2px rgba(176, 157, 251, 0.02),
    inset 0 0 0 2px rgba(255, 255, 255, 1);
  --circle-color: #d7d5fb;
  --circle-5-color: rgba(255, 255, 255, 0.8);
  --slice-bg: rgba(47, 45, 85, 0.01);
  --slice-active-bg: rgb(198 196 247 / 35%);
  --slice-border-color: var(--accent-color);
  --log-entry-bg: rgba(255, 255, 255, 0.4);
  --radar-color: #3a7ee8;
  --center-circle-glow: #f9d7e7;
  --center-circle-border: rgb(255, 255, 255);
  --center-circle-shadow: rgba(245, 245, 255, 0.7);
  --label-bg: rgba(255, 255, 255, 0.9);
  --vitals-bg: rgba(255, 255, 255, 1);
}

/* ====================================================
   Base Layout & Global Styles
   ==================================================== */
body {
  background-color: var(--primary-bg);
  color: var(--text-strong);
  height: 100vh;
  overflow: hidden;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-size: 1rem;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ====================================================
   Navigation & Sidebar
   ==================================================== */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-radius: 3rem;
  margin: 0.5rem 1rem 1rem;
  background: var(--nav-bg);
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.light-theme .app-title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--accent-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.moon-icon {
  display: none;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: 6rem;
  max-width: 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

.sidebar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 1.25rem;
  position: relative;
}

.icon-container {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--secondary-button-bg);
  transition: background-color 0.3s ease;
}

.sidebar-option.active .icon-container {
  background-color: var(--accent-color);
  color: white;
}

.sidebar-option i {
  width: 20px;
  height: 20px;
}

.option-label {
  font-size: 0.75rem;
  margin-top: 0.3rem;
  color: var(--text-muted);
}

.sidebar-option.mic-toggle {
  border-top: 1px solid var(--border-muted);
}

.mic-toggle.active .option-label {
  color: var(--text-strong);
}

/* Diktat button follows standard sidebar style when inactive */
.diktat-button .icon-container {
  background-color: var(--secondary-button-bg);
  box-shadow: none;
}

.diktat-button:hover .icon-container {
  box-shadow: none;
}

.mic-toggle.active .icon-container {
  background-color: var(--accent-color);
  box-shadow: 0 0 0 3px #ff5252, 0 0 14px rgba(255, 82, 82, 0.45);
  position: relative;
  overflow: hidden;
}

.mic-toggle.active .icon-container::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* Language toggle button */
#languageToggleButton {
  border-top: 1px solid var(--border-muted);
  margin-top: 0.5rem;
  padding-top: 1.5rem;
}

#languageToggleButton .icon-container {
  background-color: var(--secondary-button-bg);
  transition: background-color 0.3s ease;
}

#languageToggleButton:hover .icon-container {
  background-color: var(--button-hover-bg);
}

#languageToggleButton .option-label {
  font-weight: 600;
  color: var(--text-medium);
}

/* ====================================================
   Main Content Area & Diagnostic Area
   ==================================================== */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.diagnostic-area {
  background: url("../assets/content-bg.png");
  background-size: cover;
  flex: 1;
  gap: 3rem;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  padding: 1rem;
  border-radius: 1.5rem 0 0 0;
}

.light-theme .diagnostic-area {
  background: url("../assets/content-bg_light.png");
  background-size: cover;
}

.prompt-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 30%;
  max-width: 24rem;
  justify-content: space-between;
}

/* ====================================================
   Knowledge Collection & Info Cards
   ==================================================== */
.knowledge-collection {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  line-height: 1.3rem;
  justify-content: flex-start;
  overflow: auto;
}

.info-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: all 0.3s ease;
  word-break: break-word;
  box-sizing: border-box;
}

.delete-button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-button i {
  width: 16px;
  height: 16px;
}

.diagnostic-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  align-items: center;
  position: relative;
}

/* ====================================================
   Diagnostic Visualization & Nodes
   ==================================================== */
.diagnostic-visualization {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 3rem;
}

.diagnostic-nodes {
  position: absolute;
  width: var(--chart-size);
  height: var(--chart-size);
  max-width: var(--chart-max-size);
  max-height: var(--chart-max-size);
  top: var(--chart-top-margin);
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 999;
  pointer-events: none;
}

.node {
  position: absolute;
  --base-size: 12px;
  width: calc(var(--base-size) * var(--size, 1));
  height: calc(var(--base-size) * var(--size, 1));
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease,
    opacity 0.5s ease-in-out;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
  z-index: 5;
  opacity: 0;
  pointer-events: auto;
}

.node-label {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.75rem;
  opacity: 0.9;
  transition: all 0.5s ease-in-out;
}

.node.label-inside-left .node-label {
  left: auto;
  right: 15px;
  text-align: right;
}

.node.label-inside-right .node-label {
  left: 15px;
  right: auto;
  text-align: left;
}

.node[data-commonality]::after {
  content: attr(data-commonality);
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.node[data-commonality]:hover::after {
  opacity: 1;
}

.node:hover {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
  z-index: 10;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.high-risk {
  background-color: var(--high-risk);
}

.medium-risk {
  background-color: var(--medium-risk);
}

.low-risk {
  background-color: var(--low-risk);
}

/* ====================================================
   Input & Action Buttons
   ==================================================== */
.input-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  background-color: var(--input-bg);
  border-radius: var(--border-radius);
  overflow: visible;
  padding: 0.85rem 0.85rem 0.65rem;
  backdrop-filter: blur(18px);
  border: 1px solid var(--input-border);
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-box:focus-within {
  border-color: rgba(100, 108, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(100, 108, 255, 0.08);
}

.input-box textarea {
  width: 100%;
  background: none;
  border: none;
  color: var(--input-text-color);
  font-size: 0.95rem;
  outline: none;
  resize: none;
  max-height: 200px;
  overflow-y: auto;
  padding: 0;
  line-height: 1.5;
  min-height: 24px;
}

.input-box textarea::placeholder {
  color: var(--input-placeholder);
}

/* Bottom toolbar row */
.input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.55rem;
  gap: 0.5rem;
}

.input-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Mode dropdown */
.mode-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--secondary-button-bg);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 1.6rem 0.3rem 0.65rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, color 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238f90a6' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.mode-select:hover,
.mode-select:focus {
  border-color: var(--accent-color);
  color: var(--text-strong);
}

.mode-select option {
  background: var(--primary-bg);
  color: var(--text-strong);
}

/* Character counter (inline in toolbar) */
.char-counter {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.3s ease;
  line-height: 1;
}

.char-counter #charCount {
  font-weight: 600;
}

/* Send button */
.submit-button {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-color);
  border: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.submit-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.5;
}

.submit-button:hover:not(:disabled) {
  background: #535be8;
  transform: scale(1.08);
}

.submit-button:active:not(:disabled) {
  transform: scale(0.95);
}

.submit-button:disabled,
.submit-button.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* Structured HTML card content */
.info-html {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-medium);
  font-family: 'Roboto Mono', 'Courier New', monospace;
  word-break: break-word;
}

.info-html .red    { color: #ff5252; }
.info-html .cyan   { color: #4dd0e1; }
.info-html .blue   { color: #64b5f6; }
.info-html .orange { color: #ffb74d; }
.info-html .yellow { color: #fff176; }
.info-html .purple { color: #ce93d8; }
.info-html .green  { color: #81c784; }
.info-html .teal   { color: #4db6ac; }
.info-html .lime   { color: #aed581; }
.info-html .gray   { color: #90a4ae; }
.info-html .brown  { color: #a1887f; }
.info-html .pink   { color: #f48fb1; }

.info-card.struct-card {
  align-items: flex-start;
}

.info-card.struct-card .info-html {
  flex: 1;
  padding-right: 0.5rem;
}

.char-counter #charCount {
  font-weight: 600;
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex: 0 1 auto;
}

.action-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--secondary-button-bg);
  border: none;
  color: var(--text-strong);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.action-button svg {
  width: 20px;
  height: 20px;
}

.submit-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ====================================================
   Chart & Radar Styles
   ==================================================== */

.radar-chart-container {
  position: relative;
  flex: 1;
  width: 100%;
}

.radar-chart {
  position: absolute;
  width: 100%;
  height: 100%;
}

canvas {
  mix-blend-mode: color-dodge;
  display: flex;
  position: absolute;
  width: var(--chart-size);
  height: var(--chart-size);
  max-width: var(--chart-max-size);
  max-height: var(--chart-max-size);
  top: var(--chart-top-margin);
  left: 50%;
  transform: translate(-50%, 0);
}

@media (max-width: 1300px) {
  :root {
    --chart-size: 450px;
    --max-chart-size: 450px;
  }
  canvas {
    opacity: 0.4;
  }
}

.radar-chart-container .labels {
  position: absolute;
  width: calc(var(--chart-size) + 4rem);
  height: calc(var(--chart-size) + 4rem);
  max-width: var(--chart-max-size);
  max-height: var(--chart-max-size);
  top: var(--chart-top-margin);
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 1;
}

.radar-chart-container .labels .label {
  background: var(--label-bg);
  position: absolute;
  padding: 0 0.5rem;
  display: block;
  border-radius: 13px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-align: center;
  line-height: 1.5;
  width: fit-content;
}

.bubble-legend {
  position: absolute;
  left: 50%;
  bottom: 0.5rem;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.bubble-legend-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bubble-legend-title {
  font-size: 0.7rem;
  color: var(--text-medium);
  white-space: nowrap;
}

.bubble-legend-items {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bubble-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-size {
  display: inline-block;
  border-radius: 50%;
  background: var(--text-medium);
  opacity: 0.85;
}

.legend-size-sm {
  width: 6px;
  height: 6px;
}

.legend-size-md {
  width: 10px;
  height: 10px;
}

.legend-size-lg {
  width: 14px;
  height: 14px;
}

@media (max-width: 900px) {
  .bubble-legend {
    gap: 0.6rem;
    bottom: 0.2rem;
    padding: 0.45rem 0.55rem;
  }

  .bubble-legend-group {
    width: 100%;
    justify-content: center;
  }
}

.circle-container {
  position: relative;
  width: var(--chart-size);
  height: var(--chart-size);
  max-width: var(--chart-max-size);
  max-height: var(--chart-max-size);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  margin: var(--chart-top-margin) auto 0;
}

.circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--circle-color);
}

.center-circle {
  width: 12px;
  height: 12px;
  background-color: var(--center-circle-background);
  --blur: 1.75rem;
  --box-blur: calc(0.5 * var(--blur));
  --size: 12rem;
  align-items: center;
  border-radius: 12px;
  border: 1px solid var(--center-circle-border);
  box-shadow: 0 0 0 2px rgb(0 0 0 / 15%),
    inset 0 0 var(--box-blur) var(--center-circle-glow),
    0 0 var(--box-blur) var(--center-circle-glow);
  z-index: 999;
}

.circle-1 {
  width: 20%;
  height: 20%;
}
.circle-2 {
  width: 35%;
  height: 35%;
}
.circle-3 {
  width: 50%;
  height: 50%;
}
.circle-4 {
  width: 65%;
  height: 65%;
}
.circle-5 {
  width: 90%;
  height: 90%;
  box-shadow: var(--chart-shadow);
  border: 2px solid var(--circle-5-color);
}
.circle-6 {
  width: 105%;
  height: 105%;
}

.axis-container {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.axis {
  position: absolute;
  width: 100%;
  height: 1px;
  background-color: var(--axis-color);
  top: 50%;
  left: 0;
  transform-origin: center;
}

.axis::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  background-color: var(--axis-color);
  border-radius: 0;
  top: -2px;
  right: 0;
  transform: rotate(45deg);
}

/* Rotations for 12 evenly spaced lines (rotated 15° left) */
.axis-0 {
  transform: rotate(15deg);
}
.axis-1 {
  transform: rotate(45deg);
}
.axis-2 {
  transform: rotate(75deg);
}
.axis-3 {
  transform: rotate(105deg);
}
.axis-4 {
  transform: rotate(135deg);
}
.axis-5 {
  transform: rotate(165deg);
}
.axis-6 {
  transform: rotate(195deg);
}
.axis-7 {
  transform: rotate(225deg);
}
.axis-8 {
  transform: rotate(255deg);
}
.axis-9 {
  transform: rotate(285deg);
}
.axis-10 {
  transform: rotate(315deg);
}
.axis-11 {
  transform: rotate(345deg);
}

.slices {
  position: absolute;
  width: 90%;
  height: 90%;
  clip-path: circle(50%);
  pointer-events: auto;
  z-index: 99;
}

.slice {
  position: absolute;
  width: 50%;
  height: 50%;
  background: var(--slice-bg);
  transform-origin: 100% 100%;
  clip-path: polygon(100% 100%, 42% 0%, 100% 0%);
  transition: all 0.4s ease-in-out;
  pointer-events: auto;
  z-index: 9999;
}

.slice.active {
  background: var(--slice-active-bg);
}

.slice:after {
  content: "";
  width: 200%;
  height: 200%;
  position: absolute;
  top: 0%;
  left: -2px;
  border: 0px solid transparent;
  display: block;
  border-radius: 50%;
  transition: border 0.1s ease;
}

.slice.active:after {
  border: 2px solid var(--slice-border-color);
  box-shadow: inset 0 0 0 8px rgb(236 147 202 / 17%);
}

/* Adjusted rotations for slices - 30 degree spacing, rotated 15° left */
.slice-2 {
  transform: rotate(15deg);
}
.slice-3 {
  transform: rotate(45deg);
}
.slice-4 {
  transform: rotate(75deg);
}
.slice-5 {
  transform: rotate(105deg);
}
.slice-6 {
  transform: rotate(135deg);
}
.slice-7 {
  transform: rotate(165deg);
}
.slice-8 {
  transform: rotate(195deg);
}
.slice-9 {
  transform: rotate(225deg);
}
.slice-10 {
  transform: rotate(255deg);
}
.slice-11 {
  transform: rotate(285deg);
}
.slice-12 {
  transform: rotate(315deg);
}
.slice-1 {
  transform: rotate(345deg);
}

/* ====================================================
   Radar Sweep Animation
   ==================================================== */
.radar-sweep {
  --radar-sweep-length: 45%;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 50;
}

.radar-sweep.active {
  opacity: 1;
}

.radar-sweep-line {
  position: absolute;
  width: var(--radar-sweep-length);
  height: 2px;
  top: 50%;
  left: 50%;
  transform-origin: left center;
  background: linear-gradient(90deg, transparent 0%, var(--radar-color) 30%, var(--radar-color) 100%);
  animation: radarSweep 2s linear infinite;
  box-shadow: 0 0 10px var(--radar-color), 0 0 20px var(--radar-color);
}

.radar-sweep-glow {
  position: absolute;
  /* Keep glow radius aligned with the sweep line length */
  width: calc(var(--radar-sweep-length) * 2);
  height: calc(var(--radar-sweep-length) * 2);
  inset: 0;
  margin: auto;
  background: conic-gradient(
    from 33deg ,
    transparent 0deg,
    rgba(96, 180, 248, 0.07) 20deg,
    rgba(96, 180, 248, 0.18) 40deg,
    transparent 60deg
  );
  animation: radarSweep 2s linear infinite;
  border-radius: 50%;
}

@keyframes radarSweep {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Radar sweep pulse effect at center */
.radar-sweep-pulse {
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--radar-color);
  animation: radarPulse 1s ease-out infinite;
  box-shadow: 0 0 10px var(--radar-color);
}

@keyframes radarPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

/* ====================================================
   Diagnosis Info Box Panel
   ==================================================== */
.diagnosis-detail {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 300px;
  background-color: var(--secondary-button-bg);
  border-radius: var(--border-radius);
  padding: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  z-index: 100;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.diagnosis-detail.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.diagnosis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.diagnosis-title {
  font-weight: 500;
  font-size: 1.1rem;
}

.diagnosis-risk {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.high-risk-tag {
  background-color: var(--high-risk);
  color: white;
}

.medium-risk-tag {
  background-color: var(--medium-risk);
  color: white;
}

.low-risk-tag {
  background-color: var(--low-risk);
  color: var(--primary-bg);
}

.diagnosis-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

/* Diagnosis info panel styling */
.diagnosis-info {
  position: absolute;
  background: var(--info-box-bg);
  color: var(--text-strong);
  padding: 1.25rem;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 1px 0 var(--info-box-border);
  width: 320px;
  cursor: grab;
  user-select: none;
  backdrop-filter: blur(18px) saturate(1.3);
  z-index: 1000;
  max-height: 85vh;
  overflow-y: auto;
  animation: infoBoxAppear 0.25s ease-out forwards;
  will-change: transform, left, top; /* Optimize for animation performance */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); /* Center initially */
  transition: transform 0.2s ease, box-shadow 0.2s ease; /* Keep transform transitions */
  overscroll-behavior: contain; /* Prevent scroll chaining */
  /* Improve mobile rendering */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y; /* Allow vertical scroll but disable other touch behaviors */
}

.diagnosis-info.dragging {
  transition: none; /* Disable transitions when dragging for smoother movement */
  opacity: 0.95; /* Slightly transparent while dragging */
}

.diagnosis-info:active {
  cursor: grabbing;
  transform: scale(1.01);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(100, 108, 255, 0.3);
}

.diagnosis-info h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-strong);
  display: flex;
  align-items: center;
}

.diagnosis-info h4 {
  margin: 15px 0 10px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-strong);
}

.diagnosis-info .info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.diagnosis-info .info-title-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diagnosis-info .close-info {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

.diagnosis-info .close-info:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-strong);
}

.diagnosis-info .risk-level {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  color: white;
}

.diagnosis-info .high-risk {
  background-color: #ff0000;
}

.diagnosis-info .medium-risk {
  background-color: #ffa500;
}

.diagnosis-info .low-risk {
    background-color: #008000;
}

.diagnosis-info h3::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.diagnosis-info[data-risk="High"] h3::before {
  background-color: var(--high-risk);
  box-shadow: 0 0 10px var(--high-risk);
}

.diagnosis-info[data-risk="Medium"] h3::before {
  background-color: var(--medium-risk);
  box-shadow: 0 0 10px var(--medium-risk);
}

.diagnosis-info[data-risk="Low"] h3::before {
  background-color: var(--low-risk);
  box-shadow: 0 0 10px var(--low-risk);
}

.diagnosis-info p {
  margin: 0.75rem 0;
  line-height: 1.5;
  font-size: 0.95rem;
  color: var(--text-medium);
}

.diagnosis-info p strong {
  color: var(--text-strong);
  font-weight: 500;
}

.diagnosis-info ul {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}

.diagnosis-info li {
  margin-bottom: 0.5rem;
  line-height: 1.4;
  font-size: 0.9rem;
  color: var(--text-medium);
}

.diagnosis-info-footer {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 0.75rem;
}

.diagnosis-info-button {
  flex: 1;
  padding: 0.6rem 0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.diagnosis-info-button.primary {
  background-color: var(--accent-color);
  color: white;
}

.diagnosis-info-button.secondary {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-strong);
}

.diagnosis-info-button:hover {
  transform: translateY(-1px);
}

.diagnosis-info-button.primary:hover {
  background-color: #7c82ff;
}

.diagnosis-info-button.secondary:hover {
  background-color: var(--button-hover-bg);
}

@keyframes infoBoxAppear {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ====================================================
   Log Panel
   ==================================================== */
.log-panel {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 2rem 1rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  transition: all 0.3s ease;
  height: 100%;
  overflow-y: auto;
  border: 1px solid var(--border-muted);
}

.log-header {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  color: var(--text-strong);
}

.log-entries {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: calc(100% - 3rem);
  overflow-y: auto;
}

.log-entry {
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.4;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.5rem;
  background-color: var(--log-entry-bg);
  justify-items: stretch;
  justify-content: space-between;
}

.log-entry.info {
  border-left: 3px solid #3b82f6;
}

.log-entry.warning {
  border-left: 3px solid #f59e0b;
}

.log-entry.error {
  border-left: 3px solid #ef4444;
}

.log-time {
  color: var(--text-muted);
  font-family: monospace;
}

.log-category {
  font-weight: 500;
  color: var(--text-medium);
}

.log-message {
  color: var(--text-strong);
}

/* ====================================================
   Differential Diagnosis Mode
   ==================================================== */
.differential-mode-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  position: absolute;
  bottom: 90px;
  align-items: flex-end;
  z-index: 100;
  gap: 0.5rem;
  max-width: calc(var(--chart-size) + 10rem);
  height: fit-content;
  transition: all 2s ease;
  pointer-events: auto;
}

.differential-mode-container.expanded {
  height: calc(100% - 6rem);
}

.differential-mode-container.expanded .diagnostic-box {
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: calc(var(--border-radius) * 2);
  background: var(--diff-box-bg, var(--card-bg));
  border: none;
  color: var(--text-medium);
  align-items: flex-start;
  overflow-y: auto;
  justify-content: flex-start;
  z-index: 100;
}

.action-button.active-mode {
  background-color: var(--accent-color);
  color: white;
}

#toggleDifferentialMode.active {
  background-color: #646cff;
  color: white;
}

/* Differential diagnosis boxes */
.diagnostic-box {
  width: 50%;
  min-height: 80px;
  height: 80px;
  background: var(--info-box-bg, rgba(255, 255, 255, 0.1));
  border: 1px solid var(--info-box-border, rgba(255, 255, 255, 0.2));
  border-radius: calc(var(--border-radius, 8px) * 2);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem 2.5rem;
  align-items: flex-start;
  justify-content: center;
  transition: all 1.2s cubic-bezier(0.85, 0, 0.15, 1);
  overflow-y: auto;
  max-height: 60vh;
  margin: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100; /* Ensure boxes appear over nodes */
}

.diff-header {
  padding: 10px;
  border-radius: 6px 6px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  margin: 0; /* Ensure no margin between header and content */
}

.diff-content {
  padding: 15px;
  background-color: var(--card-bg, rgba(255, 255, 255, 0.1));
  border-radius: 0 0 6px 6px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  margin: 0; /* Ensure no margin between header and content */
}

.diff-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 14px;
  line-height: 140%;
}

/* Differential diagnosis content */
p.diff-summary {
  min-height: 4rem;
  font-weight: 500;
  color: var(--text-strong);
}

.diagnostic-box h3 {
  display: flex;
  font-size: 14px;
  font-weight: 400;
  align-items: center;
  min-height: 5rem;
}

.diagnostic-box ul {
  padding-left: 1rem;
  margin: 0.75rem 0;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9em;
}

.diff-table th,
.diff-table td {
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--border-muted);
  text-align: left;
  vertical-align: top;
}

.diff-node {
  display: inline-block;
  vertical-align: middle;
  border-radius: 50%;
  margin-right: 8px;
  flex: 0 0 auto;
}

.diagnostic-box .diff-node.high-risk {
  background-color: var(--high-risk-semi);
  border: 1px solid var(--high-risk);
}

.diagnostic-box .medium-risk.diff-node {
  background-color: var(--medium-risk-semi);
  border: 1px solid var(--medium-risk);
}

.diagnostic-box .low-risk.diff-node {
  background-color: var(--low-risk-semi);
  border: 1px solid var(--low-risk);
}

/* ====================================================
   Animations & Utility Classes
   ==================================================== */
.hidden {
  display: none;
}

.fade-in {
  animation: fadeInContent 0.8s ease-in-out forwards;
  opacity: 0;
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ChatGPT Integration Styles */
.gpt-toggle.active {
  background-color: rgba(102, 184, 255, 0.2);
  color: var(--accent-color);
}

.gpt-toggle.active .icon-container {
  background-color: rgba(102, 184, 255, 0.3);
}

/* API Key Modal */
.api-key-input {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

.api-key-input input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--text-color);
  font-size: 14px;
}

/* ChatGPT Node */
.node.chatgpt-node {
  box-shadow: 0 0 10px rgba(106, 159, 255, 0.3);
}

/* Processing Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Differential Mode Styling */
.diff-header {
  padding: 10px;
  border-radius: 6px 6px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.diff-header h3 {
  margin: 0;
  font-size: 16px;
  color: white;
}

.diff-header.high-risk {
  background-color: rgba(255, 99, 71, 0.8);
}

.diff-header.medium-risk {
  background-color: rgba(255, 165, 0, 0.8);
}

.diff-header.low-risk {
  background-color: rgba(60, 179, 113, 0.8);
}

.risk-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  color: white;
}

.risk-badge.high-risk {
  background-color: rgb(255, 99, 71);
}

.risk-badge.medium-risk {
  background-color: rgb(255, 165, 0);
}

.risk-badge.low-risk {
  background-color: rgb(60, 179, 113);
}

.diff-summary {
  margin-bottom: 15px;
}

.systems-affected, .next-steps {
  margin-bottom: 12px;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  font-size: 13px;
}

.diff-table th, .diff-table td {
  padding: 8px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.diff-table th {
  background-color: rgba(var(--primary-rgb), 0.1);
  font-weight: bold;
}

/* Submit dropdown styles */
.submit-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 5px;
}

.submit-dropdown-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  position: relative;
}

.submit-dropdown-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--text-strong);
}

.submit-dropdown-button.gpt-active::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background-color: var(--accent-color);
  border-radius: 50%;
  border: 2px solid var(--primary-bg);
}

.submit-dropdown-menu {
  position: absolute;
  bottom: 50px;  /* Position above the button */
  left: -90px;    /* Center it */
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  width: 200px;
  z-index: 99999;
  overflow: hidden;
  display: none;
}

.submit-dropdown-menu::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  margin-left: -10px;
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: var(--primary-bg) transparent transparent transparent;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.submit-dropdown-menu.active {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: var(--text-strong);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-item.selected {
  background-color: rgba(100, 108, 255, 0.15);
  font-weight: 500;
}

.dropdown-item i {
  margin-right: 10px;
  color: var(--text-muted);
}

.dropdown-item.selected i {
  color: var(--accent-color);
}

/* ChatGPT toggle button */
.gpt-toggle-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.gpt-toggle-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--text-strong);
}

.gpt-toggle-button.active {
  background-color: var(--accent-color);
  color: white;
}

.submit-button.gpt-enabled {
  background-color: var(--accent-color);
}

.submit-button.gpt-enabled:hover {
  background-color: var(--accent-color-dark, #3a37a8);
}

.submit-button.gpt-enabled:active {
  transform: scale(0.95);
}

/* System response card styling */
.system-response {
  background-color: rgba(var(--accent-rgb), 0.1);
  border-left: 3px solid var(--accent-color);
  max-width: 90%;
}

.system-response-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 500;
  color: var(--accent-color);
}

.system-response-header i {
  color: var(--accent-color);
}

.system-response-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-strong);
}

.system-response-body h3 {
  font-size: 1.1rem;
  margin: 10px 0 5px;
  color: var(--text-strong);
}

.system-response-body h4 {
  font-size: 1rem;
  margin: 8px 0 4px;
  color: var(--text-strong);
}

.system-response-body h5 {
  font-size: 0.9rem;
  margin: 6px 0 3px;
  color: var(--text-strong);
}

.system-response-body strong {
  font-weight: 600;
}

.system-response-body em {
  font-style: italic;
}

/* Hide the ChatGPT button in sidebar */
.dropdown-header {
  padding: 10px 15px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-color);
  background-color: rgba(100, 108, 255, 0.08);
  border-bottom: 1px solid rgba(100, 108, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ChatGPT Integration Styles - Modern Design */
.chatgpt-style {
  position: relative;
  border-radius: 1rem !important;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
  padding-bottom: 2.5rem !important;
}

.chatgpt-style.gpt-active {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 1px var(--accent-color);
}

.chatgpt-style textarea {
  font-size: 1rem !important;
  line-height: 1.5 !important;
  min-height: 24px;
  max-height: 200px;
  padding-bottom: 0 !important;
}

.gpt-interface {
  position: absolute;
  left: 0;
  bottom: 0.5rem;
  width: 100%;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gpt-mode-selector {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gpt-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gpt-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Toggle Switch */
.gpt-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.gpt-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.gpt-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 34px;
}

.gpt-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: .4s;
  border-radius: 50%;
}

.gpt-switch input:checked + .gpt-slider {
  background-color: var(--accent-color);
}

.gpt-switch input:checked + .gpt-slider:before {
  transform: translateX(16px);
  background-color: white;
}

/* Updated Submit Button Styles */
.submit-button.gpt-enabled {
  background-color: var(--accent-color);
  border: none;
  color: white;
  transform: scale(1);
  transition: all 0.2s ease;
}

.submit-button.gpt-enabled:hover {
  background-color: var(--accent-color-dark, #3a37a8);
  transform: scale(1.05);
}

.submit-button.gpt-enabled:active {
  transform: scale(0.95);
}
.system-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* --- EMS Report Section Styles --- */
.ems-report-section {
  background: #f4faff;
  border-radius: 12px;
  padding: 18px 18px 12px 18px;
  margin: 24px 0 16px 0;
}
.ems-report-cards {
  display: flex;
  flex-direction: row;
  gap: 20px;
  justify-content: flex-start;
  align-items: stretch;
  margin-top: 10px;
}
.ems-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.04);
  padding: 22px 32px 18px 32px;
  min-width: 160px;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s;
}
.ems-card:hover {
  box-shadow: 0 4px 16px rgba(44, 62, 80, 0.10);
}
.ems-value {
  font-size: 1.6rem; /* slightly smaller */
  font-weight: 700;
  color: #22336b;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.ems-label {
  font-size: 0.85rem; /* slightly smaller */
  color: #4a5a7a;
  text-align: center;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-top: 4px; /* nudge label slightly lower */
}
@media (max-width: 700px) {
  .ems-report-cards {
    flex-direction: column;
    gap: 12px;
  }
  .ems-card {
    min-width: 0;
    width: 100%;
    padding: 18px 10px 14px 10px;
  }
}
/* --- End EMS Report Section Styles --- */

/* Settings Modal Styles */
.settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(3px);
}

.settings-content {
  background: var(--info-box-bg);
  color: var(--text-strong);
  width: 90%;
  max-width: 500px;
  max-height: 70vh;
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--info-box-border);
  backdrop-filter: blur(18px) saturate(1.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.settings-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 500;
}

.close-settings {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-settings:hover {
  background: var(--button-hover-bg);
  color: var(--text-strong);
}

.settings-body {
  padding: 2rem;
  overflow-y: auto;
}

.setting-group {
  margin-bottom: 1.5rem;
}

.setting-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-strong);
  font-size: 0.95rem;
}

.language-select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--text-strong);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.language-select:hover {
  border-color: var(--accent-color);
  background-color: var(--input-bg-active);
}

.language-select:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: var(--input-bg-active);
  box-shadow: 0 0 0 2px rgba(100, 108, 255, 0.2);
}

.language-select option {
  background-color: var(--primary-bg);
  color: var(--text-strong);
  padding: 8px;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-muted);
}

.save-settings-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.save-settings-btn:hover {
  background: #5a63e8;
  transform: translateY(-1px);
}

.save-settings-btn:active {
  transform: translateY(0);
}

/* Responsive settings modal */
@media (max-width: 768px) {
  .settings-content {
    width: 95%;
    max-height: 80vh;
  }
  
  .settings-header {
    padding: 1rem 1.5rem;
  }
  
  .settings-body {
    padding: 1.5rem;
  }
}

