/* ============================================
   Eddie Dental AI — Design System
   ============================================ */

:root {
  --eddie-primary:    #0A2647;
  --eddie-secondary:  #144272;
  --eddie-accent:     #205295;
  --eddie-highlight:  #2C74B3;
  --eddie-success:    #059669;
  --eddie-success-light: #D1FAE5;
  --eddie-warning:    #D97706;
  --eddie-warning-light: #FEF3C7;
  --eddie-danger:     #DC2626;
  --eddie-bg:         #F0F4F8;
  --eddie-surface:    #FFFFFF;
  --eddie-text:       #1E293B;
  --eddie-text-muted: #64748B;
  --eddie-border:     #E2E8F0;
  --eddie-radius:     12px;
  --eddie-radius-sm:  8px;
  --eddie-shadow:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --eddie-shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --eddie-shadow-lg:  0 8px 24px rgba(0,0,0,0.1);
}

/* ---- Base ---- */

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--eddie-bg);
  color: var(--eddie-text);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* ---- Header Bar ---- */

.eddie-header {
  background: var(--eddie-surface);
  border-bottom: 1px solid var(--eddie-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.eddie-header img {
  height: 40px;
  width: auto;
}

.eddie-header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--eddie-primary);
  letter-spacing: -0.01em;
}

/* ---- Step Progress Indicator ---- */

.step-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 28px 16px 20px;
  max-width: 600px;
  margin: 0 auto;
}

.step-progress .step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--eddie-text-muted);
}

.step-progress .step .step-number {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--eddie-border);
  color: var(--eddie-text-muted);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.step-progress .step.active .step-number {
  background: var(--eddie-accent);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(44, 116, 179, 0.18);
}

.step-progress .step.completed .step-number {
  background: var(--eddie-success);
  color: #fff;
}

.step-progress .step-line {
  width: 60px;
  height: 3px;
  background: var(--eddie-border);
  margin: 0 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.step-progress .step-line.completed {
  background: var(--eddie-success);
}

/* ---- Card System ---- */

.eddie-card {
  background: var(--eddie-surface);
  border-radius: var(--eddie-radius);
  border: 1px solid var(--eddie-border);
  box-shadow: var(--eddie-shadow);
  padding: 28px 32px;
}

/* ---- Section Titles ---- */

.section-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--eddie-primary);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--eddie-highlight);
}

/* ---- Form Controls ---- */

.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--eddie-text);
  margin-bottom: 4px;
}

.form-control, .form-select {
  border: 1.5px solid var(--eddie-border);
  border-radius: var(--eddie-radius-sm);
  padding: 9px 14px;
  font-size: 0.9375rem;
  color: var(--eddie-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--eddie-highlight);
  box-shadow: 0 0 0 3px rgba(44, 116, 179, 0.15);
  outline: none;
}

textarea.form-control {
  resize: vertical;
}

/* ---- Buttons ---- */

.btn-eddie-primary {
  background: var(--eddie-primary);
  color: #fff;
  border: none;
  border-radius: var(--eddie-radius-sm);
  font-weight: 600;
  padding: 12px 28px;
  font-size: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-eddie-primary:hover {
  background: var(--eddie-secondary);
  transform: translateY(-1px);
  box-shadow: var(--eddie-shadow-md);
  color: #fff;
}

.btn-eddie-success {
  background: var(--eddie-success);
  color: #fff;
  border: none;
  border-radius: var(--eddie-radius-sm);
  font-weight: 600;
  padding: 12px 28px;
  font-size: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-eddie-success:hover {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: var(--eddie-shadow-md);
  color: #fff;
}

.btn-eddie-outline {
  background: transparent;
  color: var(--eddie-accent);
  border: 2px solid var(--eddie-accent);
  border-radius: var(--eddie-radius-sm);
  font-weight: 600;
  padding: 10px 24px;
  font-size: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-eddie-outline:hover {
  background: var(--eddie-accent);
  color: #fff;
}

/* ---- Specialty Selector ---- */

.specialty-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.specialty-option {
  flex: 1;
  min-width: 160px;
  cursor: pointer;
  margin: 0;
}

.specialty-option input[type="radio"] {
  display: none;
}

.specialty-option-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 16px;
  border: 2px solid var(--eddie-border);
  border-radius: var(--eddie-radius);
  transition: all 0.25s ease;
  background: var(--eddie-surface);
}

.specialty-option-body:hover {
  border-color: var(--eddie-highlight);
  box-shadow: var(--eddie-shadow-md);
  transform: translateY(-2px);
}

.specialty-option input[type="radio"]:checked + .specialty-option-body {
  border-color: var(--eddie-accent);
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  box-shadow: 0 0 0 3px rgba(32, 82, 149, 0.15);
}

.specialty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.specialty-option-body strong {
  font-size: 0.95rem;
  color: var(--eddie-primary);
  margin-bottom: 2px;
}

.specialty-option-body small {
  font-size: 0.8rem;
  color: var(--eddie-text-muted);
}

/* ---- Health Questionnaire Tabs ---- */

.hq-tabs {
  display: flex;
  gap: 4px;
  background: var(--eddie-bg);
  border-radius: var(--eddie-radius-sm);
  padding: 4px;
  width: fit-content;
}

.hq-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--eddie-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.hq-tab.active {
  background: var(--eddie-surface);
  color: var(--eddie-accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.hq-tab:hover:not(.active) {
  color: var(--eddie-text);
}

/* ---- Upload Drop Zone ---- */

.upload-zone {
  border: 2px dashed var(--eddie-border);
  border-radius: var(--eddie-radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--eddie-text-muted);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--eddie-highlight);
  background: rgba(44, 116, 179, 0.04);
  color: var(--eddie-accent);
}

.upload-zone p {
  margin: 4px 0;
}

.upload-zone .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  display: block;
}

/* ---- Health Questionnaire Structured Form ---- */

.hq-fieldset {
  margin-bottom: 20px;
}

.hq-fieldset-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--eddie-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--eddie-border);
}

.hq-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.hq-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.hq-check-item:hover {
  background: var(--eddie-bg);
}

.hq-check-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--eddie-accent);
}

.hq-check-item label {
  font-size: 0.875rem;
  color: var(--eddie-text);
  cursor: pointer;
}

.hq-detail-input {
  margin-top: 4px;
  font-size: 0.8rem;
  padding: 5px 10px;
  border: 1px solid var(--eddie-border);
  border-radius: 6px;
  width: 100%;
  display: none;
}

.hq-detail-input.visible {
  display: block;
}

/* ---- Treatment Option Cards ---- */

.treatment-option-card {
  border: 2px solid var(--eddie-border);
  border-radius: var(--eddie-radius);
  padding: 24px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: var(--eddie-surface);
  height: 100%;
}

.treatment-option-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--eddie-shadow-lg);
  border-color: var(--eddie-highlight);
}

.treatment-option-card.selected {
  border-color: var(--eddie-success);
  background: linear-gradient(135deg, #F0FDF4 0%, #ECFDF5 100%);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.treatment-option-card .option-number {
  display: inline-block;
  background: var(--eddie-accent);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  text-align: center;
  line-height: 28px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.treatment-option-card.selected .option-number {
  background: var(--eddie-success);
}

.treatment-option-card h5 {
  font-weight: 700;
  color: var(--eddie-primary);
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.treatment-option-card .option-body {
  font-size: 0.9rem;
  color: var(--eddie-text);
  line-height: 1.6;
}

/* ---- Interpretation / Analysis Boxes ---- */

.interpretation-box {
  background: var(--eddie-bg);
  border-left: 4px solid var(--eddie-highlight);
  border-radius: 0 var(--eddie-radius-sm) var(--eddie-radius-sm) 0;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.diagnocat-box {
  background: var(--eddie-warning-light);
  border-left: 4px solid var(--eddie-warning);
  border-radius: 0 var(--eddie-radius-sm) var(--eddie-radius-sm) 0;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.analysis-content {
  background: var(--eddie-surface);
  border-radius: var(--eddie-radius);
  padding: 24px 28px;
  box-shadow: var(--eddie-shadow);
  margin-bottom: 24px;
}

/* ---- Patient Info Bar ---- */

.patient-info-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 14px 20px;
  background: var(--eddie-surface);
  border-radius: var(--eddie-radius-sm);
  border: 1px solid var(--eddie-border);
}

.patient-info-bar .info-item {
  font-size: 0.9rem;
  color: var(--eddie-text);
}

.patient-info-bar .info-item strong {
  color: var(--eddie-primary);
}

.specialty-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  color: var(--eddie-accent);
  border: 1px solid rgba(32, 82, 149, 0.2);
}

/* ---- Loading States ---- */

.eddie-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.eddie-loader .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--eddie-border);
  border-top-color: var(--eddie-accent);
  border-radius: 50%;
  animation: eddie-spin 0.8s linear infinite;
  margin-bottom: 20px;
}

@keyframes eddie-spin {
  to { transform: rotate(360deg); }
}

.eddie-loader .loader-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--eddie-text-muted);
}

.eddie-loader .loader-subtext {
  font-size: 0.85rem;
  color: var(--eddie-text-muted);
  margin-top: 4px;
  opacity: 0.7;
}

/* ---- Plan Editor ---- */

.plan-toggle-tabs {
  display: flex;
  gap: 4px;
  background: var(--eddie-bg);
  border-radius: var(--eddie-radius-sm);
  padding: 4px;
  width: fit-content;
  margin-bottom: 16px;
}

.plan-toggle-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--eddie-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.plan-toggle-tab.active {
  background: var(--eddie-surface);
  color: var(--eddie-accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.plan-preview {
  padding: 24px;
  line-height: 1.7;
  font-size: 0.9375rem;
}

.plan-preview h1, .plan-preview h2, .plan-preview h3 {
  color: var(--eddie-primary);
  margin-top: 20px;
}

.plan-editor-textarea {
  font-family: 'Inter', monospace;
  font-size: 0.9rem;
  padding: 16px;
  border: 1.5px solid var(--eddie-border);
  border-radius: var(--eddie-radius-sm);
  width: 100%;
  min-height: 400px;
  resize: vertical;
  line-height: 1.7;
}

.plan-editor-textarea:focus {
  border-color: var(--eddie-highlight);
  box-shadow: 0 0 0 3px rgba(44, 116, 179, 0.15);
  outline: none;
}

/* ---- Action Cards ---- */

.action-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--eddie-radius);
  border: 2px solid var(--eddie-border);
  background: var(--eddie-surface);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.action-card:hover {
  border-color: var(--eddie-highlight);
  box-shadow: var(--eddie-shadow-md);
  transform: translateY(-1px);
}

.action-card .action-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.action-card .action-text strong {
  display: block;
  font-size: 1rem;
  color: var(--eddie-primary);
  margin-bottom: 2px;
}

.action-card .action-text small {
  color: var(--eddie-text-muted);
  font-size: 0.85rem;
}

/* ---- Back Link ---- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--eddie-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 20px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--eddie-accent);
}

/* ---- Alerts ---- */

.eddie-alert-info {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--eddie-radius-sm);
  padding: 14px 18px;
  color: var(--eddie-accent);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.eddie-alert-warning {
  background: var(--eddie-warning-light);
  border: 1px solid #FDE68A;
  border-radius: var(--eddie-radius-sm);
  padding: 14px 18px;
  color: #92400E;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.eddie-alert-danger {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--eddie-radius-sm);
  padding: 14px 18px;
  color: var(--eddie-danger);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ---- OCR Processing ---- */

.ocr-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--eddie-border);
  border-top-color: var(--eddie-accent);
  border-radius: 50%;
  animation: eddie-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .eddie-card {
    padding: 20px 16px;
  }

  .step-progress .step .step-label {
    display: none;
  }

  .specialty-selector {
    flex-direction: column;
  }

  .specialty-option {
    min-width: 100%;
  }

  .hq-check-grid {
    grid-template-columns: 1fr;
  }

  .patient-info-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .hq-tabs {
    width: 100%;
  }

  .hq-tab {
    flex: 1;
    text-align: center;
  }
}

/* ============================================
   Language Toggle
   ============================================ */

.lang-toggle {
  background: var(--eddie-bg);
  border: 1.5px solid var(--eddie-border);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--eddie-accent);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.lang-toggle:hover {
  background: var(--eddie-accent);
  color: #fff;
  border-color: var(--eddie-accent);
}

.lang-dropdown {
  position: relative;
  display: inline-block;
  margin-left: auto;
}

.lang-toggle {
  margin-left: 0;
}

.lang-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--eddie-surface);
  border: 1.5px solid var(--eddie-border);
  border-radius: 12px;
  box-shadow: var(--eddie-shadow-lg);
  z-index: 1000;
  min-width: 120px;
  overflow: hidden;
}

.lang-dropdown-menu.show {
  display: block;
}

.lang-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--eddie-text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.lang-dropdown-item:hover {
  background: var(--eddie-bg);
}

.lang-dropdown-item.active {
  color: var(--eddie-accent);
  background: rgba(79, 70, 229, 0.08);
}

/* ============================================
   Login Page
   ============================================ */

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 65px);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo-wrap {
  margin-bottom: 20px;
}

.login-logo {
  height: 64px;
  border-radius: 12px;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--eddie-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--eddie-text-muted);
  margin-bottom: 24px;
}

.login-card .form-label {
  display: block;
  text-align: left;
}

.login-footer {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--eddie-text-muted);
}

/* ============================================
   Extended Header (auth pages)
   ============================================ */

.eddie-header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-user-info {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--eddie-text-muted);
}

.header-nav-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--eddie-accent);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--eddie-radius-sm);
  transition: all 0.2s ease;
}

.header-nav-link:hover {
  background: var(--eddie-bg);
  color: var(--eddie-primary);
}

.header-logout-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--eddie-danger);
  background: none;
  border: 1.5px solid var(--eddie-danger);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-logout-btn:hover {
  background: var(--eddie-danger);
  color: #fff;
}

/* ============================================
   Dashboard
   ============================================ */

.dashboard-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dashboard-toolbar .search-input {
  flex: 1;
  min-width: 200px;
}

.dashboard-tabs {
  display: flex;
  gap: 4px;
  background: var(--eddie-bg);
  border-radius: 20px;
  padding: 4px;
  margin-bottom: 20px;
}

.dashboard-tab {
  padding: 8px 20px;
  border-radius: 16px;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--eddie-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dashboard-tab.active {
  background: var(--eddie-surface);
  color: var(--eddie-accent);
  box-shadow: var(--eddie-shadow);
}

.patient-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.patient-table th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--eddie-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--eddie-border);
  text-align: left;
}

.patient-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--eddie-border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.patient-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.patient-row:hover {
  background: #F8FAFC;
}

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.status-badge.intake { background: #DBEAFE; color: #1D4ED8; }
.status-badge.analyzed { background: var(--eddie-warning-light); color: #92400E; }
.status-badge.plan_selected { background: #E0E7FF; color: #3730A3; }
.status-badge.plan_generated { background: var(--eddie-success-light); color: #065F46; }
.status-badge.completed { background: #F1F5F9; color: #475569; }

/* Priority badges for treatment list */
.priority-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.priority-badge.immediate { background: #FEE2E2; color: #991B1B; }
.priority-badge.high { background: #FED7AA; color: #9A3412; }
.priority-badge.medium { background: #FEF3C7; color: #92400E; }
.priority-badge.low { background: #D1FAE5; color: #065F46; }

.pagination-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--eddie-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 1rem;
  font-weight: 500;
}

.empty-state-sub {
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ============================================
   Patient Page Tabs
   ============================================ */

.patient-tabs {
  display: flex;
  gap: 4px;
  background: var(--eddie-bg);
  border-radius: 20px;
  padding: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.patient-tab {
  padding: 8px 18px;
  border-radius: 16px;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--eddie-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.patient-tab.active {
  background: var(--eddie-surface);
  color: var(--eddie-accent);
  box-shadow: var(--eddie-shadow);
}

.patient-tab-content {
  display: none;
}

.patient-tab-content.active {
  display: block;
}

/* ============================================
   Settings & Admin
   ============================================ */

.settings-form .form-group {
  margin-bottom: 16px;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--eddie-border);
  margin: 24px 0;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-table th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--eddie-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--eddie-border);
  text-align: left;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--eddie-border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.role-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.role-badge.admin { background: #FEE2E2; color: #991B1B; }
.role-badge.doctor { background: #DBEAFE; color: #1D4ED8; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: var(--eddie-surface);
  border-radius: var(--eddie-radius);
  padding: 28px 32px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--eddie-shadow-lg);
}

.modal-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--eddie-primary);
  margin-bottom: 20px;
}

.btn-group-end {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.btn-eddie-danger {
  background: var(--eddie-danger);
  color: #fff;
  border: none;
  border-radius: var(--eddie-radius-sm);
  padding: 8px 20px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-eddie-danger:hover {
  background: #B91C1C;
}

.btn-eddie-secondary {
  background: var(--eddie-bg);
  color: var(--eddie-text);
  border: 1.5px solid var(--eddie-border);
  border-radius: var(--eddie-radius-sm);
  padding: 8px 20px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-eddie-secondary:hover {
  background: var(--eddie-border);
}

/* ============================================
   Share Modal & Chips
   ============================================ */

.shared-user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.shared-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--eddie-bg);
  border: 1px solid var(--eddie-border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
}

.shared-user-chip .chip-remove {
  cursor: pointer;
  color: var(--eddie-danger);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ============================================
   File Grid
   ============================================ */

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.file-card {
  border: 1px solid var(--eddie-border);
  border-radius: var(--eddie-radius-sm);
  padding: 14px;
  text-align: center;
  transition: all 0.2s ease;
}

.file-card:hover {
  border-color: var(--eddie-highlight);
  box-shadow: var(--eddie-shadow);
}

.file-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.file-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--eddie-text);
  word-break: break-all;
}

.file-date {
  font-size: 0.7rem;
  color: var(--eddie-text-muted);
  margin-top: 4px;
}

/* ============================================
   History Timeline
   ============================================ */

.history-timeline {
  position: relative;
  padding-left: 28px;
}

.history-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--eddie-border);
}

.history-entry {
  position: relative;
  margin-bottom: 20px;
}

.history-entry-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--eddie-highlight);
  border: 2px solid var(--eddie-surface);
}

.history-entry-date {
  font-size: 0.75rem;
  color: var(--eddie-text-muted);
  margin-bottom: 2px;
}

.history-entry-content {
  font-size: 0.875rem;
  color: var(--eddie-text);
}

.history-entry-user {
  font-size: 0.75rem;
  color: var(--eddie-text-muted);
  font-style: italic;
}

/* ============================================
   Treatment Staging
   ============================================ */

.staging-summary {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--eddie-bg);
  border-radius: var(--eddie-radius-sm);
  margin-bottom: 24px;
}

.staging-stat {
  font-size: 0.875rem;
  color: var(--eddie-text-muted);
}

.staging-stat strong {
  color: var(--eddie-primary);
  font-weight: 700;
}

.stage-card {
  border: 2px solid var(--eddie-border);
  border-radius: var(--eddie-radius);
  padding: 20px 24px;
  margin-bottom: 0;
}

.stage-header {
  margin-bottom: 16px;
}

.stage-number-badge {
  display: inline-block;
  background: var(--eddie-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.stage-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--eddie-primary);
  margin: 0 0 4px;
}

.stage-goal {
  font-size: 0.85rem;
  color: var(--eddie-text-muted);
  margin: 0;
}

.appointment-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: #FAFBFC;
  border: 1px solid var(--eddie-border);
  border-radius: var(--eddie-radius-sm);
  margin-bottom: 10px;
}

.appointment-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--eddie-highlight);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.appointment-content {
  flex: 1;
}

.appointment-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--eddie-primary);
  margin: 0 0 6px;
}

.appointment-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.meta-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.meta-badge.duration {
  background: #DBEAFE;
  color: #1D4ED8;
}

.meta-badge.anesthesia-yes {
  background: var(--eddie-warning-light);
  color: #92400E;
}

.meta-badge.anesthesia-no {
  background: #F1F5F9;
  color: #64748B;
}

.procedure-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.825rem;
  color: var(--eddie-text);
}

.procedure-list li {
  margin-bottom: 2px;
}

.post-op-text {
  font-size: 0.8rem;
  color: var(--eddie-text-muted);
  margin-top: 6px;
  font-style: italic;
}

.wait-period {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.wait-line {
  flex: 1;
  height: 0;
  border-top: 2px dashed var(--eddie-border);
}

.wait-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--eddie-warning);
  white-space: nowrap;
}

/* Appointment plan table (printable) */
.appointment-plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.appointment-plan-table th,
.appointment-plan-table td {
  padding: 10px 14px;
  border: 1px solid var(--eddie-border);
  text-align: left;
}

.appointment-plan-table th {
  background: var(--eddie-bg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.appointment-plan-table .wait-row td {
  text-align: center;
  font-style: italic;
  color: var(--eddie-warning);
  background: #FFFBEB;
  border-left: none;
  border-right: none;
}

@media print {
  .eddie-header, .lang-toggle, .eddie-header-nav, .no-print { display: none !important; }
  .eddie-card { border: none; box-shadow: none; }
  body { background: #fff; }
}

/* ============================================
   RTL Support (Hebrew)
   ============================================ */

[dir="rtl"] .eddie-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .lang-dropdown {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .lang-dropdown-menu {
  right: auto;
  left: 0;
}

[dir="rtl"] .lang-dropdown-item {
  text-align: right;
}

[dir="rtl"] .step-progress {
  direction: ltr;
}

[dir="rtl"] .interpretation-box {
  border-left: none;
  border-right: 4px solid var(--eddie-highlight);
  border-radius: var(--eddie-radius-sm) 0 0 var(--eddie-radius-sm);
}

[dir="rtl"] .diagnocat-box {
  border-left: none;
  border-right: 4px solid var(--eddie-warning);
  border-radius: var(--eddie-radius-sm) 0 0 var(--eddie-radius-sm);
}

[dir="rtl"] .back-link {
  flex-direction: row-reverse;
}

[dir="rtl"] .section-title {
  text-align: right;
}

[dir="rtl"] .form-label {
  text-align: right;
}

[dir="rtl"] .form-control,
[dir="rtl"] .form-select {
  text-align: right;
}

[dir="rtl"] textarea.form-control {
  text-align: right;
}

[dir="rtl"] .hq-fieldset-title {
  text-align: right;
}

[dir="rtl"] .hq-check-item {
  direction: rtl;
}

[dir="rtl"] .ocr-spinner {
  margin-right: 0;
  margin-left: 8px;
}

[dir="rtl"] .action-card {
  flex-direction: row-reverse;
}

[dir="rtl"] .action-card .action-text {
  text-align: right;
}

[dir="rtl"] .patient-info-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] .plan-preview {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .plan-editor-textarea {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .login-card .form-label {
  text-align: right;
}

[dir="rtl"] .eddie-header-nav {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .patient-table th,
[dir="rtl"] .patient-table td,
[dir="rtl"] .admin-table th,
[dir="rtl"] .admin-table td {
  text-align: right;
}

[dir="rtl"] .history-timeline {
  padding-left: 0;
  padding-right: 28px;
}

[dir="rtl"] .history-timeline::before {
  left: auto;
  right: 8px;
}

[dir="rtl"] .history-entry-dot {
  left: auto;
  right: -24px;
}

[dir="rtl"] .procedure-list {
  padding-left: 0;
  padding-right: 18px;
}

[dir="rtl"] .appointment-card {
  flex-direction: row-reverse;
}

[dir="rtl"] .appointment-plan-table th,
[dir="rtl"] .appointment-plan-table td {
  text-align: right;
}

@media (max-width: 768px) {
  [dir="rtl"] .patient-info-bar {
    flex-direction: column;
    align-items: flex-end;
  }

  .dashboard-toolbar {
    flex-direction: column;
  }

  .patient-tabs {
    gap: 2px;
  }

  .patient-tab {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* ============================================
   Tooth Chart — FDI Dental Formula Grid
   ============================================ */

.tooth-chart-container {
  margin: 24px 0;
}

.tooth-chart-summary {
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 16px;
  background: var(--eddie-bg);
  border-radius: var(--eddie-radius);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tooth-chart-stat {
  text-align: center;
  padding: 8px 16px;
}

.tooth-chart-stat strong {
  display: block;
  font-size: 1.5rem;
  color: var(--eddie-primary);
}

.tooth-chart-stat span {
  font-size: 0.8rem;
  color: var(--eddie-text-muted);
}

/* Jaw section */
.tooth-jaw {
  margin-bottom: 24px;
}

.tooth-jaw-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--eddie-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-align: center;
}

.tooth-grid-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.tooth-grid-quadrant {
  display: flex;
  gap: 2px;
}

.tooth-grid-midline {
  width: 2px;
  height: 56px;
  background: var(--eddie-primary);
  margin: 0 6px;
  border-radius: 1px;
  opacity: 0.3;
}

.tooth-grid-divider {
  width: 100%;
  height: 1px;
  background: var(--eddie-border);
  margin: 4px 0 20px;
}

.tooth-grid-side-label {
  font-size: 0.7rem;
  color: var(--eddie-text-muted);
  writing-mode: horizontal-tb;
  min-width: 40px;
  text-align: center;
}

/* Individual tooth cell */
.tooth-cell {
  width: 48px;
  height: 56px;
  border: 2px solid var(--eddie-border);
  border-radius: var(--eddie-radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--eddie-surface);
  position: relative;
  user-select: none;
}

.tooth-cell:hover {
  border-color: var(--eddie-highlight);
  box-shadow: var(--eddie-shadow-md);
  transform: translateY(-1px);
}

.tooth-cell.selected {
  border-color: var(--eddie-highlight);
  background: rgba(44, 116, 179, 0.08);
  box-shadow: 0 0 0 2px rgba(44, 116, 179, 0.2);
}

.tooth-cell-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--eddie-text);
  line-height: 1;
}

.tooth-cell-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
}

/* Prognosis color variants */
.tooth-cell.prognosis-good .tooth-cell-indicator { background: #059669; }
.tooth-cell.prognosis-fair .tooth-cell-indicator { background: #D97706; }
.tooth-cell.prognosis-questionable .tooth-cell-indicator { background: #EA580C; }
.tooth-cell.prognosis-poor .tooth-cell-indicator { background: #DC2626; }
.tooth-cell.prognosis-hopeless .tooth-cell-indicator { background: #7C2D12; }

/* Status variants */
.tooth-cell.status-missing {
  border-style: dashed;
  background: #FAFAFA;
  opacity: 0.65;
}

.tooth-cell.status-missing .tooth-cell-number {
  color: var(--eddie-text-muted);
  text-decoration: line-through;
}

.tooth-cell.status-implant {
  background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
  border-color: #93C5FD;
}

.tooth-cell.status-implant .tooth-cell-number {
  color: #1D4ED8;
}

/* Needs deliberation badge */
.tooth-cell.needs-deliberation::after {
  content: '!';
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background: var(--eddie-warning);
  color: white;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: deliberation-pulse 2s ease-in-out infinite;
}

@keyframes deliberation-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

/* Legend */
.tooth-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  padding: 12px 16px;
  background: var(--eddie-bg);
  border-radius: var(--eddie-radius-sm);
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--eddie-text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.good { background: #059669; }
.legend-dot.fair { background: #D97706; }
.legend-dot.questionable { background: #EA580C; }
.legend-dot.poor { background: #DC2626; }
.legend-dot.hopeless { background: #7C2D12; }

.legend-dot.missing {
  background: transparent;
  border: 2px dashed var(--eddie-text-muted);
}

.legend-dot.implant {
  background: linear-gradient(135deg, #93C5FD, #3B82F6);
}

.legend-dot.deliberation {
  background: var(--eddie-warning);
}

/* ============================================
   Tooth Detail Panel
   ============================================ */

.tooth-detail-panel {
  background: var(--eddie-surface);
  border: 1px solid var(--eddie-border);
  border-radius: var(--eddie-radius);
  padding: 20px;
  margin-top: 20px;
}

.tooth-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--eddie-border);
}

.tooth-detail-fdi {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--eddie-primary);
  background: var(--eddie-bg);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--eddie-radius-sm);
}

.tooth-detail-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.tooth-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tooth-detail-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--eddie-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.tooth-detail-field .value {
  font-size: 0.92rem;
  color: var(--eddie-text);
}

.tooth-detail-field .value.prognosis-good { color: #059669; font-weight: 600; }
.tooth-detail-field .value.prognosis-fair { color: #D97706; font-weight: 600; }
.tooth-detail-field .value.prognosis-questionable { color: #EA580C; font-weight: 600; }
.tooth-detail-field .value.prognosis-poor { color: #DC2626; font-weight: 600; }
.tooth-detail-field .value.prognosis-hopeless { color: #7C2D12; font-weight: 600; }

.tooth-detail-findings {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--eddie-border);
}

.tooth-detail-findings ul {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 0.9rem;
}

.tooth-detail-findings li {
  margin-bottom: 4px;
}

/* ============================================
   Deliberation Panel
   ============================================ */

.deliberation-panel {
  margin-top: 20px;
}

.deliberation-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--eddie-accent);
  color: white;
  border: none;
  border-radius: var(--eddie-radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.deliberation-generate-btn:hover {
  background: var(--eddie-highlight);
}

.deliberation-generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.deliberation-context {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.deliberation-context-card {
  background: var(--eddie-bg);
  border-radius: var(--eddie-radius-sm);
  padding: 14px;
}

.deliberation-context-card h5 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--eddie-accent);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.deliberation-context-card p {
  font-size: 0.88rem;
  color: var(--eddie-text);
  margin: 0;
  line-height: 1.5;
}

/* Treatment Options in Deliberation */
.deliberation-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.deliberation-option-card {
  background: var(--eddie-surface);
  border: 2px solid var(--eddie-border);
  border-radius: var(--eddie-radius);
  padding: 16px;
  transition: all 0.2s;
}

.deliberation-option-card:hover {
  border-color: var(--eddie-highlight);
  box-shadow: var(--eddie-shadow);
}

.deliberation-option-card.recommended {
  border-color: var(--eddie-success);
  background: linear-gradient(to bottom, #F0FDF4, var(--eddie-surface));
}

.deliberation-option-card.recommended::before {
  content: '\2605 ';
  color: var(--eddie-success);
}

.deliberation-option-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--eddie-text);
}

.deliberation-option-card.recommended .deliberation-option-title {
  color: var(--eddie-success);
}

.pros-cons-list {
  list-style: none;
  padding: 0;
  margin: 6px 0;
  font-size: 0.85rem;
}

.pros-cons-list li {
  padding: 3px 0 3px 18px;
  position: relative;
}

.pros-cons-list.pros li::before {
  content: '+';
  position: absolute;
  left: 0;
  color: var(--eddie-success);
  font-weight: 700;
  font-size: 1rem;
}

.pros-cons-list.cons li::before {
  content: '\2212';
  position: absolute;
  left: 0;
  color: var(--eddie-danger);
  font-weight: 700;
  font-size: 1rem;
}

.deliberation-evidence {
  font-size: 0.8rem;
  color: var(--eddie-text-muted);
  font-style: italic;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--eddie-border);
}

.deliberation-reasoning {
  background: var(--eddie-bg);
  border-radius: var(--eddie-radius);
  padding: 16px;
  margin-top: 20px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.deliberation-reasoning h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--eddie-accent);
  margin: 0 0 8px;
}

.deliberation-recommendation {
  background: linear-gradient(135deg, #EFF6FF, #E0F2FE);
  border: 1px solid #BAE6FD;
  border-radius: var(--eddie-radius);
  padding: 16px;
  margin-top: 16px;
}

.deliberation-recommendation h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--eddie-primary);
  margin: 0 0 8px;
}

.deliberation-recommendation p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ============================================
   Option Selection & Justification
   ============================================ */

.deliberation-option-card.selected-option {
  border-color: var(--eddie-primary);
  background: linear-gradient(to bottom, #EFF6FF, var(--eddie-surface));
  box-shadow: 0 0 0 2px rgba(44, 116, 179, 0.2);
}

.delib-select-btn {
  font-size: 0.8rem !important;
  padding: 4px 14px !important;
}

.delib-selected-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--eddie-primary);
  color: white;
}

.delib-justification-form {
  background: #FEF9E7;
  border: 1px solid #F9E79F;
  border-radius: var(--eddie-radius);
  padding: 16px;
  margin: 12px 0;
}

.delib-justification-form h5 {
  font-size: 0.9rem;
  margin: 0 0 10px;
}

.delib-chosen-summary {
  background: var(--eddie-bg);
  border-left: 4px solid var(--eddie-primary);
  border-radius: var(--eddie-radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 0.9rem;
}

[dir="rtl"] .delib-chosen-summary {
  border-left: none;
  border-right: 4px solid var(--eddie-primary);
}

.jaw-delib-result {
  border-left: 4px solid var(--eddie-accent);
}

[dir="rtl"] .jaw-delib-result {
  border-left: none;
  border-right: 4px solid var(--eddie-accent);
}

/* ============================================
   Export Panel
   ============================================ */

.export-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.export-section-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 6px 0;
}

.export-section-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--eddie-primary);
  cursor: pointer;
}

@media (max-width: 768px) {
  .export-sections-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Tooth Chart — RTL Overrides
   ============================================ */

/* Force LTR direction on tooth grid so numbering stays correct in Hebrew mode */
[dir="rtl"] .tooth-grid-row {
  direction: ltr;
}

[dir="rtl"] .tooth-jaw-label,
[dir="rtl"] .tooth-legend,
[dir="rtl"] .tooth-chart-summary {
  direction: rtl;
}

[dir="rtl"] .tooth-cell.needs-deliberation::after {
  right: auto;
  left: -6px;
}

[dir="rtl"] .pros-cons-list li {
  padding-left: 0;
  padding-right: 18px;
}

[dir="rtl"] .pros-cons-list.pros li::before,
[dir="rtl"] .pros-cons-list.cons li::before {
  left: auto;
  right: 0;
}

[dir="rtl"] .tooth-detail-findings ul {
  padding-left: 0;
  padding-right: 18px;
}

/* ============================================
   Tooth Chart — Responsive
   ============================================ */

@media (max-width: 768px) {
  .tooth-cell {
    width: 36px;
    height: 44px;
  }

  .tooth-cell-number {
    font-size: 0.65rem;
  }

  .tooth-cell-indicator {
    width: 6px;
    height: 6px;
  }

  .tooth-grid-midline {
    height: 44px;
    margin: 0 3px;
  }

  .tooth-detail-grid {
    grid-template-columns: 1fr;
  }

  .deliberation-context {
    grid-template-columns: 1fr;
  }

  .deliberation-options {
    grid-template-columns: 1fr;
  }

  .tooth-chart-summary {
    gap: 10px;
  }
}

/* ============================================
   Knowledge Base Management
   ============================================ */

.kb-tabs {
  display: flex;
  gap: 4px;
  background: var(--eddie-bg);
  border-radius: var(--eddie-radius-sm);
  padding: 4px;
  width: fit-content;
  margin-bottom: 20px;
}

.kb-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--eddie-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.kb-tab.active {
  background: var(--eddie-surface);
  color: var(--eddie-accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.kb-tab:hover:not(.active) {
  color: var(--eddie-text);
}

.kb-upload-zone {
  border: 2px dashed var(--eddie-border);
  border-radius: var(--eddie-radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--eddie-text-muted);
  margin-bottom: 16px;
}

.kb-upload-zone:hover,
.kb-upload-zone.dragover {
  border-color: var(--eddie-highlight);
  background: rgba(44, 116, 179, 0.04);
  color: var(--eddie-accent);
}

.kb-upload-zone .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  display: block;
}

.kb-upload-zone p {
  margin: 4px 0;
}

.kb-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--eddie-bg);
  padding: 10px 16px;
  border-radius: var(--eddie-radius-sm);
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.kb-file-info .file-name {
  font-weight: 600;
  flex: 1;
}

.kb-file-info .file-size {
  color: var(--eddie-text-muted);
}

.kb-file-info .file-remove {
  cursor: pointer;
  color: var(--eddie-danger);
  font-weight: 700;
  font-size: 1.1rem;
}

.kb-entry-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--eddie-border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.kb-entry-card:last-child {
  border-bottom: none;
}

.kb-entry-info {
  flex: 1;
  min-width: 0;
}

.kb-entry-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--eddie-text);
  margin-bottom: 4px;
}

.kb-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--eddie-text-muted);
  margin-bottom: 6px;
}

.kb-entry-preview {
  font-size: 0.8rem;
  color: var(--eddie-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kb-category-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kb-category-badge.general { background: #E5E7EB; color: #374151; }
.kb-category-badge.endodontic { background: #DBEAFE; color: #1D4ED8; }
.kb-category-badge.periodontal { background: #D1FAE5; color: #065F46; }
.kb-category-badge.prosthodontic { background: #FEF3C7; color: #92400E; }
.kb-category-badge.guidelines { background: #EDE9FE; color: #5B21B6; }

.kb-source-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--eddie-bg);
  color: var(--eddie-text-muted);
  text-transform: uppercase;
}

.kb-entry-actions {
  flex-shrink: 0;
}

/* KB RTL overrides */
[dir="rtl"] .kb-entry-card {
  flex-direction: row-reverse;
}

[dir="rtl"] .kb-entry-meta {
  flex-direction: row-reverse;
}

@media (max-width: 768px) {
  .kb-tabs {
    width: 100%;
  }

  .kb-tab {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .kb-entry-card {
    flex-direction: column;
    gap: 10px;
  }

  [dir="rtl"] .kb-entry-card {
    flex-direction: column;
  }
}
