body {
  background-color: #f8f9fa;
  color: #333;
}

.card {
  border-radius: 15px;
  border: none;
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-5px);
}

.recommendation-item {
  background-color: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 15px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.recommendation-item:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.relevancy-badge {
  background-color: #28a745;
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.9em;
}

.copy-btn {
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.copy-btn:hover {
  background-color: #5a6268;
}

.code-section {
  font-family: monospace;
  font-size: 1.1em;
  color: #0066cc;
}

.description-section {
  color: #495057;
  font-size: 1.1em;
}

.loading {
  display: none;
  text-align: center;
  padding: 20px;
}

/* Enhanced Loading Animation Styles */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  margin: 2rem auto;
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 100%;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #f3f3f3;
  border-radius: 50%;
  border-top: 4px solid #0066cc;
  animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  margin-bottom: 1.5rem;
}

.loading-text {
  color: #0066cc;
  font-size: 1.2rem;
  font-weight: 500;
  text-align: center;
  margin-top: 1rem;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading-dots::after {
  content: "...";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60% {
    content: "...";
  }
  80%,
  100% {
    content: "";
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #28a745;
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  display: none;
}

.btn-primary {
  background-color: #0066cc;
  border: none;
  padding: 12px 25px;
  font-weight: 500;
}

.btn-primary:hover {
  background-color: #0052a3;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-10px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading Animation */
@keyframes loadingDots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60%,
  100% {
    content: "...";
  }
}

.loading-container {
  text-align: center;
  padding: 2rem;
  animation: fadeIn 0.3s ease-out;
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #e8f1ff;
  border-radius: 50%;
  border-top-color: #0066ff;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.loading-text {
  color: #4b5563;
  font-size: 0.875rem;
}

.loading-dots::after {
  content: "";
  animation: loadingDots 1.5s infinite;
}

/* Recommendation Cards */
.recommendation-card {
  position: relative;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease-out;
}

.recommendation-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Kartu yang popover tarifnya terbuka (hover/klik) harus di atas kartu
   lain — transform saat :hover membuat stacking context, jadi z-index
   perlu diangkat di level kartu, bukan hanya di wrap pill-nya. */
.recommendation-card:hover,
.recommendation-card:has(.tariff-wrap.open) {
  z-index: 100;
}

/* Relevancy Bar */
.relevancy-bar {
  height: 6px;
  background-color: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.relevancy-bar-fill {
  height: 100%;
  background-color: #0066ff;
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Copy Button */
.copy-button {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: #4b5563;
  background-color: #f3f4f6;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.copy-button:hover {
  background-color: #e5e7eb;
  color: #1f2937;
}

.copy-button.copied {
  background-color: #d1fae5;
  color: #065f46;
}

/* Tab Transitions */
.recommendations-container {
  display: none;
  animation: slideIn 0.3s ease-out;
}

.recommendations-container.active {
  display: block;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6b7280;
  animation: fadeIn 0.3s ease-out;
}

.empty-state-icon {
  font-size: 2.5rem;
  color: #9ca3af;
  margin-bottom: 1rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 1rem;
  background-color: #1f2937;
  color: white;
  border-radius: 0.5rem;
  animation: fadeIn 0.3s ease-out;
  z-index: 50;
}

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

/* Badge Components */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

/* Inline Lucide Icons */
.inline-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  display: inline-block;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde047;
}

.badge-info {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

/* Warning Box */
.warning-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem;
  background-color: #fef3c7;
  border: 1px solid #fde047;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #92400e;
  animation: fadeIn 0.3s ease-out;
}

.warning-box i {
  flex-shrink: 0;
  font-size: 1rem;
}

/* Enhanced Card Background for Restricted Codes */
.recommendation-card.bg-yellow-50 {
  background-color: #fffbeb;
  border-color: #fde047;
}

/* Footer Styles */
.text-muted-foreground {
  color: #6b7280;
}

.space-y-3 > * + * {
  margin-top: 0.75rem;
}

footer {
  background-color: white;
  border-color: #e5e7eb;
  margin-top: 3rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

footer p {
  line-height: 1.5;
}

/* Analytics Modal */
#analytics-modal {
  animation: fadeIn 0.2s ease-out;
}

#analytics-modal > div > div {
  animation: slideUp 0.3s ease-out;
}

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

.analytics-tab {
  transition: all 0.2s ease;
}

.analytics-tab:hover {
  opacity: 0.9;
}

/* Details/Summary styling */
details summary::-webkit-details-marker {
  display: none;
}

details summary {
  list-style: none;
}

details summary::before {
  content: "+ ";
  font-weight: bold;
}

details[open] summary::before {
  content: "- ";
}

/* ==========================================
   ESTIMASI TARIF (pill + popover)
   ========================================== */

.tariff-wrap {
  position: relative;
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
  cursor: pointer;
}

/* Saat popover terbuka, angkat wrap di atas kartu/pill lain agar popover
   tidak tertimpa elemen yang datang setelahnya di DOM. */
.tariff-wrap:hover,
.tariff-wrap.open {
  z-index: 100;
}

.tariff-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tariff-wrap:hover .tariff-pill {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.18);
}

.tariff-pill .inline-icon {
  width: 14px;
  height: 14px;
}

.tariff-pill .tariff-info {
  opacity: 0.6;
}

/* Popover */
.tariff-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 50;
  width: 320px;
  max-width: 82vw;
  text-align: left;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  padding: 14px 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s;
}

.tariff-wrap:hover .tariff-popover,
.tariff-wrap.open .tariff-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tp-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}

.tp-amt {
  font-size: 20px;
  font-weight: 800;
  color: #047857;
  margin-top: 2px;
  line-height: 1.2;
}

.tp-amt .tp-range {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
}

.tp-cbg {
  font-size: 12px;
  color: #374151;
  margin-top: 4px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #e5e7eb;
}

.tp-section {
  margin-top: 8px;
}

.tp-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #9ca3af;
  margin-bottom: 3px;
}

.tp-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tp-section li {
  font-size: 12.5px;
  color: #374151;
  line-height: 1.5;
  padding: 1px 0;
}

.pop-code {
  font-family: "Courier New", monospace;
  font-weight: 700;
  color: #1e3a8a;
  background: #eff6ff;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

.pop-effect {
  color: #b45309;
  font-weight: 600;
  font-size: 11.5px;
}

.severity-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #94a3b8;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
}

.tp-hint {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: #92400e;
  background: #fffbeb;
  border-left: 2px solid #f59e0b;
  padding: 5px 8px;
  border-radius: 0 4px 4px 0;
}

.tp-note {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
  font-size: 10.5px;
  line-height: 1.45;
  color: #9ca3af;
}

/* ==========================================
   PENANDA RUMAH SAKIT & PAKET RAWAT JALAN
   ========================================== */

/* Dipakai saat beberapa RS diuji bergantian dalam satu sesi. Penanda ini
   sengaja kontras: kekeliruan yang paling mahal di demo bukan angka yang
   salah, melainkan angka RS lain yang tampil tanpa ada yang menyadarinya. */
.hospital-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 9999px;
  font-size: 0.8125rem;
  line-height: 1.3;
}
.hospital-badge-sub {
  color: #3b6bb5;
  border-left: 1px solid #bfdbfe;
  padding-left: 0.5rem;
}

.paket-rajal {
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.paket-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #047857;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.paket-amt {
  font-size: 1.75rem;
  font-weight: 700;
  color: #064e3b;
  margin: 0.35rem 0 0.15rem;
}
.paket-cbg {
  font-size: 0.875rem;
  color: #065f46;
}
.paket-note {
  font-size: 0.75rem;
  color: #4b7c6b;
  margin-top: 0.6rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .hospital-badge {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    border-radius: 0.75rem;
  }
  .hospital-badge-sub {
    border-left: 0;
    padding-left: 0;
  }
}

/* ==========================================
   PILIHAN JENIS & KELAS RAWAT
   ========================================== */

.episode-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.episode-label {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.episode-group {
  display: inline-flex;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  overflow: hidden;
  background: #fff;
}
.episode-opt {
  padding: 0.3rem 0.85rem;
  font-size: 0.8125rem;
  color: #374151;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.episode-opt + .episode-opt {
  border-left: 1px solid #e5e7eb;
}
.episode-opt:hover {
  background: #f3f4f6;
}
.episode-opt.is-active {
  background: #1d4ed8;
  color: #fff;
}
/* Kelas rawat tidak memengaruhi tarif rawat jalan. Diredupkan, bukan
   disembunyikan: pilihan yang hilang membuat orang mengira ada yang rusak. */
.episode-kelas.is-muted {
  opacity: 0.45;
}
.episode-hint {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.4rem;
}

/* Estimasi rawat jalan yang kosong: dijelaskan, bukan dibiarkan senyap. */
.paket-kosong {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: #7c2d12;
  line-height: 1.55;
}
