/* ==========================================================================
   EGYMEDICS — UNIFIED SMART CLINICAL SHEETS & WORKSPACE STYLES
   Specialized Musculoskeletal Healthcare Platform (6 Clinical Sheets)
   ========================================================================== */

:root {
  --brand: #0d93a5;
  --brand-hover: #0a7685;
  --brand-dark: #043b4b;
  --brand-darker: #022530;
  --brand-light: #e6f7fa;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #0d93a5;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --ink-muted: #64748b;
  --ink-light: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

body.clinical-workspace-body {
  margin: 0;
  padding: 0;
  background-color: #f1f5f9;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* 1. TOP GLOBAL APP HEADER */
.cw-top-header {
  background: linear-gradient(135deg, var(--brand-darker) 0%, var(--brand-dark) 100%);
  color: #ffffff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cw-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cw-brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffffff;
}

.cw-brand-icon {
  width: 36px;
  height: 36px;
  background: rgba(13, 147, 165, 0.25);
  border: 1.5px solid rgba(13, 147, 165, 0.6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.cw-brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cw-brand-badge {
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.cw-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cw-btn-header {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.cw-btn-header:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 2. SPECIALTY SELECTOR BAR (THE 6 CLINICAL SPECIALTIES) */
.cw-specialty-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.cw-specialty-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 8px;
}

.cw-specialty-tab {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: #f1f5f9;
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.cw-specialty-tab:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.cw-specialty-tab.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand-hover);
  box-shadow: 0 2px 4px rgba(13, 147, 165, 0.25);
}

/* 3. MAIN WORKSPACE CONTAINER */
.cw-main-layout {
  max-width: 1560px;
  margin: 16px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1280px) {
  .cw-main-layout {
    grid-template-columns: 200px 1fr 300px;
  }
}

@media (max-width: 1024px) {
  .cw-main-layout {
    grid-template-columns: 1fr;
  }
}

/* 4. LEFT NAVIGATION SIDEBAR */
.cw-sidebar {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 100px;
}

.cw-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s ease;
}

.cw-nav-item:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.cw-nav-item.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 700;
}

.cw-nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
}

/* 5. CENTER CLINICAL SHEET AREA */
.cw-center-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Patient Header Card */
.cw-patient-banner {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.cw-patient-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cw-patient-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #0284c7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.cw-patient-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 2px 0;
}

.cw-patient-meta {
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  gap: 12px;
  align-items: center;
}

.cw-visit-type-toggle {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border);
}

.cw-btn-vtype {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cw-btn-vtype.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Section Card */
.cw-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
}

.cw-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--surface-alt);
}

.cw-card-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--brand-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Input Fields */
.cw-form-group {
  margin-bottom: 14px;
}

.cw-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

.cw-input, .cw-select, .cw-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.cw-input:focus, .cw-select:focus, .cw-textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 147, 165, 0.12);
}

.cw-textarea {
  min-height: 72px;
  resize: vertical;
}

/* Pill / Checkbox Groups */
.cw-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cw-checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.cw-checkbox-pill:hover {
  background: #e2e8f0;
}

.cw-checkbox-pill input[type="checkbox"],
.cw-checkbox-pill input[type="radio"] {
  accent-color: var(--brand);
  margin: 0;
  cursor: pointer;
}

.cw-checkbox-pill.checked {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand-dark);
}

/* Grid Layouts inside cards */
.cw-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.cw-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.cw-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .cw-grid-2, .cw-grid-3, .cw-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* 6. SPECIAL CLINICAL CONTROLS */

/* VAS Pain Scale Slider (0-10) */
.cw-vas-container {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 10px 0;
}

.cw-vas-scale {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 8px;
}

.cw-vas-btn {
  flex: 1;
  padding: 10px 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.cw-vas-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.cw-vas-btn.active {
  color: #ffffff !important;
  transform: scale(1.05);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Glasgow Coma Scale (GCS) Box */
.cw-gcs-box {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 10px 0;
}

.cw-gcs-total-badge {
  background: #1e40af;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Cranial Nerves Grid */
.cw-cn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.cw-cn-table th {
  background: #f8fafc;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  color: var(--ink-secondary);
}

.cw-cn-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

html[dir="rtl"] .cw-cn-table th,
html[dir="rtl"] .cw-cn-table td {
  text-align: right;
}

/* 7. RIGHT UTILITY PANEL (AI TOOLS, INVESTIGATIONS, TIMELINE) */
.cw-right-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cw-ai-box {
  background: linear-gradient(135deg, #043b4b 0%, #07586b 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.cw-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cw-ai-title {
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cw-btn-ai-action {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  transition: background 0.15s ease;
  text-align: left;
}

.cw-btn-ai-action:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Upload dropzone */
.cw-upload-box {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cw-upload-box:hover {
  border-color: var(--brand);
  background: var(--surface-alt);
}

/* Timeline */
.cw-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
}

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

.cw-timeline-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  margin-top: 5px;
  flex-shrink: 0;
}

/* Actions footer inside center panel */
.cw-actions-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
}

.cw-btn-primary {
  background: var(--brand);
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.cw-btn-primary:hover {
  background: var(--brand-hover);
}

.cw-btn-secondary {
  background: #ffffff;
  color: var(--ink-secondary);
  border: 1.5px solid var(--border);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cw-btn-secondary:hover {
  background: var(--surface-alt);
}

/* 8. PRINT CONSULTATION REPORT */
@media print {
  .cw-top-header,
  .cw-specialty-bar,
  .cw-sidebar,
  .cw-right-panel,
  .cw-actions-footer,
  .btn-print-hide {
    display: none !important;
  }

  body.clinical-workspace-body {
    background: #ffffff !important;
  }

  .cw-main-layout {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .cw-card {
    box-shadow: none !important;
    border: 1px solid #94a3b8 !important;
    page-break-inside: avoid;
    margin-bottom: 12px !important;
  }
}
