/* CO2 레이저 차트 관리 - 커스텀 스타일 */

/* 전체 레이아웃 */
body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: #f0f4f8;
}

/* 헤더 */
.app-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d6a9f 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* 사이드바 */
.sidebar {
  background: #fff;
  border-right: 1px solid #e2e8f0;
  min-height: calc(100vh - 64px);
}

/* 카드 */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s;
}
.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* 모달 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99990;   /* 풀스크린 모달(9999) 위에 항상 표시 */
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 캔버스 컨테이너 */
.canvas-container {
  position: relative;
  display: inline-block;
  cursor: crosshair;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
}
.canvas-container canvas {
  display: block;
}
.canvas-container.eraser-mode {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle cx="10" cy="10" r="8" fill="white" stroke="gray" stroke-width="1.5"/></svg>') 10 10, auto;
}
.canvas-container.dot-mode {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle cx="10" cy="10" r="5" fill="%23e53e3e" stroke="white" stroke-width="1.5"/><line x1="10" y1="2" x2="10" y2="18" stroke="%23333" stroke-width="1"/><line x1="2" y1="10" x2="18" y2="10" stroke="%23333" stroke-width="1"/></svg>') 10 10, crosshair;
}
.canvas-container.area-mode {
  cursor: cell;
}

/* Zoom viewport */
#zoomViewport {
  touch-action: none; /* 터치 줌/팬 방지 (JS로 처리) */
}
#zoomViewport:active {
  cursor: inherit;
}

/* 신체 SVG */
.body-tab-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1.5px solid #e2e8f0;
  background: white;
  color: #4a5568;
}
.body-tab-btn.active {
  background: #2d6a9f;
  color: white;
  border-color: #2d6a9f;
}

/* 펜 도구 패널 */
.tool-panel {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
}

/* 색상 버튼 */
.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.color-btn.active {
  border-color: #1a202c;
  transform: scale(1.15);
}
.color-btn.red   { background: #e53e3e; }
.color-btn.blue  { background: #3182ce; }
.color-btn.green { background: #38a169; }

/* 굵기 버튼 */
.size-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.size-btn.active {
  border-color: #2d6a9f;
  background: #ebf4ff;
}

/* 카운팅 테이블 */
.count-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.875rem;
}
.count-table th {
  background: #2d6a9f;
  color: white;
  padding: 8px 12px;
  text-align: center;
  font-weight: 600;
}
.count-table td {
  padding: 7px 12px;
  text-align: center;
  border: 1px solid #e2e8f0;
}
.count-table tr:nth-child(even) td {
  background: #f7fafc;
}
.count-total {
  background: #ebf4ff !important;
  font-weight: 700;
  color: #2d6a9f;
}

/* 모드 배지 */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
.mode-badge.consultation {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}
.mode-badge.treatment {
  background: #d4edda;
  color: #155724;
  border: 1px solid #28a745;
}

/* 로딩 스피너 */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid #e2e8f0;
  border-top-color: #2d6a9f;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 토스트 알림 */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: 10px;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toastIn 0.3s ease;
  max-width: 360px;
}
.toast.success { background: #38a169; }
.toast.error   { background: #e53e3e; }
.toast.info    { background: #2d6a9f; }
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* 버튼 공통 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn-primary   { background: #2d6a9f; color: white; }
.btn-primary:hover { background: #1e4f7a; }
.btn-success   { background: #38a169; color: white; }
.btn-success:hover { background: #276749; }
.btn-danger    { background: #e53e3e; color: white; }
.btn-danger:hover { background: #c53030; }
.btn-secondary { background: #718096; color: white; }
.btn-secondary:hover { background: #4a5568; }
.btn-outline   { background: white; color: #4a5568; border: 1.5px solid #e2e8f0; }
.btn-outline:hover { background: #f7fafc; border-color: #cbd5e0; }

/* 입력 필드 */
.input-field {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.875rem;
  transition: border-color 0.15s;
  outline: none;
  background: white;
}
.input-field:focus {
  border-color: #2d6a9f;
  box-shadow: 0 0 0 3px rgba(45,106,159,0.15);
}
/* 입력 마스킹 유효성 피드백 */
.input-field.is-invalid {
  border-color: #e53e3e !important;
  box-shadow: 0 0 0 3px rgba(229,62,62,0.12);
}
.input-field.is-valid {
  border-color: #38a169;
}
/* 입력 힌트 텍스트 */
.input-hint {
  font-size: 0.72rem;
  color: #a0aec0;
  margin-top: 2px;
}
.input-hint.valid   { color: #38a169; }
.input-hint.invalid { color: #e53e3e; }

/* 환자 카드 */
.patient-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}
.patient-card:hover {
  border-color: #2d6a9f;
  background: #f0f8ff;
  transform: translateX(2px);
}
.patient-card.selected {
  border-color: #2d6a9f;
  background: #ebf4ff;
}

/* 세션 목록 */
.session-item {
  border-left: 4px solid #e2e8f0;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 0 8px 8px 0;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}
.session-item:hover {
  border-left-color: #2d6a9f;
  background: #f0f8ff;
}
.session-item.consultation { border-left-color: #ffc107; }
.session-item.treatment    { border-left-color: #28a745; }

/* PDF용 숨긴 영역 */
.pdf-hidden { display: none; }

/* 반응형 */
@media (max-width: 768px) {
  .sidebar { min-height: auto; }
  .canvas-container canvas { max-width: 100%; }
}

/* 범례 */
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #4a5568;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
