/* Spinner/Loader */
.loader {
  border: 5px solid #f3f3f3;
  border-radius: 50%;
  border-top: 5px solid #3B82F6;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Progress Circle */
.progress-circle {
  position: relative;
  width: 130px;
  height: 130px;
}
.progress-circle-bg {
  fill: none;
  stroke: #e6e6e6;
  stroke-width: 8;
}
.progress-circle-prog {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: bold;
}

/* Risk levels */
.stroke-high-risk {
  stroke: #A52A2A;
}
.stroke-medium-risk {
  stroke: #F59E0B;
}
.stroke-low-risk {
  stroke: #10B981;
}
.text-high-risk {
  color: #A52A2A;
}
.text-medium-risk {
  color: #F59E0B;
}
.text-low-risk {
  color: #10B981;
}

/* Progress Bars */
.progress-bar {
  height: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  transition: width 0.5s ease-in-out;
}
.progress-bar-a {
  background-color: #A52A2A;
}
.progress-bar-aa {
  background-color: #d05252;
}
.progress-bar-aaa {
  background-color: #ea8a8a;
}
.progress-bar-high {
  background-color: #A52A2A;
}
.progress-bar-med {
  background-color: #F59E0B;
}
.progress-bar-low {
  background-color: #10B981;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #3B82F6;
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Chart styling */
.chart-container {
  height: 200px;
  width: 100%;
  position: relative;
}
.chart-y-axis {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 40px;
  padding: 10px 0;
}
.chart-y-axis span {
  font-size: 10px;
  color: #666;
}
.chart-area {
  position: absolute;
  left: 40px;
  right: 0;
  top: 0;
  bottom: 20px;
  background: linear-gradient(to bottom, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0) 100%);
  border-left: 1px solid #ddd;
}
.chart-x-axis {
  position: absolute;
  left: 40px;
  right: 0;
  bottom: 0;
  height: 20px;
  display: flex;
  justify-content: space-between;
}
.chart-x-axis span {
  font-size: 10px;
  color: #666;
  transform: rotate(-45deg);
  transform-origin: top left;
  white-space: nowrap;
  margin-top: 5px;
}
.chart-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background-color: rgba(220, 220, 220, 0.5);
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 350px;
  background: white;
  color: #333;
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  transition: opacity 0.3s ease-out;
}
.toast-success {
  border-left: 4px solid #10B981;
}
.toast-error {
  border-left: 4px solid #EF4444;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Chart data points and lines */
.chart-data-point {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #3B82F6;
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 2;
}
.chart-data-point:hover {
  transform: translate(-50%, -50%) scale(1.5);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}
.chart-line-segment {
  position: absolute;
  height: 2px;
  background-color: #3B82F6;
  transform-origin: 0 0;
  z-index: 1;
}

/* Tooltip styles */
.tooltip-trigger {
  position: relative;
}
.tooltip {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #374151;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #374151 transparent transparent transparent;
}
.tooltip-trigger:hover .tooltip {
  opacity: 1;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

/* Responsive improvements */
@media (max-width: 768px) {
  .progress-circle {
    width: 100px;
    height: 100px;
  }
  .progress-text {
    font-size: 1.5rem;
  }
}

/* Accessibility improvements */
button:focus, a:focus, input:focus, select:focus {
  outline: 2px solid #3B82F6;
  outline-offset: 2px;
}

/* Add focus indication for keyboard navigation */
.keyboard-focus-visible:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Button hover effects */
.btn-hover-effect {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-hover-effect:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Table row hover effects */
tr:hover td {
  background-color: rgba(243, 244, 246, 0.5);
}

/* Improved form element focus styles */
input:focus, select:focus {
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}