/* ==============================================================
   Barkoba Medical Record — minimalist stylesheet for veterinarians
   Design goals: high readability, generous whitespace, print-ready.
   ============================================================== */

:root {
  --c-bg: #fafafa;
  --c-surface: #ffffff;
  --c-text: #1a1a1a;
  --c-muted: #666;
  --c-border: #e5e5e5;
  --c-accent: #2c5f7d;
  --c-accent-soft: #eaf2f6;
  --c-warn: #b85c00;
  --c-warn-soft: #fff4e6;
  --c-danger: #b22222;
  --c-danger-soft: #fdecec;
  --c-ok: #2d6a3e;
  --c-ok-soft: #ecf5ee;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --maxw: 1080px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* -------- Header -------- */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.brand h1 {
  font-size: 1.4rem;
  margin: 0;
  letter-spacing: -0.01em;
}
.brand .subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--c-muted);
}
.paw {
  font-size: 1.6rem;
  line-height: 1;
}
.primary-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.primary-nav a {
  text-decoration: none;
  color: var(--c-text);
  font-size: 0.9rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.primary-nav a:hover {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}

/* -------- Main / Cards -------- */
main {
  padding: 2rem 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.75rem;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--c-accent);
  border-bottom: 2px solid var(--c-accent-soft);
  padding-bottom: 0.5rem;
}
.card .muted {
  color: var(--c-muted);
  font-size: 0.88rem;
  margin: 0.5rem 0 1rem;
}
.subhead {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--c-text);
}

/* -------- Profile -------- */
.profile-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.photo-placeholder {
  width: 180px;
  height: 180px;
  background: var(--c-accent-soft);
  border: 1px dashed var(--c-accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-accent);
  font-size: 0.85rem;
}
.profile-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem 1.5rem;
}
.profile-list dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-muted);
  margin-top: 0.5rem;
}
.profile-list dd {
  margin: 0.1rem 0 0;
  font-weight: 500;
}

/* -------- Alerts -------- */
.alert {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.92rem;
  border-left: 4px solid;
}
.alert-warn {
  background: var(--c-warn-soft);
  border-color: var(--c-warn);
  color: #5a2e00;
}
.alert-warn strong { color: var(--c-warn); }
.alert ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.alert:empty { display: none; }

/* -------- Diagnoses -------- */
.diagnoses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.diagnosis {
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-accent);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: #fff;
}
.diagnosis.cardiac { border-left-color: var(--c-danger); }
.diagnosis.renal   { border-left-color: var(--c-accent); }
.diagnosis.hema    { border-left-color: #7a3e9d; }
.diagnosis.infect  { border-left-color: var(--c-warn); }
.diagnosis.other   { border-left-color: var(--c-muted); }

.diagnosis h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.diagnosis .tag {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  margin-right: 0.3rem;
}
.diagnosis.cardiac .tag { background: var(--c-danger-soft); color: var(--c-danger); }
.diagnosis.hema    .tag { background: #f1e8f7; color: #7a3e9d; }
.diagnosis.infect  .tag { background: var(--c-warn-soft); color: var(--c-warn); }
.diagnosis p { margin: 0.4rem 0 0; font-size: 0.9rem; }
.diagnosis .meta { color: var(--c-muted); font-size: 0.8rem; margin-top: 0.4rem; }

/* -------- Tables -------- */
.table-wrap {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.data-table th {
  background: #f5f5f5;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-muted);
}
.data-table tbody tr:hover { background: #fafafa; }
.flag-high { color: var(--c-danger); font-weight: 600; }
.flag-low  { color: var(--c-warn); font-weight: 600; }
.flag-ok   { color: var(--c-ok); }

/* -------- Timeline -------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--c-border);
}
.timeline li {
  position: relative;
  padding: 0.5rem 0 1.25rem 2rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 3px solid var(--c-accent);
}
.timeline li.hosp::before { border-color: var(--c-danger); }
.timeline li.lab::before  { border-color: #7a3e9d; }
.timeline li .t-date {
  font-size: 0.78rem;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.timeline li .t-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0.1rem 0 0.25rem;
}
.timeline li .t-clinic {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.4rem;
}
.timeline li.hosp .t-clinic { background: var(--c-danger-soft); color: var(--c-danger); }
.timeline li p { margin: 0.25rem 0 0; font-size: 0.92rem; }
.timeline li .t-link {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--c-accent);
  text-decoration: none;
}
.timeline li .t-link:hover { text-decoration: underline; }

/* -------- Documents -------- */
.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.6rem;
}
.doc-list li a {
  display: block;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--c-text);
  font-size: 0.9rem;
  transition: border-color 0.15s, background 0.15s;
}
.doc-list li a:hover {
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}
.doc-list li small {
  display: block;
  color: var(--c-muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

/* -------- Footer -------- */
.site-footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  padding: 1.25rem 0;
  margin-top: 2rem;
}
.site-footer p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--c-muted);
  text-align: center;
}

/* -------- Responsive -------- */
@media (max-width: 720px) {
  .header-row { padding: 0.8rem 1rem; }
  .brand h1 { font-size: 1.2rem; }
  .brand .subtitle { font-size: 0.75rem; }
  .primary-nav { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .profile-grid { grid-template-columns: 1fr; }
  .photo-placeholder { width: 100%; height: 200px; }
  .card { padding: 1.1rem 1rem 1.25rem; }
  .card h2 { font-size: 1.1rem; }
}

/* -------- Print -------- */
@media print {
  .site-header, .primary-nav, .site-footer { display: none; }
  body { background: white; }
  .card {
    border: none;
    box-shadow: none;
    page-break-inside: avoid;
    padding: 0.5rem 0 1rem;
  }
  .card h2 {
    border-bottom: 1px solid #000;
    color: #000;
  }
  a { color: #000; text-decoration: none; }
  .timeline li { page-break-inside: avoid; }
}
