/* Radabase — shared styles for every page on the site.
   One file so a visual change (colors, spacing, the header) only needs to
   happen once instead of being kept in sync across pages. */

:root {
  --brand: #1a5fb4;
  --brand-dark: #164c8f;
  --brand-light: #eaf2ff;
  --bg: #f6f7fb;
  --card-bg: #ffffff;
  --border: #e6e8ee;
  --text: #1c2230;
  --text-muted: #626a7a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-hover: 0 4px 10px rgba(16, 24, 40, 0.06), 0 10px 24px rgba(16, 24, 40, 0.10);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  max-width: 720px;
  margin: 40px auto 64px;
  padding: 0 16px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ---------------------------------------------------------------- header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.site-header .brand {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--brand);
  text-decoration: none;
}
.site-header nav a {
  margin-left: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-header nav a:hover { color: var(--brand); }
.site-header nav a.active { color: var(--brand); font-weight: 700; }

h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 4px; }
p.sub { color: var(--text-muted); font-size: 14px; margin-top: 0; }

/* ----------------------------------------------------------------- forms */

label { display: block; font-weight: 600; font-size: 14px; margin: 18px 0 6px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  font-family: inherit;
  background: var(--card-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.15);
}
textarea { min-height: 70px; }

#search {
  margin: 4px 0 24px;
  padding: 12px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.toolbar #search { margin: 4px 0 14px; flex: 1 1 200px; }
.toolbar #sort { width: auto; margin: 4px 0 14px; flex: 0 0 150px; }

#modalityFilters { margin: 0 0 20px; }

/* -------------------------------------------------------------- dictation */

.dictate-box {
  background: var(--brand-light);
  border: 1px solid #b9d6f2;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 20px 0 8px;
}
.dictate-box .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#dictateBtn {
  margin-top: 0;
  background: var(--card-bg);
  color: var(--brand);
  border: 1px solid var(--brand);
}
#dictateBtn:hover { background: var(--brand-light); }
#dictateBtn.recording {
  background: #b3382c;
  color: white;
  border-color: #b3382c;
  animation: dictate-pulse 1.4s infinite;
}
@keyframes dictate-pulse {
  0% { box-shadow: 0 0 0 0 rgba(179, 56, 44, .35); }
  70% { box-shadow: 0 0 0 8px rgba(179, 56, 44, 0); }
  100% { box-shadow: 0 0 0 0 rgba(179, 56, 44, 0); }
}
.transcript-box {
  background: var(--card-bg);
  border: 1px solid #cfe3f5;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.5;
  min-height: 40px;
}
#applyDictationBtn { margin-top: 10px; }
.autofilled { background: #fbf1e0 !important; border-color: #b9720b !important; }

/* ------------------------------------------------------------- chips (modality) */

.chipgroup {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.chip input { width: auto; margin: 0; cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.chip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: white; }
.chip.autofilled { background: #fbf1e0; border-color: #b9720b; color: var(--text); }
.chip.autofilled:has(input:checked) { background: #fbf1e0; border-color: #b9720b; color: var(--text); }

button {
  margin-top: 20px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: white;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
button:hover { background: var(--brand-dark); }
button:active { transform: translateY(1px); }
button.btn-secondary { background: #6b7280; margin-left: 8px; }
button.btn-secondary:hover { background: #565d69; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-google:hover { background: var(--bg); border-color: #c7cad3; }

.or-divider {
  position: relative;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin: 22px 0 6px;
}
.or-divider::before, .or-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  border-top: 1px solid var(--border);
}
.or-divider::before { left: 0; }
.or-divider::after { right: 0; }

.my-case-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--card-bg);
}
.my-case-info { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.my-case-info strong { font-size: 14px; }
.my-case-row button { margin-top: 0; white-space: nowrap; flex: none; }

.status { padding: 12px 14px; border-radius: var(--radius-sm); margin: 16px 0; font-size: 14px; line-height: 1.5; }
.status.ok { background: #eafaf0; border: 1px solid #a6e6c0; }
.status.error { background: #fdecec; border: 1px solid #f3b3b3; }
.hidden { display: none; }
.hint { color: var(--text-muted); font-size: 12px; margin-top: 6px; line-height: 1.5; }
.hint a { color: var(--brand); }

/* -------------------------------------------------------------- case list */

.case {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 16px 0;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.case:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.gallery img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #11141a;
  border-radius: var(--radius-sm);
  display: block;
  cursor: zoom-in;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.gallery img:hover { opacity: 0.88; transform: scale(1.015); }

.edit-image-item { position: relative; }
.edit-image-item img { width: 100%; height: 140px; object-fit: cover; background: #11141a; border-radius: var(--radius-sm); display: block; }
.edit-image-item .remove-image-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(192, 57, 43, 0.92);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin: 0;
}
.edit-image-item .remove-image-btn:hover { background: #9e2f22; }
.edit-image-item .remove-image-btn:disabled { opacity: 0.6; cursor: default; }

.case h2 { font-size: 16px; margin: 0 0 6px; }
.meta { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.diagnosis { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.diagnosis a { color: inherit; text-decoration: none; }
.diagnosis a:hover { color: var(--brand); text-decoration: underline; }
.byline { font-size: 13px; color: var(--text-muted); }
.uploaded { font-size: 12px; color: #9aa1ae; margin-top: 4px; }
.badge {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid #b9d6f2;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

#content .gallery { margin-top: 12px; }
#content .gallery img { height: 220px; }

.badge-new {
  display: inline-block;
  background: #eafaf0;
  color: #1a7a4c;
  border: 1px solid #a6e6c0;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 700;
}

.badge-confirmed {
  display: inline-block;
  background: #eafaf0;
  color: #1a7a4c;
  border: 1px solid #a6e6c0;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.badge-suspected {
  display: inline-block;
  background: #fdf3e3;
  color: #a06a0a;
  border: 1px solid #f0d59a;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.site-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}
.site-footer a { color: var(--text-muted); text-decoration: underline; }
.site-footer a:hover { color: var(--brand); }

.empty, .error { padding: 16px 18px; border-radius: var(--radius); font-size: 14px; }
.empty { background: var(--brand-light); border: 1px solid #b9d6f2; color: var(--text); }
.error { background: #fdecec; border: 1px solid #f3b3b3; }

/* --------------------------------------------------------------- lightbox */

#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.92);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#lightbox.open { display: flex; }
#lightbox img { max-width: 88%; max-height: 88%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }

.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  margin-top: 0;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.24); }
#lightbox-prev { left: 20px; }
#lightbox-next { right: 20px; }
#lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  margin-top: 0;
}
#lightbox-close:hover { background: rgba(255, 255, 255, 0.24); }
#lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 12px;
  border-radius: 999px;
}
