/* ==================== IVISION WORKSTATION STYLES ====================
   Professional Dark Mode Design System | Medical UI
   Consistent with IVIsionLogin.css
   ============================================================= */

/* TAREFA 1: BACKGROUND DO BODY */
body { 
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
  background-attachment: fixed;
  color: #e0e0e0; 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  height: 100vh; 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
  position: relative;
}

/* Background Pattern (consistente com login) */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(0, 210, 255, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(102, 126, 234, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Garantir que o conteúdo fique acima do background */
.workspace,
.patient-header {
  position: relative;
  z-index: 1;
}

/* TAREFA 2: HEADER */
.patient-header { 
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 210, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  padding: 0 20px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  height: 60px; 
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.patient-header:hover {
  border-bottom-color: rgba(0, 210, 255, 0.2);
}

.pat-info { display: flex; align-items: center; gap: 8px; }
.pat-info span { font-size: 0.9em; color: #ffffff; } 
.pat-val { color: #ffffff; font-weight: 600; margin-right: 15px; }

/* TAREFA 3: INPUTS EDITÁVEIS (metadados do paciente) */
.pat-val-edit { 
  background: rgba(20, 20, 20, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff !important;
  padding: 6px 12px; 
  font-size: 0.85em; 
  font-weight: 600; 
  border-radius: 6px; 
  outline: none;
  transition: all 0.2s ease;
  color-scheme: dark;
}

.pat-val-edit:hover { 
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(25, 25, 25, 0.9) !important;
}

.pat-val-edit:focus { 
  border-color: #00d2ff; 
  background: rgba(30, 30, 30, 0.95) !important; 
  color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.1);
}

/* Placeholder com cor sutil mas legível */
.pat-val-edit::placeholder {
  color: #aaaaaa !important;
  opacity: 1;
}
.pat-val-edit::-webkit-input-placeholder {
  color: #aaaaaa !important;
}
.pat-val-edit::-moz-placeholder {
  color: #aaaaaa !important;
  opacity: 1;
}
.pat-val-edit:-ms-input-placeholder {
  color: #aaaaaa !important;
}

/* Ajustes específicos para input[type="date"] */
.pat-val-edit[type="date"] {
  color-scheme: dark;
}
.pat-val-edit[type="date"]::-webkit-datetime-edit {
  color: #ffffff;
}
.pat-val-edit[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

/* LAYOUT */
.workspace { display: flex; flex-grow: 1; height: calc(100vh - 60px); overflow: hidden; }

/* TAREFA 4: SIDEBARS (esquerda e direita) */
.sidebar-left { 
  width: 260px; 
  background: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(0, 210, 255, 0.05);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  display: flex; 
  flex-direction: column; 
  height: 100%;
  transition: all 0.3s ease;
}

.sidebar-left:hover {
  border-right-color: rgba(0, 210, 255, 0.1);
}

.sidebar-right { 
  width: 280px; 
  background: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(0, 210, 255, 0.05);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  display: flex; 
  flex-direction: column; 
  padding: 15px; 
  height: 100%;
  transition: all 0.3s ease;
}

.sidebar-right:hover {
  border-left-color: rgba(0, 210, 255, 0.1);
}

.main-view { flex-grow: 1; display: flex; flex-direction: column; position: relative; height: 100%; }

/* LISTA DE SÉRIES */
.series-label { font-size: 0.75em; font-weight: bold; color: #666; padding: 10px 10px 5px 10px; text-transform: uppercase; letter-spacing: 1px; flex-shrink: 0; }

/* TAREFA 7: CANVAS AREAS E CONTAINERS */
.series-container { 
  flex: 1; 
  overflow-y: auto; 
  padding: 0 12px 12px 12px; 
  border-bottom: 1px solid rgba(0, 210, 255, 0.08);
  min-height: 150px; 
  max-height: 300px; 
  background: rgba(15, 15, 15, 0.4);
  backdrop-filter: blur(5px);
}

.series-container::-webkit-scrollbar { 
  width: 8px; 
}

.series-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.series-container::-webkit-scrollbar-thumb { 
  background: rgba(0, 210, 255, 0.3);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.series-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 210, 255, 0.5);
}

/* TAREFA 8: ITEMS DA LISTA (séries, bookmarks) */
.series-item { 
  display: flex; 
  gap: 12px; 
  padding: 10px; 
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px; 
  margin-bottom: 8px; 
  cursor: pointer; 
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}

.series-item:hover { 
  background: rgba(40, 40, 40, 0.8);
  border-color: rgba(0, 210, 255, 0.2);
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.series-item.active { 
  border-color: #00d2ff; 
  background: rgba(0, 210, 255, 0.1);
  box-shadow: 0 2px 12px rgba(0, 210, 255, 0.3);
}

.series-thumb { width: 50px; height: 50px; object-fit: cover; background: #000; border-radius: 3px; flex-shrink: 0; }
.series-info { overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.series-name { font-weight: bold; font-size: 0.85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: white; }
.series-meta { font-size: 0.75em; color: #aaa; }

/* FERRAMENTAS */
.tools-container { padding: 15px; background: rgba(18, 18, 18, 0.6); flex-shrink: 0; overflow-y: auto; flex-grow: 1; backdrop-filter: blur(5px); }

/* CANVAS AREAS */
.canvas-area { flex: 2; background: #000; position: relative; display: flex; justify-content: center; align-items: center; overflow: hidden; }
.long-area { height: 180px; background: #000; position: relative; border-top: 1px solid rgba(0, 210, 255, 0.1); overflow: hidden; flex-shrink: 0; }
canvas#screen { box-shadow: 0 0 30px #000; transition: box-shadow 0.3s; } 
canvas#longCanvas { width: 100%; height: 100%; display: block; cursor: col-resize; }

/* Validação de Geometria em Tempo Real */
canvas#screen.geometry-warning {
  box-shadow: 0 0 30px rgba(255, 193, 7, 0.6), 0 0 60px rgba(255, 193, 7, 0.3);
  animation: warningPulse 1s ease-out;
}

@keyframes warningPulse {
  0% { box-shadow: 0 0 30px rgba(255, 193, 7, 0.8), 0 0 60px rgba(255, 193, 7, 0.5); }
  50% { box-shadow: 0 0 40px rgba(255, 193, 7, 1), 0 0 80px rgba(255, 193, 7, 0.7); }
  100% { box-shadow: 0 0 30px rgba(255, 193, 7, 0.6), 0 0 60px rgba(255, 193, 7, 0.3); }
}

/* TAREFA 5: BOTÕES */
.tool-btn { 
  width: 100%; 
  text-align: left; 
  margin-bottom: 8px; 
  padding: 12px 14px; 
  background: rgba(30, 30, 30, 0.6);
  color: #ccc; 
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px; 
  font-size: 0.9em; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  transition: all 0.2s ease;
  cursor: pointer;
  font-weight: 500;
}

.tool-btn:hover { 
  background: rgba(40, 40, 40, 0.8);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(2px);
}

.tool-btn.active { 
  background: rgba(0, 210, 255, 0.1);
  border-left: 3px solid #00d2ff;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 210, 255, 0.2);
}

/* Cores específicas dos botões ativos */
.tool-btn.active.lumen { 
  border-left-color: #00d2ff;
  background: rgba(0, 210, 255, 0.08);
}

.tool-btn.active.vessel { 
  border-left-color: #ff9f00;
  background: rgba(255, 159, 0, 0.08);
}

.tool-btn.active.stent { 
  border-left-color: #00ff88;
  background: rgba(0, 255, 136, 0.08);
}

.tool-btn.active.calcium { 
  border-left-color: #FFD700;
  background: rgba(255, 215, 0, 0.08);
}

.tool-btn.active.measure-l { border-color: #00d2ff; } 
.tool-btn.active.measure-v { border-color: #ff9f00; }

/* Botão de Sair do Modo Edição */
#btnExitEdit:hover { 
  background: linear-gradient(135deg, rgba(60, 60, 60, 0.8) 0%, rgba(40, 40, 40, 0.8) 100%) !important; 
  border-color: rgba(170, 170, 170, 0.3) !important; 
  cursor: pointer; 
}

/* CONTROLES */
#loading-box { 
  position: absolute; 
  top: 50%; 
  left: 50%; 
  transform: translate(-50%, -50%); 
  width: 250px; 
  padding: 20px; 
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 8px; 
  text-align: center; 
  display: none; 
  z-index: 999; 
  border: 1px solid rgba(0, 210, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.prog-bar { height: 4px; background: rgba(0, 0, 0, 0.3); margin-top: 10px; border-radius: 2px; } 
.prog-fill { height: 100%; background: linear-gradient(90deg, #00d2ff, #667eea); width: 0%; transition: width 0.2s; border-radius: 2px; }

/* Badge de qualidade (Progressive Loading) */
#qualityBadge.low-res {
  background-color: #ffc107 !important;
  color: #000 !important;
}

#qualityBadge.high-res {
  background-color: #28a745 !important;
  color: #fff !important;
}

.player-bar { 
  background: rgba(17, 17, 17, 0.9);
  backdrop-filter: blur(10px);
  padding: 5px 10px; 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  border-top: 1px solid rgba(0, 210, 255, 0.1); 
  flex-shrink: 0; 
}

.btn-play { 
  width: 30px; 
  height: 30px; 
  border-radius: 50%; 
  border: 1px solid rgba(0, 210, 255, 0.2); 
  background: rgba(34, 34, 34, 0.8); 
  color: white; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  cursor: pointer; 
  transition: all 0.2s ease;
}

.btn-play:hover {
  background: rgba(0, 210, 255, 0.2);
  border-color: rgba(0, 210, 255, 0.4);
  transform: scale(1.1);
}

.btn-ctrl { 
  width: 32px; 
  height: 32px; 
  border-radius: 50%; 
  border: 1px solid rgba(0, 210, 255, 0.2); 
  background: rgba(34, 34, 34, 0.8); 
  color: white; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  cursor: pointer; 
  transition: all 0.2s ease; 
}

.btn-ctrl:hover { 
  background: rgba(0, 210, 255, 0.2); 
  border-color: rgba(0, 210, 255, 0.4); 
  transform: scale(1.1);
}

.rot-control { 
  position: absolute; 
  bottom: 10px; 
  left: 50%; 
  transform: translateX(-50%); 
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  padding: 5px 15px; 
  border-radius: 20px; 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  z-index: 10; 
  border: 1px solid rgba(0, 210, 255, 0.2); 
}

/* BOOKMARKS */
.bm-list { flex-grow: 1; overflow-y: auto; }
.bm-list::-webkit-scrollbar { width: 8px; } 
.bm-list::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); } 
.bm-list::-webkit-scrollbar-thumb { 
  background: rgba(0, 210, 255, 0.3);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.bm-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 210, 255, 0.5);
}

.bookmark-item { 
  background: rgba(30, 30, 30, 0.6);
  backdrop-filter: blur(5px);
  padding: 10px; 
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: grab; 
  margin-bottom: 8px; 
  border-radius: 6px; 
  display: flex; 
  gap: 12px; 
  align-items: center; 
  font-size: 0.85em; 
  transition: all 0.2s ease; 
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.bookmark-item:hover { 
  background: rgba(40, 40, 40, 0.8);
  border-color: rgba(0, 210, 255, 0.2);
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
} 

.bookmark-item:active { cursor: grabbing; }

/* Bookmark da série atual - destaque azul */
.bookmark-item.bm-current-series { border-left: 3px solid #00d2ff; }

/* Bookmark de outra série - destaque mais sutil */
.bookmark-item.bm-other-series { border-left: 3px solid #666; opacity: 0.85; }
.bookmark-item.bm-other-series:hover { opacity: 1; border-left-color: #00d2ff; }

/* Estados de drag & drop */
.bookmark-item.dragging { opacity: 0.5; cursor: grabbing; transform: scale(1.02); }
.bookmark-item.drag-over { border-top: 3px solid #00ff88 !important; }

.thumb-bm { width: 40px; height: 40px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
.del-btn { 
  color: #ff5e5e; 
  background: none; 
  border: none; 
  font-size: 1.2em; 
  padding: 0 5px; 
  cursor: pointer; 
  transition: all 0.2s ease;
}

.del-btn:hover {
  color: #ff9999;
  transform: scale(1.2);
}

/* Botões de reordenação */
.bm-reorder-btns { display: flex; flex-direction: column; gap: 2px; margin-left: auto; }
.btn-reorder { 
  background: rgba(51, 51, 51, 0.8); 
  border: 1px solid rgba(0, 210, 255, 0.2); 
  color: #aaa; 
  width: 24px; 
  height: 20px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  border-radius: 3px; 
  font-size: 0.7em; 
  transition: all 0.2s ease; 
}

.btn-reorder:hover { 
  background: rgba(0, 210, 255, 0.2); 
  color: #fff; 
  border-color: #00d2ff; 
}

.btn-reorder:active { transform: scale(0.95); }

/* Drag handle (ícone de arrastar) */
.drag-handle { 
  color: #666; 
  font-size: 1em; 
  cursor: grab; 
  padding: 0 5px; 
  display: flex; 
  align-items: center; 
  transition: all 0.2s ease;
}

.drag-handle:hover { color: #00d2ff; }
.drag-handle:active { cursor: grabbing; }

/* OSD TEXT */
.osd-text { position: absolute; pointer-events: none; text-shadow: 1px 1px 2px #000; font-family: monospace; z-index: 10; }
.osd-top-left { top: 15px; left: 15px; color: #fff; font-size: 0.85em; line-height: 1.3; }
.osd-top-right { top: 15px; right: 15px; color: #aaa; text-align: right; font-size: 0.85em; }

/* PAINEL DE MÉTRICAS (Baixo Esquerda) */
.osd-bottom-left { 
  bottom: 15px; 
  left: 15px; 
  background: rgba(15, 15, 15, 0.9); 
  backdrop-filter: blur(10px);
  padding: 12px 15px; 
  border-radius: 6px; 
  border-left: 3px solid #00d2ff;
  border-top: 1px solid rgba(0, 210, 255, 0.2);
  border-right: 1px solid rgba(0, 210, 255, 0.2);
  border-bottom: 1px solid rgba(0, 210, 255, 0.2);
  min-width: 240px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.osd-row { display: flex; justify-content: space-between; margin-bottom: 4px; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 2px; width: 100%; }
.osd-label { color: #ccc; font-size: 0.85em; }
.osd-val { font-weight: bold; font-size: 1.0em; font-family: 'Consolas', monospace; }
.osd-unit { font-size: 0.75em; color: #777; margin-left: 3px; }

/* Espaçamento extra para diâmetros */
.osd-diam-row {
  display: flex; 
  justify-content: space-between; 
  margin-bottom: 6px;
  padding-top: 4px;
}

.c-lumen { color: #00d2ff; } 
.c-vessel { color: #ff9f00; } 
.c-plaque { color: #ff5e5e; } 
.c-measure { color: #00ff00; } 
.c-stent { color: #00ff88; } 
.c-calcium { color: #FFD700; }

/* ==================== CONTROLES DE IMAGEM (v8060) ==================== */
.image-controls {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(15, 15, 15, 0.9);
  backdrop-filter: blur(10px);
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0, 210, 255, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 15;
  min-width: 200px;
  pointer-events: auto;
}

.image-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.image-control-row:last-child {
  margin-bottom: 0;
}

.image-control-label {
  color: #aaa;
  font-size: 0.75em;
  font-family: monospace;
  min-width: 60px;
  margin: 0;
}

.image-control-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(51, 51, 51, 0.8);
  outline: none;
  border-radius: 2px;
  cursor: pointer;
}

.image-control-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #00d2ff;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.image-control-slider::-webkit-slider-thumb:hover {
  background: #00ffff;
  transform: scale(1.2);
}

.image-control-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #00d2ff;
  cursor: pointer;
  border-radius: 50%;
  border: none;
  transition: all 0.2s ease;
}

.image-control-slider::-moz-range-thumb:hover {
  background: #00ffff;
  transform: scale(1.2);
}

.image-control-value {
  color: #fff;
  font-size: 0.75em;
  font-family: 'Consolas', monospace;
  min-width: 40px;
  text-align: right;
}
/* ====================================================================== */

/* TAREFA 6: BOTÃO DE SALVAR BOOKMARK */
.btn-save { 
  background: linear-gradient(135deg, #00ff88 0%, #00d2aa 100%);
  color: #ffffff; 
  border: none; 
  font-weight: 700;
  width: 100%; 
  padding: 14px 20px; 
  border-radius: 8px; 
  margin-top: 10px;
  font-size: 0.95em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-save::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 136, 0.5);
}

.btn-save:hover::before {
  left: 100%;
}

.btn-save:active {
  transform: translateY(0);
}

/* TAREFA 9: MODAIS (Preview PDF) */
.modal-content {
  background: rgba(20, 20, 20, 0.98);
  border: 1px solid rgba(0, 210, 255, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.1) 0%, rgba(102, 126, 234, 0.1) 100%);
  border-bottom: 1px solid rgba(0, 210, 255, 0.2);
}

.modal-footer {
  background: rgba(15, 15, 15, 0.8);
  border-top: 1px solid rgba(0, 210, 255, 0.1);
}

.btn-close-white {
  filter: brightness(1.2);
  transition: all 0.2s ease;
}

.btn-close-white:hover {
  filter: brightness(1.5);
  transform: rotate(90deg);
}

/* Estilos adicionais para formulários e selects */
.form-select,
.form-control {
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transition: all 0.2s ease;
}

.form-select:hover,
.form-control:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(25, 25, 25, 0.9);
}

.form-select:focus,
.form-control:focus {
  border-color: #00d2ff;
  background: rgba(30, 30, 30, 0.95);
  box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.1);
  color: #ffffff;
}

/* Botões Bootstrap customizados */
.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transition: all 0.2s ease;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-outline-danger {
  border-color: rgba(255, 94, 94, 0.3);
  color: #ff5e5e;
  transition: all 0.2s ease;
}

.btn-outline-danger:hover {
  background: rgba(255, 94, 94, 0.1);
  border-color: rgba(255, 94, 94, 0.5);
  transform: translateY(-1px);
}

.btn-info,
.btn-warning,
.btn-success {
  transition: all 0.2s ease;
}

.btn-info:hover,
.btn-warning:hover,
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
