/* Pasientjournal Styles - Dark Mode Muted */
/* Extends global.css - uses custom header/layout (not site-header) */

:root {
  /* Lab dark mode color system - warm muted palette */
  --lab-bg-base: #1a1a1a;
  --lab-bg-elevated: #242424;
  --lab-bg-panel: #2a2a2a;
  --lab-text-primary: #e8e8e8;
  --lab-text-secondary: #a0a0a0;
  --lab-border: #3a3a3a;
  --lab-accent: #c9a08b; /* Muted warm tan from main page */
  --lab-accent-dark: #a8826d;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--lab-bg-base);
  color: var(--lab-text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: var(--lab-bg-elevated);
  color: var(--lab-text-primary);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--lab-border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-link {
  color: var(--lab-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--lab-accent);
}

header h1 {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--lab-text-primary);
}

.status {
  font-size: 0.875rem;
  color: var(--lab-text-secondary);
}

/* Main Layout */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 400px;
  overflow: hidden;
  gap: 0;
}

/* Documents Panel */
.documents-panel {
  background: var(--lab-bg-panel);
  border-right: 1px solid var(--lab-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Patient Card */
.patient-card {
  padding: 1.5rem;
  border-bottom: 1px solid var(--lab-border);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.patient-icon {
  width: 50px;
  height: 50px;
  background: var(--lab-bg-elevated);
  border: 2px solid var(--lab-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.patient-info {
  flex: 1;
}

.patient-info h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--lab-text-primary);
  margin-bottom: 0.5rem;
}

.patient-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-row {
  display: flex;
  font-size: 0.8rem;
}

.detail-label {
  color: var(--lab-text-secondary);
  min-width: 85px;
}

.detail-value {
  color: var(--lab-text-primary);
  font-weight: 500;
}

.documents-header {
  padding: 1rem;
  border-bottom: 1px solid var(--lab-border);
}

.documents-header h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--lab-text-secondary);
  letter-spacing: 0.05em;
}

.document-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.document-item {
  background: var(--lab-bg-elevated);
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.document-item:hover {
  border-color: var(--lab-accent);
  background: color-mix(in srgb, var(--lab-accent) 8%, var(--lab-bg-elevated));
}

.document-item h4 {
  font-size: 0.8rem;
  color: var(--lab-text-primary);
  margin-bottom: 0.25rem;
}

.document-item .doc-meta {
  font-size: 0.7rem;
  color: var(--lab-text-secondary);
}

.document-item .doc-type {
  display: inline-block;
  background: color-mix(in srgb, var(--lab-accent) 20%, var(--lab-bg-elevated));
  color: var(--lab-accent);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  margin-top: 0.25rem;
}

/* Document Viewer */
.document-viewer {
  background: var(--lab-bg-base);
  border-right: 1px solid var(--lab-border);
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.viewer-content {
  max-width: 800px;
  width: 100%;
  background: var(--lab-bg-elevated);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 1px solid var(--lab-border);
  color: var(--lab-text-primary);
}

.viewer-empty {
  text-align: center;
  color: var(--lab-text-secondary);
  padding: 4rem 2rem;
}

/* Chat Container */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--lab-bg-panel);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.message {
  max-width: 80%;
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  margin-left: auto;
}

.message.assistant {
  margin-right: auto;
}

.message-content {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  line-height: 1.5;
}

.message.user .message-content {
  background: var(--lab-accent);
  color: var(--lab-bg-base);
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  background: var(--lab-bg-elevated);
  color: var(--lab-text-primary);
  border: 1px solid var(--lab-border);
  border-bottom-left-radius: 4px;
}

.message-meta {
  font-size: 0.75rem;
  color: var(--lab-text-secondary);
  margin-top: 0.25rem;
  padding: 0 0.5rem;
}

.message.user .message-meta {
  text-align: right;
}

/* Chat Input */
.chat-input-container {
  border-top: 1px solid var(--lab-border);
  padding: 1rem;
  background: var(--lab-bg-elevated);
}

.chat-input-wrapper {
  display: flex;
  gap: 0.5rem;
  max-width: 800px;
  margin: 0 auto;
}

#chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--lab-border);
  border-radius: 24px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  background: var(--lab-bg-panel);
  color: var(--lab-text-primary);
}

#chat-input:focus {
  border-color: var(--lab-accent);
}

#send-btn {
  background: var(--lab-accent);
  color: var(--lab-bg-base);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 24px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

#send-btn:hover {
  background: var(--lab-accent-dark);
}

#send-btn:disabled {
  background: color-mix(in srgb, var(--lab-accent) 40%, var(--lab-bg-base));
  cursor: not-allowed;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  padding: 0.75rem 1rem;
  background: var(--lab-bg-elevated);
  border: 1px solid var(--lab-border);
  border-radius: 12px;
  width: fit-content;
  margin-bottom: 1rem;
}

.typing-indicator.show {
  display: block;
}

.typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--lab-accent);
  border-radius: 50%;
  margin-right: 4px;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: 3rem;
  color: var(--lab-text-secondary);
}

.welcome-message h2 {
  color: var(--lab-accent);
  margin-bottom: 0.5rem;
}

/* Generate Button */
.generate-btn {
  background: var(--lab-accent);
  color: var(--lab-bg-base);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.2s;
}

.generate-btn:hover {
  background: var(--lab-accent-dark);
}

/* Tooltip System */
.tooltip {
  position: fixed;
  background: var(--lab-bg-elevated);
  border: 2px solid var(--lab-border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 1000;
  min-width: 280px;
  max-width: 400px;
  animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.tooltip.locked {
  border-color: var(--lab-accent);
  box-shadow: 0 8px 30px rgba(201, 160, 139, 0.3);
}

.tooltip-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--lab-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--lab-bg-panel);
  border-radius: 6px 6px 0 0;
}

.tooltip-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--lab-text-primary);
}

.tooltip-actions {
  display: flex;
  gap: 0.5rem;
}

.tooltip-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--lab-text-secondary);
  font-size: 1.1rem;
  transition: color 0.2s;
}

.tooltip-btn:hover {
  color: var(--lab-accent);
}

.tooltip-content {
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--lab-text-primary);
}

/* Clickable Elements - Muted colors for dark mode */
.clickable-practitioner {
  color: #7ea3e0;
  text-decoration: underline;
  text-decoration-style: solid;
  cursor: pointer;
  transition: color 0.2s;
}

.clickable-practitioner:hover {
  color: #9bb8e8;
}

.clickable-health {
  color: #6dab8f;
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
  transition: color 0.2s;
}

.clickable-health:hover {
  color: #85bfa4;
}

/* Responsive */
@media (max-width: 1200px) {
  main {
    grid-template-columns: 280px 1fr;
  }
  .chat-container {
    display: none;
  }
}

@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
  }
  .documents-panel {
    display: none;
  }
}
