/* PBL AI Monitoring & Reflection - Modern CSS (RTL) */
:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --font-family: 'Assistant', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 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);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.top-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid #38bdf8;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo-icon {
  font-size: 2rem;
  background: rgba(255,255,255,0.1);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.2);
}

.brand h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-oranim {
  font-size: 0.75rem;
  background: #38bdf8;
  color: #0f172a;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.85rem;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.doc-badge {
  background: rgba(255,255,255,0.15);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Main Layout */
.main-content {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* Summary Banner */
.summary-banner {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.banner-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.tag-course { background: #e0f2fe; color: #0369a1; }
.tag-pbl { background: #fef3c7; color: #b45309; }
.tag-eval { background: #dcfce7; color: #15803d; }

.summary-banner h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: #0f172a;
}

.team-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.banner-stats {
  display: flex;
  gap: 1rem;
}

.stat-box {
  background: #f1f5f9;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-sm);
  text-align: center;
  min-width: 110px;
  border: 1px solid #e2e8f0;
}

.stat-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Tab Panes */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* Phase Selector Bar */
.phase-selector-bar {
  margin-bottom: 1.5rem;
}

.phase-btn-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.phase-btn {
  flex: 1;
  min-width: 220px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.phase-btn:hover {
  border-color: #94a3b8;
}

.phase-btn.active {
  border-color: var(--primary);
  background: #f0f9ff;
}

.phase-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.phase-btn.active .phase-tag {
  background: var(--primary);
  color: white;
}

.phase-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

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

.phase-connector {
  font-size: 1.2rem;
  color: #94a3b8;
  font-weight: bold;
}

/* Document Viewer Grid */
.doc-viewer-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .doc-viewer-grid {
    grid-template-columns: 1fr;
  }
}

.doc-main-sheet {
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.sheet-header {
  background: #f8fafc;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.phase-indicator-pill {
  font-size: 0.75rem;
  font-weight: 700;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 4px;
}

.sheet-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
}

.sheet-meta-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sheet-body {
  padding: 1.5rem;
}

.doc-section-block {
  margin-bottom: 1.8rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--border-color);
}

.doc-section-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.section-text {
  font-size: 1rem;
  line-height: 1.6;
  color: #334155;
}

/* Character cards inside doc */
.character-pill {
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  margin-bottom: 0.6rem;
  border-right: 3px solid var(--primary);
}

.character-pill strong {
  color: #0f172a;
}

/* Side Panel */
.doc-side-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  box-shadow: var(--shadow-sm);
}

.panel-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: #0f172a;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.4rem;
}

.highlight-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
}

/* Lecturer Comments box */
.comment-bubble {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  border-right: 4px solid var(--warning);
}

.comment-author {
  font-weight: 700;
  color: #92400e;
  margin-bottom: 2px;
}

.comment-resolved {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-right-color: var(--success);
}

.comment-resolved .comment-author {
  color: #166534;
}

/* Diff Tab */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.card-header {
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.diff-row {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.diff-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.6rem;
}

.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

@media (max-width: 768px) {
  .diff-grid {
    grid-template-columns: 1fr;
  }
}

.diff-box {
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.5;
}

.diff-from {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.diff-to {
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.diff-box-label {
  font-size: 0.75rem;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  opacity: 0.8;
}

.diff-insights {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  font-size: 0.85rem;
  color: #475569;
}

/* Lecturer Dashboard Grid */
.grid-2-col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid-2-col {
    grid-template-columns: 1fr;
  }
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-info { background: #dbeafe; color: #1e40af; }

.lecturer-content {
  font-size: 0.95rem;
  line-height: 1.6;
}

.mentor-prompt-card {
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  margin-bottom: 0.8rem;
  border-right: 3px solid var(--primary);
  font-size: 0.9rem;
}

.mentor-action-bar {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-outline {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f8fafc;
}

/* Student Reflection Hub */
.reflection-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-sm);
}

.reflection-domain-pill {
  font-size: 0.75rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}

.reflection-question {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: #0f172a;
  line-height: 1.4;
}

.reflection-context {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.reflection-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 80px;
  margin-bottom: 0.6rem;
  resize: vertical;
}

/* Live Analyzer Form */
.analyzer-form {
  background: #f8fafc;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.form-group textarea, .form-group input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  font-family: inherit;
  font-size: 0.95rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.analysis-result-container {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.analysis-result-container.hidden {
  display: none;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.6rem;
  margin-bottom: 0.8rem;
}

.score-badge {
  background: #dcfce7;
  color: #15803d;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 1.1rem;
}

/* Integration Steps */
.integration-steps {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.step-item {
  display: flex;
  gap: 1rem;
  background: #f8fafc;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.step-badge {
  background: var(--primary);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.code-box-wrapper {
  position: relative;
  margin-top: 0.8rem;
}

.btn-copy-code {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #0284c7;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 700;
}

pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.8rem;
  max-height: 250px;
  overflow-y: auto;
  direction: ltr;
  text-align: left;
}

/* Footer */
.app-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  margin-top: 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.edge-tag {
  font-size: 0.75rem;
  margin-top: 4px;
  color: #0284c7;
  font-weight: 600;
}
