/* ═══════════════════════════════════════
   GALERÍA CLÍNICA & DOCUMENTOS — CSS
   ═══════════════════════════════════════ */

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--neutral-700);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--t-base);
  background: var(--neutral-850);
  position: relative;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--brand-accent);
  background: rgba(45,212,191,.04);
}
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon  { font-size: 32px; margin-bottom: var(--sp-3); }
.upload-title { font-size: var(--text-sm); font-weight: 600; color: var(--neutral-200); margin-bottom: var(--sp-1); }
.upload-sub   { font-size: var(--text-xs); color: var(--neutral-500); }
.upload-hint  { font-size: 10px; color: var(--neutral-600); margin-top: var(--sp-2); }

/* ── Galería grid ── */
.galeria-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4); gap: var(--sp-3); flex-wrap: wrap;
}
.galeria-filtros { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.galeria-filtro {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--neutral-700);
  background: transparent;
  color: var(--neutral-400);
  font-size: var(--text-xs); font-weight: 600;
  font-family: var(--font-body); cursor: pointer;
  transition: all var(--t-fast); letter-spacing: .04em;
}
.galeria-filtro:hover  { border-color: var(--neutral-500); color: var(--neutral-200); }
.galeria-filtro.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }

.galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-3);
}
.galeria-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: var(--border-subtle);
  background: var(--neutral-850);
  cursor: pointer;
  transition: all var(--t-fast);
  aspect-ratio: 1;
}
.galeria-item:hover { border-color: var(--brand-accent); box-shadow: 0 0 0 2px rgba(45,212,191,.2); transform: translateY(-1px); }
.galeria-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.galeria-item-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.8) 0%, transparent 50%);
  opacity: 0; transition: opacity var(--t-fast);
  display: flex; align-items: flex-end; padding: var(--sp-2);
}
.galeria-item:hover .galeria-item-overlay { opacity: 1; }
.galeria-item-label  { font-size: 10px; color: #fff; font-weight: 600; }
.galeria-item-type {
  position: absolute; top: var(--sp-1); right: var(--sp-1);
  background: rgba(0,0,0,.7); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 5px; border-radius: var(--radius-sm);
}
.galeria-item-doc {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: var(--sp-2);
  padding: var(--sp-3);
}
.galeria-item-doc-icon { font-size: 28px; }
.galeria-item-doc-name {
  font-size: 10px; color: var(--neutral-300); text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%;
}
.galeria-item-delete {
  position: absolute; top: var(--sp-1); left: var(--sp-1);
  background: rgba(244,63,94,.8); color: #fff;
  border: none; border-radius: var(--radius-sm);
  width: 20px; height: 20px; font-size: 10px;
  cursor: pointer; display: none; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.galeria-item:hover .galeria-item-delete { display: flex; }

/* ── Visor lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.95);
  display: flex; flex-direction: column;
  animation: fadeIn .15s ease both;
}
.lightbox-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-5); flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.lightbox-title { font-size: var(--text-sm); color: rgba(255,255,255,.8); font-weight: 500; }
.lightbox-controls { display: flex; gap: var(--sp-2); align-items: center; }
.lightbox-btn {
  background: rgba(255,255,255,.1); border: none; color: #fff;
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-md);
  cursor: pointer; font-size: var(--text-xs); font-family: var(--font-body);
  transition: background var(--t-fast); font-weight: 500;
}
.lightbox-btn:hover { background: rgba(255,255,255,.2); }
.lightbox-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.lightbox-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  transform-origin: center;
  transition: transform .2s ease;
  cursor: grab;
}
.lightbox-img:active { cursor: grabbing; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.1); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast);
}
.lightbox-nav:hover { background: rgba(255,255,255,.25); }
.lightbox-nav.prev { left: var(--sp-4); }
.lightbox-nav.next { right: var(--sp-4); }
.lightbox-footer {
  padding: var(--sp-3) var(--sp-5); flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between;
}
.lightbox-meta { font-size: var(--text-xs); color: rgba(255,255,255,.5); }
.lightbox-counter { font-size: var(--text-xs); color: rgba(255,255,255,.4); }

/* ── Comparador ── */
.comparador-wrap {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  cursor: ew-resize; user-select: none; background: var(--neutral-850);
  border: var(--border-subtle);
}
.comparador-wrap img { width: 100%; height: 320px; object-fit: cover; display: block; }
.comparador-before { position: absolute; inset: 0; overflow: hidden; }
.comparador-before img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.comparador-divider {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.8);
  cursor: ew-resize;
}
.comparador-handle {
  position: absolute; top: 50%; transform: translate(-50%,-50%);
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #333;
}
.comparador-label-before,
.comparador-label-after {
  position: absolute; bottom: var(--sp-3);
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 10px; border-radius: var(--radius-full);
}
.comparador-label-before { left: var(--sp-3); }
.comparador-label-after  { right: var(--sp-3); }

/* ── Documentos list ── */
.doc-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.doc-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--neutral-850); border: var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--t-fast);
}
.doc-item:hover { border-color: var(--neutral-600); }
.doc-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.doc-icon.pdf  { background: rgba(244,63,94,.1); }
.doc-icon.img  { background: rgba(45,212,191,.1); }
.doc-icon.file { background: rgba(56,189,248,.1); }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: var(--text-sm); font-weight: 500; color: var(--neutral-100); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: var(--text-xs); color: var(--neutral-500); margin-top: 1px; }
.doc-actions { display: flex; gap: var(--sp-1); flex-shrink: 0; }

/* ── Upload progress ── */
.upload-progress {
  margin-top: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.upload-progress-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: var(--neutral-800); border-radius: var(--radius-md);
  font-size: var(--text-xs);
}
.upload-progress-name  { flex: 1; color: var(--neutral-300); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-progress-bar   { width: 80px; height: 4px; background: var(--neutral-700); border-radius: 2px; overflow: hidden; }
.upload-progress-fill  { height: 100%; background: var(--brand-accent); border-radius: 2px; transition: width .3s ease; }
.upload-progress-pct   { width: 30px; text-align: right; color: var(--neutral-500); }

/* ── Historia clínica general ── */
.hcg-section { margin-bottom: var(--sp-5); }
.hcg-title {
  font-size: var(--text-xs); font-weight: 700; color: var(--neutral-500);
  text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: var(--sp-3); padding-bottom: var(--sp-2);
  border-bottom: var(--border-subtle);
  display: flex; align-items: center; gap: var(--sp-2);
}
.hcg-title span { color: var(--brand-accent); }
.hcg-save-btn {
  display: flex; justify-content: flex-end; margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: var(--border-subtle);
}
