/* MedDoc AI - Custom Styles */

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-dot { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes highlightPulse { 0% { background-color: rgba(245,158,11,0.3); } 50% { background-color: rgba(245,158,11,0.15); } 100% { background-color: rgba(245,158,11,0.3); } }
.animate-fadeIn { animation: fadeIn 0.35s ease-out; }
.animate-slideUp { animation: slideUp 0.4s ease-out; }

/* ===== Typing Indicator ===== */
.typing-indicator span { display: inline-block; width: 6px; height: 6px; background: #A855F7; border-radius: 50%; margin: 0 1px; animation: pulse-dot 1.4s infinite both; }
.typing-indicator span:nth-child(2) { animation-delay: 0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.32s; }

/* ===== Upload Dropzone ===== */
.upload-dropzone.drag-over { border-color: #14B8A6 !important; background: rgba(20,184,166,0.05); }

/* ===== Doc Cards ===== */
.doc-card { transition: all 0.2s ease; }
.doc-card:hover { background: rgba(51,65,85,0.5); }

/* ===== Keyword Highlights ===== */
.keyword-met { background: rgba(34,197,94,0.15); color: #22C55E; padding: 1px 4px; border-radius: 3px; font-size: 0.85em; }
.keyword-partial { background: rgba(245,158,11,0.15); color: #F59E0B; padding: 1px 4px; border-radius: 3px; font-size: 0.85em; }
.keyword-missing { background: rgba(239,68,68,0.15); color: #EF4444; padding: 1px 4px; border-radius: 3px; font-size: 0.85em; }

/* ===== Progress Bar Mini ===== */
.progress-mini { height: 4px; border-radius: 2px; background: #334155; overflow: hidden; }
.progress-mini-fill { height: 100%; border-radius: 2px; transition: width 0.7s ease; }

/* ===== Chat ===== */
.md-content h1, .md-content h2, .md-content h3 { font-weight: 600; margin-top: 0.8em; margin-bottom: 0.3em; }
.md-content code { background: rgba(51,65,85,0.8); padding: 1px 5px; border-radius: 4px; font-size: 0.88em; }
.md-content blockquote { border-left: 3px solid #A855F7; padding-left: 12px; margin: 0.5em 0; color: #94a3b8; }

/* ===================================================
   Document Viewer / Editor Styles
   =================================================== */

/* Container */
.doc-viewer-container {
  background: #0F172A;
  font-family: 'Noto Sans KR', 'Inter', sans-serif;
}

/* Document editor area - make it feel like a document */
.doc-editor {
  background: #1a2332;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.8;
  padding: 32px 40px;
  min-height: 100%;
  outline: none;
  caret-color: #14B8A6;
}
.doc-editor:focus {
  outline: none;
}

/* Docx HTML styles - mammoth output */
.doc-editor h1, .doc-editor .doc-h1 { font-size: 1.5em; font-weight: 700; color: #f1f5f9; margin: 1em 0 0.5em; padding-bottom: 0.3em; border-bottom: 1px solid #334155; }
.doc-editor h2, .doc-editor .doc-h2 { font-size: 1.25em; font-weight: 600; color: #e2e8f0; margin: 0.9em 0 0.4em; }
.doc-editor h3, .doc-editor .doc-h3 { font-size: 1.1em; font-weight: 600; color: #cbd5e1; margin: 0.8em 0 0.3em; }
.doc-editor h4, .doc-editor .doc-h4 { font-size: 1em; font-weight: 600; color: #94a3b8; margin: 0.7em 0 0.3em; }
.doc-editor p { margin: 0.4em 0; }
.doc-editor ul, .doc-editor ol { padding-left: 1.5em; margin: 0.4em 0; }
.doc-editor li { margin: 0.2em 0; }
.doc-editor table { border-collapse: collapse; width: 100%; margin: 0.8em 0; font-size: 0.9em; }
.doc-editor table th, .doc-editor table td { border: 1px solid #334155; padding: 6px 10px; text-align: left; }
.doc-editor table th { background: #1e293b; font-weight: 600; color: #94a3b8; }
.doc-editor table td { background: #0f172a; }
.doc-editor strong, .doc-editor b { font-weight: 600; color: #f1f5f9; }
.doc-editor em, .doc-editor i { color: #cbd5e1; }
.doc-editor a { color: #3B82F6; text-decoration: underline; }
.doc-editor img { max-width: 100%; border-radius: 4px; margin: 0.5em 0; }

/* Excel sheet title */
.doc-editor .doc-sheet-title { font-size: 1.1em; font-weight: 600; color: #14B8A6; margin: 1em 0 0.5em; padding: 4px 8px; background: rgba(20,184,166,0.1); border-radius: 4px; display: inline-block; }
.doc-editor .sheet-section { margin-bottom: 1.5em; }

/* ===== Inline Annotations (AI comments in document) ===== */
.doc-annotation {
  display: block;
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid;
}
.doc-annotation:hover {
  filter: brightness(1.1);
}
.doc-annotation-missing {
  background: rgba(239,68,68,0.08);
  border-left-color: #EF4444;
  color: #fca5a5;
}
.doc-annotation-partial {
  background: rgba(245,158,11,0.08);
  border-left-color: #F59E0B;
  color: #fcd34d;
}
.doc-annotation-met {
  background: rgba(34,197,94,0.06);
  border-left-color: #22C55E;
  color: #86efac;
}
.doc-annotation .ann-icon { margin-right: 6px; }
.doc-annotation .ann-keyword { font-weight: 600; }
.doc-annotation .ann-standard { opacity: 0.6; font-size: 10px; margin-left: 4px; }
.doc-annotation .ann-detail { display: block; margin-top: 3px; opacity: 0.8; font-size: 11px; }

/* Highlight text in document that matches keywords */
.doc-highlight-met { background: rgba(34,197,94,0.15); border-radius: 2px; padding: 0 2px; }
.doc-highlight-partial { background: rgba(245,158,11,0.2); border-radius: 2px; padding: 0 2px; }

/* ===== Document Toolbar ===== */
.doc-toolbar {
  background: #1E293B;
  border-bottom: 1px solid rgba(51,65,85,0.5);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  main { flex-direction: column !important; }
  #rightPanel { width: 100% !important; max-height: 50vh; }
  .doc-editor { padding: 16px 20px; font-size: 13px; }
}
