/* Patient Detail Page */
.patient-detail-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  overflow: hidden;
}

.pd-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  background: var(--navy-800);
  color: white;
}

.pd-header-info {
  flex: 1;
}

.pd-name {
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
}

.pd-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.pd-header .meta-chip {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  border: none;
}

.pd-header .allergy-tag,
.pd-header .nkda-tag {
  font-size: 12px;
}

.pd-header-stats {
  text-align: right;
  min-width: 220px;
}

.pd-header .vital-item {
  flex-direction: row;
  gap: 6px;
  align-items: center;
}

.pd-header .vital-label {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
}

.pd-header .vital-val {
  color: white;
  font-size: 12px;
}

.pd-header .vital-grid {
  grid-template-columns: repeat(auto-fill, minmax(100px,1fr));
  gap: 6px;
}

.pd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
}

.pd-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--slate-100);
}

.pd-section:last-child {
  border-bottom: none;
}

.pd-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.pd-summary-text,
.pd-inv-plan {
  font-size: 13.5px;
  color: var(--slate-700);
  line-height: 1.6;
  white-space: pre-wrap;
  background: var(--slate-50);
  border-radius: 6px;
  padding: 10px 14px;
  border: 1px solid var(--slate-200);
}

.pd-dx-list {
  margin: 0;
  padding: 0 0 0 20px;
}

.pd-dx-list li {
  margin-bottom: 8px;
  font-size: 13.5px;
}

.pd-dx-name {
  font-weight: 600;
  color: var(--navy-800);
}

.pd-dx-note {
  display: block;
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 2px;
  font-style: italic;
}

/* Patient name clickable link in list */
.patient-name-link {
  cursor: pointer;
  color: var(--navy-700);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.patient-name-link:hover {
  color: var(--blue-600, #2563eb);
  text-decoration-color: var(--blue-600, #2563eb);
}

/* Diagnosis autocomplete */
.dx-autocomplete-wrapper {
  position: relative;
}

.dx-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: white;
  border: 1px solid var(--slate-300);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  max-height: 200px;
  overflow-y: auto;
}

.dx-suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--slate-100);
}

.dx-suggestion-item:hover {
  background: var(--slate-50);
}

.dx-suggestion-item strong {
  color: var(--navy-800);
}

.dx-short {
  color: var(--slate-500);
  font-size: 12px;
}

.dx-code {
  color: var(--slate-400);
  font-size: 11px;
  font-family: monospace;
  margin-left: auto;
}

.diagnosis-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dx-note-input {
  font-size: 12px !important;
  padding: 4px 8px !important;
  resize: none;
}

#page-patient-form .diagnosis-row {
  grid-template-columns: 28px minmax(0, 1fr) 36px;
}

#page-patient-form .diagnosis-input-group {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 1fr);
  gap: 8px;
  align-items: center;
}

#page-patient-form .dx-name-input,
#page-patient-form .dx-note-input {
  height: 34px;
}

/* DC Print styles */
.patient-detail-print {
  display: none;
}

@media (min-width: 700px) and (max-width: 1024px) {
  .pd-header {
    gap: 14px;
    padding: 18px;
    flex-wrap: wrap;
  }

  .pd-name {
    font-size: 19px;
  }

  .pd-header-stats {
    min-width: unset;
    width: 100%;
    text-align: left;
  }

  .pd-header .vital-grid {
    grid-template-columns: repeat(3, minmax(90px, 1fr));
  }

  .pd-actions {
    padding: 14px 18px;
  }

  .pd-section {
    padding: 16px 18px;
  }
}

@media print {
  .printing-patient-detail .patient-detail-print {
    display: block;
  }
  .printing-patient-detail .main-content > *:not(.patient-detail-print) {
    display: none;
  }
  .printing-patient-detail .sidebar,
  .printing-patient-detail .topbar,
  .no-print {
    display: none !important;
  }
}

.dc-print-page {
  font-family: Arial, sans-serif;
  font-size: 11px;
  padding: 12mm;
  color: #111;
}

.dc-print-header {
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #000;
}

.dc-print-title {
  font-size: 14px;
  font-weight: bold;
}

.dc-print-subtitle {
  font-size: 12px;
  font-weight: bold;
  margin-top: 2px;
}

.dc-print-date {
  font-size: 10px;
  color: #555;
  margin-top: 4px;
}

.dc-info-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.dc-info-table td {
  border: 1px solid #ccc;
  padding: 4px 8px;
  font-size: 11px;
  width: 25%;
}

.dc-info-table td:first-child,
.dc-info-table td:nth-child(3) {
  background: #f4f4f4;
  font-weight: bold;
}

.dc-section-title {
  font-size: 12px;
  font-weight: bold;
  background: #e8e8e8;
  padding: 4px 8px;
  margin: 10px 0 6px;
}

.dc-dx-list {
  margin: 0;
  padding-left: 20px;
}

.dc-dx-list li {
  margin-bottom: 4px;
}

.dc-text {
  white-space: pre-wrap;
  margin: 0 0 8px;
  padding: 4px 8px;
  background: #fafafa;
  border: 1px solid #ddd;
}

.dc-med-table {
  width: 100%;
  border-collapse: collapse;
}

.dc-med-table th,
.dc-med-table td {
  border: 1px solid #ccc;
  padding: 4px 6px;
  font-size: 10px;
}

.dc-med-table th {
  background: #f0f0f0;
  font-weight: bold;
}

.dc-print-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 20mm;
  border-top: 1px solid #000;
  padding-top: 8px;
  font-size: 11px;
}
