/* Global Variables & Colors */
:root {
  --bg-dark: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-panel: #1e293b;
  --bg-panel-header: #0f172a;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --success-color: #10b981;
  --success-hover: #059669;
  --success-glow: rgba(16, 185, 129, 0.25);
  --accent-orange: #f59e0b;
  --transition-speed: 0.2s;
  
  --font-ui: 'Outfit', sans-serif;
  --font-mono: 'Fira Code', monospace;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* App Layout */
.app-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  background: linear-gradient(135deg, var(--primary-color), #a855f7);
  padding: 8px;
  border-radius: 8px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-info h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.brand-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Buttons */
.btn {
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition-speed) ease;
  user-select: none;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--success-color);
  color: #fff;
  box-shadow: 0 4px 12px var(--success-glow);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--success-hover);
  transform: translateY(-1px);
}

.btn-success:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-approve {
  background-color: #10b981;
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-approve:hover:not(:disabled) {
  background-color: #059669;
  transform: translateY(-1px);
}

.btn-approve:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-reject {
  background-color: #ef4444;
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-reject:hover:not(:disabled) {
  background-color: #dc2626;
  transform: translateY(-1px);
}

.btn-reject:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.actions-divider {
  width: 1px;
  height: 24px;
  background-color: var(--border-color);
  margin: 0 4px;
}

.btn-secondary {
  background-color: #334155;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: #475569;
}

.btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: 10px;
}

/* Config and stats card */
.card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.folder-info-hidden {
  display: none;
}

.folder-info-show {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  animation: fadeIn 0.3s ease;
}

.folder-name-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
}

.progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-bar-track {
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Search Box */
.search-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-box input {
  width: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px 10px 36px;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-options {
  display: flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.4);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.filter-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  color: var(--text-main);
}

.filter-tab.active {
  background-color: var(--bg-sidebar);
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* File list */
.file-list-container {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.2);
}

.file-list {
  list-style: none;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.85rem;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item:hover {
  background-color: rgba(99, 102, 241, 0.1);
}

.file-item.active {
  background-color: var(--primary-color);
  color: #fff;
}

.file-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.file-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 8px;
}

.file-status-indicator.pending {
  background-color: #64748b;
  box-shadow: 0 0 4px #64748b;
}

.file-status-indicator.edited {
  background-color: var(--accent-orange);
  box-shadow: 0 0 6px var(--accent-orange);
}

.file-status-indicator.approved {
  background-color: var(--success-color);
  box-shadow: 0 0 6px var(--success-color);
}

.file-status-indicator.rejected {
  background-color: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.file-item.active .file-status-indicator.edited,
.file-item.active .file-status-indicator.approved,
.file-item.active .file-status-indicator.rejected {
  background-color: #fff;
  box-shadow: 0 0 6px #fff;
}

/* Patient list arrow */
.patient-arrow {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.file-item:hover .patient-arrow {
  color: var(--text-main);
}

/* Back button */
.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-back:hover {
  color: var(--text-main);
  background-color: rgba(99, 102, 241, 0.15);
}

/* Section label */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 4px 8px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#patient-list-section,
#file-list-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}

#patient-list-section .file-list-container,
#file-list-section .file-list-container {
  flex: 1;
  overflow-y: auto;
}

/* Main Content area */
.main-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Landing Screen */
.landing-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.landing-card {
  max-width: 650px;
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 48px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: scaleUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.icon-bubble {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.image-bubble {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.text-bubble {
  background: linear-gradient(135deg, #a855f7, #ec4899);
}

.link-line {
  height: 2px;
  width: 40px;
  background: linear-gradient(90deg, #3b82f6, #a855f7);
}

.landing-card h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.landing-card p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.instructions-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
  margin-bottom: 32px;
}

.instruction-item {
  display: flex;
  gap: 16px;
}

.instruction-item .num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.instruction-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.instruction-item p {
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* Workspace view */
.workspace-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.workspace-header {
  height: 64px;
  background-color: var(--bg-panel-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.file-name-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  max-width: 60%;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 4px;
}

#badge-status.pending {
  background-color: #475569;
  color: #f1f5f9;
}

#badge-status.edited {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

#badge-status.approved {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

#badge-status.rejected {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.file-name-indicator h2 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.save-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: opacity 0.2s;
}

.save-status.dirty {
  color: var(--accent-orange);
}

/* Split View Grid */
.split-view {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  background-color: var(--bg-dark);
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.panel-header {
  height: 48px;
  background-color: rgba(15, 23, 42, 0.3);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.panel-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.panel-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Divider line */
.view-divider {
  width: 1px;
  background-color: var(--border-color);
  height: 100%;
}

/* Image View Panel styling */
.image-viewport {
  background-color: #020617;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  cursor: grab;
  user-select: none;
  overflow: hidden;
}

.image-viewport:active {
  cursor: grabbing;
}

.image-zoom-container {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  transform-origin: top left;
  transition: transform 0.05s ease-out;
}

.image-zoom-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: block;
  background-color: #fff;
}

.viewer-tools {
  display: flex;
  gap: 2px;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
}

.tool-btn {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.15s;
}

.tool-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-sidebar);
}

.drag-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Editor Panel styling */
.editor-viewport {
  background-color: #0b0f19;
  display: flex;
}

.keyboard-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.editor-container {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  position: relative;
}

.line-numbers {
  width: 44px;
  background-color: rgba(15, 23, 42, 0.3);
  border-right: 1px solid var(--border-color);
  padding: 16px 8px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.5;
  user-select: none;
}

.line-numbers span {
  display: block;
}

textarea#editor-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  padding: 16px;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  height: 100%;
}

/* Workspace Footer */
.workspace-footer {
  height: 56px;
  background-color: var(--bg-panel-header);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.footer-stats {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Keyframe animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
