html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: linear-gradient(180deg, #f6f7ff 0%, #eef6ff 40%, #ffffff 100%);
  color: #0f172a;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.aai-body .aai-navbar {
  background: linear-gradient(90deg, #4f46e5 0%, #2563eb 50%, #0ea5e9 100%);
  border-radius: 0 0 18px 18px;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.25);
}

.aai-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: transparent;
  border-radius: 6px;
}

.aai-hero-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.aai-hero {
  padding: 32px 24px;
  background: linear-gradient(120deg, #eef2ff 0%, #ecfeff 45%, #fef9c3 100%);
  border-radius: 22px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  box-shadow: 0 18px 35px rgba(99, 102, 241, 0.12);
}

.aai-card {
  border: 0;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.aai-accordion .accordion-item {
  border: 0;
  border-radius: 14px;
  margin-bottom: 14px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
}

.aai-section-header {
  padding: 14px 18px;
  font-weight: 700;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 14px 14px 0 0;
}

.aai-accordion .accordion-body {
  background-color: #ffffff;
  border-radius: 0 0 14px 14px;
}

.aai-section-title {
  color: #1d4ed8;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(90deg, #2563eb 0%, #0ea5e9 100%);
  border: none;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(90deg, #1d4ed8 0%, #0284c7 100%);
}

.form-select,
.form-control {
  border-radius: 12px;
  border-color: #dbeafe;
}

.form-check-input:checked {
  background-color: #2563eb;
  border-color: #2563eb;
}

.aai-progress {
  height: 10px;
  border-radius: 999px;
  background-color: #e2e8f0;
}

.aai-progress .progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e 0%, #0ea5e9 100%);
  color: transparent;
  font-size: 0;
  text-indent: -9999px;
  overflow: hidden;
}

.aai-score-list .list-group-item {
  border: 0;
  border-radius: 12px;
  background: #f8fafc;
  margin-bottom: 10px;
}

.results-export-container {
  text-align: center;
  margin-bottom: 20px;
}

.export-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
}

.export-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.export-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.export-btn i {
  margin-left: 8px;
}

.aai-results-with-image {
  display: flex;
  justify-content: center;
  margin: 40px auto;
  max-width: 1000px;
}

.chart-image-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
  border-radius: 16px;
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.1),
    inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.chart-background {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.1);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.chart-background:hover {
  transform: scale(1.01);
}

.chart-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.overlay-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


.speedometer-gauge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + 20px), calc(-50% + 10px));
  width: 280px;
  height: 280px;
  z-index: 3;
  overflow: visible;
  pointer-events: none;
  visibility: visible;
  opacity: 1;
}

.speedometer-gauge .gauge-svg {
  width: 100%;
  height: 100%;
  display: block;
  visibility: visible;
  opacity: 1;
}

.speedometer-gauge .gauge-background {
  transition: stroke-opacity 0.3s ease;
  opacity: 1;
}

.speedometer-gauge .gauge-progress {
  transition: stroke-dasharray 2s ease-in-out;
  animation: gaugeFill 2s ease-in-out;
  opacity: 1;
}

.speedometer-gauge .bacterial-colony {
  transition: opacity 0.5s ease-in-out;
}

@keyframes gaugeFill {
  from {
    stroke-dasharray: 0 754.0;
  }
}

@keyframes colonyPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.score-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + 26px), calc(-50% + 10px));
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 90%;
  pointer-events: none;
}

.overlay-score {
  font-size: 4rem;
  font-weight: 900;
  color: #0f172a;
  text-shadow: 
    0 5px 15px rgba(255, 255, 255, 1),
    0 0 25px rgba(255, 255, 255, 0.95),
    0 3px 8px rgba(0, 0, 0, 0.35),
    0 0 35px rgba(255, 255, 255, 0.9);
  font-family: "Georgia", "Times New Roman", serif;
  background: none;
  border: none;
  width: auto;
  height: auto;
  line-height: 1.2;
  transition: all 0.3s ease;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  position: relative;
  letter-spacing: 2px;
  display: inline-flex;
  align-items: baseline;
}

.overlay-score .score-value,
.overlay-score .score-separator,
.overlay-score .score-max {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1.2;
  display: inline-block;
}

.overlay-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #475569;
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 15px rgba(255, 255, 255, 0.85),
    0 2px 4px rgba(0, 0, 0, 0.25);
  font-family: "Georgia", "Times New Roman", serif;
  margin-top: 8px;
  letter-spacing: 1px;
  text-align: center;
}

.overlay-score:hover {
  transform: scale(1.05);
  color: #0f172a;
  text-shadow: 
    0 4px 10px rgba(255, 255, 255, 1),
    0 0 16px rgba(255, 255, 255, 0.95),
    0 3px 6px rgba(0, 0, 0, 0.2);
}

.overlay-value {
  font-size: 3.5rem;
  font-weight: 900;
  font-family: "Segoe UI", "Arial", sans-serif;
  background: none;
  border: none;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
  line-height: 1;
  padding: 0;
  margin: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Color-coded values matching result2.jpg circle colors exactly */
.overlay-value[data-index="0"] {
  color: #f97316; /* Orange - MIC value (Top) */
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(249, 115, 22, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(249, 115, 22, 0.4);
}

.overlay-value[data-index="1"] {
  color: #9333ea; /* Purple - Bacterial spectrum (Top-Left area) */
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(147, 51, 234, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(147, 51, 234, 0.4);
}

.overlay-value[data-index="2"] {
  color: #1e3a8a; /* Dark Blue - Mechanism of action (Right) */
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(30, 58, 138, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(30, 58, 138, 0.4);
}

.overlay-value[data-index="3"] {
  color: #84cc16; /* Lime Green - Type of action (Bottom-Right) */
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(132, 204, 22, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(132, 204, 22, 0.4);
}

.overlay-value[data-index="4"] {
  color: #06b6d4; /* Light Blue/Cyan - Integration/Nanotechnology (Bottom-Left) */
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(6, 182, 212, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(6, 182, 212, 0.4);
}

.overlay-value[data-index="5"] {
  color: #14b8a6; /* Teal Green - Integration of nechomolotigy (Left) */
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(20, 184, 166, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(20, 184, 166, 0.4);
}

.overlay-value[data-index="6"] {
  color: #3b82f6; /* Medium Blue - Time-Kill Kinetics (Top-Left) */
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(59, 130, 246, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(59, 130, 246, 0.4);
}

.overlay-value[data-index="7"] {
  color: #fbbf24; /* Light Green/Yellow - Cost (Bottom) */
  text-shadow: 
    0 3px 8px rgba(255, 255, 255, 0.95),
    0 0 12px rgba(251, 191, 36, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(251, 191, 36, 0.4);
}

.overlay-value:hover {
  transform: translate(-50%, -50%) scale(1.2) !important;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3)) brightness(1.1);
  z-index: 6;
}

/* Enhanced glow on hover matching circle colors */
.overlay-value[data-index="0"]:hover {
  text-shadow: 
    0 4px 12px rgba(255, 255, 255, 1),
    0 0 20px rgba(249, 115, 22, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(249, 115, 22, 0.6);
}

.overlay-value[data-index="1"]:hover {
  text-shadow: 
    0 4px 12px rgba(255, 255, 255, 1),
    0 0 20px rgba(147, 51, 234, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(147, 51, 234, 0.6);
}

.overlay-value[data-index="2"]:hover {
  text-shadow: 
    0 4px 12px rgba(255, 255, 255, 1),
    0 0 20px rgba(30, 58, 138, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(30, 58, 138, 0.6);
}

.overlay-value[data-index="3"]:hover {
  text-shadow: 
    0 4px 12px rgba(255, 255, 255, 1),
    0 0 20px rgba(132, 204, 22, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(132, 204, 22, 0.6);
}

.overlay-value[data-index="4"]:hover {
  text-shadow: 
    0 4px 12px rgba(255, 255, 255, 1),
    0 0 20px rgba(6, 182, 212, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(6, 182, 212, 0.6);
}

.overlay-value[data-index="5"]:hover {
  text-shadow: 
    0 4px 12px rgba(255, 255, 255, 1),
    0 0 20px rgba(20, 184, 166, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(20, 184, 166, 0.6);
}

.overlay-value[data-index="6"]:hover {
  text-shadow: 
    0 4px 12px rgba(255, 255, 255, 1),
    0 0 20px rgba(59, 130, 246, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(59, 130, 246, 0.6);
}

.overlay-value[data-index="7"]:hover {
  text-shadow: 
    0 4px 12px rgba(255, 255, 255, 1),
    0 0 20px rgba(251, 191, 36, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(251, 191, 36, 0.6);
}

.aai-circular-results {
  position: relative;
  width: 600px;
  height: 600px;
  margin: 40px auto;
  max-width: 100%;
}

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

.chart-segment {
  transition: all 0.3s ease;
}

.chart-segment:hover {
  opacity: 0.9 !important;
}

.segment-icon-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

.segment-icon-wrapper i {
  font-size: 32px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  display: block;
}

.segment-icon-wrapper i.bi-leaf {
  font-size: 38px;
  background: linear-gradient(180deg, #047857 0%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  display: block;
}

.segment-label-text {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  font-family: "Segoe UI", Arial, sans-serif;
}

.segment-value-text {
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  font-family: "Segoe UI", Arial, sans-serif;
}

.circular-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
  z-index: 10;
  border: 4px solid white;
  padding: 15px;
  box-sizing: border-box;
}

.center-icon {
  font-size: 2rem;
  color: #fbbf24;
  margin-bottom: 3px;
  line-height: 1;
}

.center-score {
  font-size: 2.5rem;
  font-weight: 900;
  color: white;
  line-height: 1;
  margin: 2px 0;
}

.center-max {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  line-height: 1;
  margin: 2px 0;
}

.center-classification {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.values-sidebar {
  position: relative;
  min-width: 100px;
  height: 600px;
}

.value-item {
  display: flex;
  align-items: center;
  gap: 12px;
  position: absolute;
  cursor: pointer;
  transition: all 0.3s ease;
}

.value-item:hover {
  transform: translateY(-50%) scale(1.1) !important;
}

.value-line {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.7) 0%, rgba(118, 75, 162, 0.5) 100%);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.value-number {
  font-size: 2rem;
  font-weight: 900;
  color: #374151;
  min-width: 50px;
  text-align: left;
  font-family: "Segoe UI", Arial, sans-serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .aai-results-with-values {
    flex-direction: column;
    gap: 20px;
  }
  
  .values-sidebar {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    padding: 20px;
  }
  
  .value-item {
    position: relative !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
  }
  
  .aai-circular-results {
    width: 100%;
    height: auto;
    min-height: 500px;
  }
  
  .circular-chart {
    width: 100%;
    height: auto;
    min-height: 500px;
  }
  
  .circular-center {
    width: 180px;
    height: 180px;
  }
  
  .center-score {
    font-size: 2rem;
  }
  
  .center-icon {
    font-size: 1.5rem;
  }

  /* Responsive styles for chart image and gauge */
  .chart-image-wrapper {
    padding: 10px;
    max-width: 100%;
    position: relative;
  }

  .chart-background {
    width: 100%;
    height: auto;
    position: relative;
  }

  .chart-background:hover {
    transform: none;
  }

  .chart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
  }

  .overlay-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
  }

  .speedometer-gauge {
    width: 144px !important;
    height: 144px !important;
    min-width: 144px !important;
    min-height: 144px !important;
    transform: translate(calc(-50% + 10px), calc(-50% + 5px)) !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
  }

  .speedometer-gauge .gauge-svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .score-container {
    transform: translate(calc(-50% + 13px), calc(-50% + 5px)) !important;
    max-width: 80% !important;
  }

  .overlay-score {
    font-size: 2.5rem !important;
    letter-spacing: 1px !important;
  }

  .overlay-score .score-value,
  .overlay-score .score-separator,
  .overlay-score .score-max {
    font-size: 2.5rem !important;
  }

  .overlay-title {
    font-size: 1.1rem !important;
    letter-spacing: 0.5px !important;
  }

  .overlay-value {
    font-size: 2.5rem !important;
  }
}

@media (max-width: 480px) {
  .chart-image-wrapper {
    padding: 8px;
  }

  .speedometer-gauge {
    width: 115px !important;
    height: 115px !important;
    min-width: 115px !important;
    min-height: 115px !important;
    transform: translate(calc(-50% + 8px), calc(-50% + 4px)) !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
  }

  .speedometer-gauge .gauge-svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .score-container {
    transform: translate(calc(-50% + 10px), calc(-50% + 4px)) !important;
    max-width: 70% !important;
  }

  .overlay-score {
    font-size: 2rem !important;
    letter-spacing: 0.5px !important;
  }

  .overlay-score .score-value,
  .overlay-score .score-separator,
  .overlay-score .score-max {
    font-size: 2rem !important;
  }

  .overlay-title {
    font-size: 0.9rem !important;
    letter-spacing: 0.3px !important;
    margin-top: 4px !important;
  }

  .overlay-value {
    font-size: 2rem !important;
  }
}

@media (max-width: 360px) {
  .speedometer-gauge {
    width: 101px !important;
    height: 101px !important;
    min-width: 101px !important;
    min-height: 101px !important;
    transform: translate(calc(-50% + 6px), calc(-50% + 3px)) !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
  }

  .speedometer-gauge .gauge-svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .score-container {
    transform: translate(calc(-50% + 8px), calc(-50% + 3px)) !important;
  }

  .overlay-score {
    font-size: 1.75rem !important;
  }

  .overlay-score .score-value,
  .overlay-score .score-separator,
  .overlay-score .score-max {
    font-size: 1.75rem !important;
  }

  .overlay-title {
    font-size: 0.8rem !important;
  }

  .overlay-value {
    font-size: 1.75rem !important;
  }
}