/* ==========================================================================
   EGYMEDICS - RHEUMATOLOGY SMART CLINICAL SHEET & WORKSPACE STYLES
   ========================================================================== */

/* 1. BACKDROP & MAIN CONTAINER */
.rheum-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.rheum-modal-container {
  background: #ffffff;
  width: min(1440px, 98vw);
  height: min(94vh, 920px);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: #1e293b;
}

/* 2. TOP HEADER BAR */
.rheum-top-header {
  background: linear-gradient(135deg, #07586b, #043b4b);
  color: #ffffff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

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

.rheum-brand-icon {
  font-size: 26px;
  background: rgba(255, 255, 255, 0.12);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rheum-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rheum-title-row h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #ffffff;
}

.rheum-badge-clinic {
  background: #2cc5c2;
  color: #043b4b;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: Tajawal, sans-serif;
}

.rheum-subtitle {
  font-size: 11px;
  color: #a6ced0;
  margin-top: 2px;
}

.rheum-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rheum-mode-pill {
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: 8px;
  display: flex;
  gap: 4px;
}

.btn-mode {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-mode.active {
  background: #07a8ac;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-header-tool {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.btn-header-tool:hover {
  background: rgba(255, 255, 255, 0.22);
}

.rheum-close-btn {
  background: rgba(239, 68, 68, 0.8);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}

.rheum-close-btn:hover {
  background: #dc2626;
}

/* 3. OVERDUE ACTION BANNER */
.rheum-overdue-banner {
  background: #fef2f2;
  border-bottom: 1.5px solid #fecaca;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #991b1b;
  font-size: 12px;
}

.overdue-icon {
  font-size: 20px;
}

.overdue-content {
  flex: 1;
}

.overdue-content strong {
  display: block;
  font-size: 12.5px;
  color: #b91c1c;
}

.btn-overdue-ack {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* 4. PATIENT INFO RIBBON */
.rheum-patient-ribbon {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  flex-shrink: 0;
}

.ribbon-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ribbon-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  font-weight: 600;
}

.ribbon-val {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
}

.ribbon-item code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: #0f766e;
}

.text-danger {
  color: #dc2626 !important;
}

.ribbon-actions {
  margin-left: auto;
}

html[dir="rtl"] .ribbon-actions {
  margin-left: 0;
  margin-right: auto;
}

.btn-copy-prev {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-copy-prev:hover {
  background: #dbeafe;
}

/* 5. AI VOICE DICTATION & PROTOCOLS STRIP */
.rheum-voice-strip {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.btn-voice-mic {
  background: #0f766e;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-voice-mic:hover {
  background: #115e59;
}

.btn-voice-mic.recording-pulse {
  background: #dc2626;
  animation: pulseRecording 1.4s infinite;
}

@keyframes pulseRecording {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.voice-wave-status {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #dc2626;
  font-size: 11.5px;
  font-weight: 600;
}

.wave-bar {
  display: inline-block;
  width: 3px;
  height: 14px;
  background: #dc2626;
  border-radius: 2px;
  animation: waveAnimation 0.8s infinite ease-in-out alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.2s; height: 18px; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; height: 12px; }

@keyframes waveAnimation {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.2); }
}

.quick-protocol-dropdown {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

html[dir="rtl"] .quick-protocol-dropdown {
  margin-left: 0;
  margin-right: auto;
}

.quick-protocol-dropdown label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.quick-protocol-dropdown select {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
}

/* AI ENTITY EXTRACTION CARD */
.ai-extracted-card {
  background: #faf5ff;
  border-bottom: 1.5px solid #e9d5ff;
  padding: 12px 20px;
  font-size: 12px;
}

.ai-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.ai-badge {
  color: #7e22ce;
  font-weight: 800;
  font-size: 12px;
}

.btn-apply-ai {
  background: #7e22ce;
  color: #ffffff;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ai-transcript-box {
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e9d5ff;
  color: #475569;
  margin-bottom: 8px;
  font-size: 11.5px;
}

.ai-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.ai-chips-grid div {
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #e9d5ff;
  font-size: 11px;
}

/* 6. MAIN MODAL BODY & VIEWS */
.rheum-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  background: #f8fafc;
}

/* VIEW 1: QUICK VISIT GRID */
.quick-visit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 16px;
}

@media (max-width: 1024px) {
  .quick-visit-grid {
    grid-template-columns: 1fr;
  }
}

.quick-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-card h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  border-bottom: 1.5px solid #f1f5f9;
  padding-bottom: 8px;
}

.form-group-custom label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}

.quick-textarea, .quick-input, .quick-select {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  box-sizing: border-box;
}

.quick-textarea:focus, .quick-input:focus, .quick-select:focus {
  border-color: #07a8ac;
  outline: none;
  box-shadow: 0 0 0 3px rgba(7, 168, 172, 0.15);
}

/* VAS SLIDER BOX */
.vas-box-container {
  background: #f0fdfa;
  border: 1.5px solid #99f6e4;
  border-radius: 8px;
  padding: 12px;
}

.vas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.vas-number-badge {
  background: #0d93a5;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vas-slider-range {
  width: 100%;
  accent-color: #0d93a5;
  cursor: pointer;
}

.vas-labels-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
}

/* QUICK JOINT PILLS */
.card-head-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quick-joint-counts {
  font-size: 11.5px;
  display: flex;
  gap: 10px;
  color: #475569;
}

.helper-text {
  font-size: 11px;
  color: #64748b;
  margin: 0;
}

.quick-joints-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.joint-quick-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.j-name {
  font-weight: 600;
  color: #334155;
}

.btn-j-mini {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 2px;
}

.btn-j-mini.active-tender {
  background: #ea580c;
  color: #ffffff;
  border-color: #c2410c;
}

.btn-j-mini.active-swollen {
  background: #0284c7;
  color: #ffffff;
  border-color: #0369a1;
}

/* DAS28 SCORE CARD */
.das28-quick-card {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: auto;
}

.das-label {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 700;
}

.das-val-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.das-val {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
}

.das28-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-remission { background: #dcfce7; color: #15803d; }
.badge-low { background: #e0f2fe; color: #0369a1; }
.badge-mod { background: #fef3c7; color: #b45309; }
.badge-high { background: #fee2e2; color: #b91c1c; }

/* VIEW 2: FULL ASSESSMENT LAYOUT */
.full-assessment-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 16px;
}

@media (max-width: 1100px) {
  .full-assessment-layout {
    grid-template-columns: 1fr;
  }
}

.section-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.section-card h4 {
  margin: 0 0 12px;
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

/* HOMUNCULUS SVG */
.joint-legend {
  font-size: 11px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-tender { background: #ea580c; }
.dot-swollen { background: #0284c7; }
.dot-both { background: #dc2626; }

.homunculus-svg-wrapper {
  text-align: center;
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.homunculus-svg {
  max-width: 260px;
  height: auto;
}

.h-joint-dot {
  cursor: pointer;
  transition: all 0.2s;
}

.h-joint-dot:hover {
  stroke: #ffffff;
  stroke-width: 2px;
}

/* JOINT MATRIX TABLE */
.joint-table-wrapper {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.joint-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.joint-matrix-table th {
  background: #f1f5f9;
  padding: 6px 8px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  position: sticky;
  top: 0;
}

html[dir="rtl"] .joint-matrix-table th {
  text-align: right;
}

.joint-matrix-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.tbl-j-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.table-micro-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 10.5px;
}

/* REVIEW & LAB PANEL */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.checkbox-chips-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-chip {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.check-chip input {
  accent-color: #07a8ac;
}

.lab-grid-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.lab-cell label {
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  display: block;
  margin-bottom: 3px;
}

.lab-val-trend {
  position: relative;
}

.trend-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 4px;
  margin-top: 2px;
  display: inline-block;
}

.trend-down {
  background: #dcfce7;
  color: #166534;
}

.badge-synced {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.secretary-ocr-preview {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.ocr-icon {
  font-size: 22px;
}

.ocr-details {
  flex: 1;
  font-size: 11.5px;
}

.ocr-details small {
  display: block;
  color: #0369a1;
  margin-top: 2px;
}

.btn-view-doc {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* TIMELINE */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 2px solid #e2e8f0;
  padding-left: 14px;
  margin-left: 8px;
}

html[dir="rtl"] .timeline-list {
  border-left: none;
  border-right: 2px solid #e2e8f0;
  padding-left: 0;
  padding-right: 14px;
  margin-left: 0;
  margin-right: 8px;
}

.timeline-item {
  position: relative;
}

.tl-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  border: 2px solid #ffffff;
}

html[dir="rtl"] .tl-dot {
  left: auto;
  right: -20px;
}

.timeline-current .tl-dot {
  background: #0d93a5;
  box-shadow: 0 0 0 3px rgba(13, 147, 165, 0.2);
}

.tl-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  font-size: 11.5px;
}

.tl-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.tl-das-score {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
}

.tl-summary {
  color: #334155;
  line-height: 1.5;
}

.tl-plan {
  color: #b45309;
  font-weight: 600;
  margin-top: 3px;
}

/* 7. FOOTER ACTION BAR */
.rheum-modal-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.footer-status-text {
  font-size: 11.5px;
  color: #64748b;
}

.footer-action-btns {
  display: flex;
  gap: 10px;
}

.btn-footer-ghost {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-footer-print {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-footer-save {
  background: #0d93a5;
  color: #ffffff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(13, 147, 165, 0.3);
}

.btn-footer-save:hover {
  background: #0a7685;
}

/* ==========================================================================
   RESPONSIVE & MOBILE / TABLET OPTIMIZATIONS (< 768px & < 480px)
   ========================================================================== */

@media (max-width: 768px) {
  .rheum-modal-backdrop {
    padding: 6px;
  }

  .rheum-modal-container {
    width: 100vw;
    height: 98vh;
    border-radius: 10px;
  }

  .rheum-top-header {
    padding: 10px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .rheum-header-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .rheum-patient-ribbon {
    padding: 8px 12px;
    gap: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ribbon-actions {
    grid-column: span 2;
    margin: 4px 0 0;
  }

  .btn-copy-prev {
    width: 100%;
    justify-content: center;
  }

  .rheum-voice-strip {
    padding: 8px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .btn-voice-mic {
    width: 100%;
    justify-content: center;
  }

  .quick-protocol-dropdown {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .quick-protocol-dropdown select {
    width: 100%;
  }

  .rheum-modal-body {
    padding: 12px 10px;
  }

  .quick-joints-pills {
    grid-template-columns: 1fr;
  }

  .full-assessment-layout {
    grid-template-columns: 1fr;
  }

  .homunculus-svg {
    max-width: 220px;
  }

  .rheum-modal-footer {
    padding: 10px 12px;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .footer-action-btns {
    flex-direction: column;
    gap: 6px;
  }

  .footer-action-btns button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .rheum-title-row h2 {
    font-size: 1rem;
  }

  .rheum-badge-clinic {
    font-size: 9.5px;
    padding: 1px 6px;
  }

  .btn-mode {
    font-size: 10.5px;
    padding: 5px 8px;
  }

  .btn-header-tool {
    font-size: 10.5px;
    padding: 5px 8px;
  }

  .review-grid, .lab-grid-inputs {
    grid-template-columns: 1fr;
  }
}

