/* ChiroVision Patient Files — thumb pill + modal styles.
   Matches the Glass Vision look (translucent dark card, cyan accents). */

/* ────────────────────────────────────────────────────────────────────────
   LAN Sync pill — floats bottom-right on every page. Click = sync now;
   right-click = change server address. Also matches Glass Vision palette.
   ──────────────────────────────────────────────────────────────────────── */
.cvsync-pill {
  position: fixed;
  right: 14px; bottom: 14px;
  z-index: 10400;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: #e5e7eb;
  background: linear-gradient(180deg, rgba(15,23,42,0.85), rgba(2,6,23,0.9));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  cursor: pointer;
  user-select: none;
  transition: background .12s, border-color .12s, transform .12s;
}
.cvsync-pill:hover { transform: translateY(-1px); background: rgba(15,23,42,0.95); }
.cvsync-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.cvsync-pill.cvsync-ok      { border-color: rgba(134,239,172,0.45); }
.cvsync-pill.cvsync-ok      .cvsync-dot { background: #86efac; box-shadow: 0 0 8px rgba(134,239,172,0.7); }
.cvsync-pill.cvsync-syncing { border-color: rgba(110,231,245,0.5); }
.cvsync-pill.cvsync-syncing .cvsync-dot {
  background: #6ee7f5;
  animation: cvsync-blink 1s ease-in-out infinite;
}
.cvsync-pill.cvsync-err     { border-color: rgba(244,114,182,0.5); }
.cvsync-pill.cvsync-err     .cvsync-dot { background: #fda4af; }
.cvsync-pill.cvsync-off     .cvsync-dot { background: #64748b; }
@keyframes cvsync-blink {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.35; transform: scale(0.85); }
}

/* Option C — big count number replaces the folder icon when files exist */
.cvpf-thumb { position: relative; }
.cvpf-thumb .cvpf-thumb-num {
  display: none;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 22px;
  color: #6ee7f5;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.cvpf-thumb.has-count .cvpf-thumb-num { display: block; }
.cvpf-thumb.has-count .cvpf-thumb-icon { display: none; }
.cvpf-thumb.cvpf-count-small .cvpf-thumb-num { font-size: 15px; }

/* Modal overlay */
.cvpf-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10500;
  background: rgba(2, 6, 12, 0.78);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}
.cvpf-modal.open { display: flex; }

.cvpf-card {
  width: min(1180px, 100%);
  max-height: calc(100vh - 64px);
  background: linear-gradient(180deg, rgba(15,23,42,0.96), rgba(2,6,23,0.98));
  border: 1px solid rgba(110,231,245,0.22);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  color: #e5e7eb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

.cvpf-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.cvpf-title-block { flex: 1; min-width: 0; }
.cvpf-title {
  font-family: Georgia, serif;
  font-size: 18px;
  color: #fff;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cvpf-counts {
  color: #94a3b8;
  font-size: 12px;
  letter-spacing: 0.01em;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cvpf-counts:empty { display: none; }
.cvpf-title-lead { color: #6ee7f5; margin-right: 4px; font-weight: 700; }
.cvpf-patient-name { color: #fff; }
.cvpf-head-actions { display: flex; align-items: center; gap: 8px; }

.cvpf-add-btn {
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(134,239,172,0.14);
  color: #86efac;
  border: 1px solid rgba(134,239,172,0.5);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.cvpf-add-btn:hover { background: rgba(134,239,172,0.24); }

.cvpf-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: #e5e7eb;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cvpf-close:hover { background: rgba(244, 114, 182, 0.18); color: #fda4af; border-color: rgba(244,114,182,0.5); }

.cvpf-body {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  min-height: 0;
}
@media (max-width: 780px) {
  .cvpf-body { grid-template-columns: 1fr; }
}

/* Left column: list of files */
.cvpf-list {
  border-right: 1px solid rgba(255,255,255,0.08);
  overflow-y: auto;
  padding: 10px 8px;
  min-height: 0;
}
.cvpf-empty {
  padding: 18px 14px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.55;
}
.cvpf-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s;
}
.cvpf-row + .cvpf-row { margin-top: 2px; }
.cvpf-row:hover { background: rgba(255,255,255,0.05); }
.cvpf-row.sel {
  background: rgba(110,231,245,0.12);
  outline: 1px solid rgba(110,231,245,0.35);
}
.cvpf-row-thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  background: #0b1220;
  border: 1px solid rgba(255,255,255,0.08);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.cvpf-row-meta { min-width: 0; flex: 1; }
.cvpf-row-name {
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cvpf-row-sub {
  color: #94a3b8;
  font-size: 11.5px;
  margin-top: 2px;
}

/* Right column: preview + metadata */
.cvpf-preview {
  display: flex;
  flex-direction: column;
  padding: 14px 18px 18px;
  overflow-y: auto;
  min-height: 0;
  gap: 14px;
}
.cvpf-media {
  background: #000;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cvpf-media-img {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  object-fit: contain;
  background: #000;
}
.cvpf-media-pdf {
  width: 100%;
  height: 65vh;
  border: 0;
  background: #fff;
}
.cvpf-media-dicom {
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cvpf-media-dicom-stage canvas {
  background: #000 !important;
}
.cvpf-dicom-meta {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.cvpf-meta {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cvpf-meta-row { display: flex; flex-direction: column; gap: 4px; }
.cvpf-meta-label {
  color: #94a3b8;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}
.cvpf-meta-input,
.cvpf-meta-notes {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 10px;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.cvpf-meta-input:focus,
.cvpf-meta-notes:focus {
  outline: none;
  border-color: rgba(110,231,245,0.5);
  background: rgba(0,0,0,0.5);
}

.cvpf-meta-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cvpf-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.04);
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.cvpf-btn:hover { background: rgba(255,255,255,0.09); }
.cvpf-btn.danger:hover {
  background: rgba(244,114,182,0.16);
  color: #fda4af;
  border-color: rgba(244,114,182,0.5);
}
.cvpf-meta-info {
  color: #94a3b8;
  font-size: 12px;
  padding-top: 2px;
}
