/* PH Codes - Philippine Clinical Coding Reference */
/* Base styles */
* { box-sizing: border-box; }

/* Smooth scrolling */
html { scroll-behavior: smooth; }

/* Typography */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===================== BADGES ===================== */
.badge-icd10 {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: #ede9fe;
  color: #5b21b6;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.dark .badge-icd10 {
  background: rgba(91, 33, 182, 0.3);
  color: #c4b5fd;
}
.badge-rvs {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.dark .badge-rvs {
  background: rgba(29, 78, 216, 0.3);
  color: #93c5fd;
}

/* ===================== RESULT CARD ===================== */
.result-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: default;
}
.result-card:hover {
  border-color: #0ea5e9;
  box-shadow: 0 1px 8px rgba(14, 165, 233, 0.12);
}
.dark .result-card {
  background: #1f2937;
  border-color: #374151;
}
.dark .result-card:hover {
  border-color: #0ea5e9;
  box-shadow: 0 1px 8px rgba(14, 165, 233, 0.15);
}

/* ===================== FILTER BUTTONS ===================== */
.filter-btn {
  padding: 7px 18px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover {
  border-color: #0ea5e9;
  color: #0369a1;
}
.filter-btn.active {
  background: #0369a1;
  border-color: #0369a1;
  color: white;
}
.dark .filter-btn {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}
.dark .filter-btn:hover {
  border-color: #0ea5e9;
  color: #38bdf8;
}
.dark .filter-btn.active {
  background: #0369a1;
  border-color: #0369a1;
  color: white;
}

/* ===================== EXAMPLE PILLS ===================== */
.example-pill {
  display: inline-block;
  padding: 3px 10px;
  background: #f0f9ff;
  color: #0369a1;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  margin: 2px;
  cursor: pointer;
  border: 1px solid #bae6fd;
  transition: all 0.15s;
}
.example-pill:hover {
  background: #0369a1;
  color: white;
  border-color: #0369a1;
}
.dark .example-pill {
  background: rgba(3, 105, 161, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}
.dark .example-pill:hover {
  background: #0369a1;
  color: white;
}

/* ===================== ICON BUTTONS ===================== */
.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #9ca3af;
  border: none;
  background: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover {
  background: #f3f4f6;
  color: #374151;
}
.dark .btn-icon:hover {
  background: #374151;
  color: #e5e7eb;
}
.btn-icon.text-yellow-500 {
  color: #f59e0b;
}

/* ===================== SMALL BUTTONS ===================== */
.btn-sm {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-sm:hover {
  border-color: #0ea5e9;
  color: #0369a1;
}
.btn-sm-active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}
.dark .btn-sm {
  background: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}
.dark .btn-sm:hover {
  border-color: #0ea5e9;
  color: #38bdf8;
}
.dark .btn-sm-active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fbbf24;
}

/* ===================== SPECIALTY CARDS ===================== */
.specialty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 16px;
  text-decoration: none;
  color: #374151;
  transition: all 0.15s;
  text-align: center;
  gap: 4px;
}
.specialty-card:hover {
  border-color: var(--color, #0ea5e9);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
  color: var(--color, #0369a1);
}
.dark .specialty-card {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}
.dark .specialty-card:hover {
  border-color: var(--color, #0ea5e9);
  color: var(--color, #38bdf8);
}

/* ===================== FORM INPUTS ===================== */
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: white;
  color: #111827;
  font-size: 14px;
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus {
  border-color: #0ea5e9;
}
.dark .form-input {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}
.dark .form-input:focus {
  border-color: #0ea5e9;
}
textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

/* ===================== CODE DISPLAY ===================== */
.code-display {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* ===================== COPY TOAST ===================== */
#copyToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: white;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
#copyToast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===================== MODAL ===================== */
#codeModal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
#codeModal.show {
  display: flex;
}
#codeModalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}
#codeModalContent {
  position: relative;
  z-index: 1;
  background: white;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  border-radius: 24px 24px 0 0;
  overflow-y: auto;
  padding: 24px;
  padding-bottom: 40px;
}
.dark #codeModalContent {
  background: #1f2937;
  border-top: 1px solid #374151;
}
@media (min-width: 640px) {
  #codeModal {
    align-items: center;
  }
  #codeModalContent {
    border-radius: 20px;
    margin: 20px;
    max-height: 85vh;
  }
}

/* ===================== HIGHLIGHT ===================== */
.highlight {
  background: #fef08a;
  border-radius: 2px;
}
.dark .highlight {
  background: rgba(234, 179, 8, 0.3);
}

/* ===================== SEARCH LOADING ===================== */
.search-loading {
  text-align: center;
  padding: 32px;
  color: #9ca3af;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
.dark ::-webkit-scrollbar-thumb { background: #4b5563; }

/* ===================== SAFE AREA ===================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-card {
  animation: fadeIn 0.15s ease-out;
}

/* ===================== RECENT PILLS ===================== */
.recent-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 100px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}
.recent-pill:hover {
  background: #f0f9ff;
  border-color: #0ea5e9;
  color: #0369a1;
}
.dark .recent-pill {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}
.dark .recent-pill:hover {
  background: rgba(14, 165, 233, 0.1);
  border-color: #0ea5e9;
  color: #38bdf8;
}

/* ===================== NO RESULTS ===================== */
.no-results {
  text-align: center;
  padding: 48px 20px;
  color: #9ca3af;
}
.no-results i {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 12px;
}

/* Mobile: larger tap targets */
@media (max-width: 640px) {
  .btn-icon {
    width: 34px;
    height: 34px;
  }
}
