/* ==========================================================================
   Modern Academic Questionnaire & Curriculum Overlap App Styling
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --accent: #059669;
  --accent-light: #ecfdf5;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --border-card: #e2e8f0;
  --border-focus: #3b82f6;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 60px;
}

/* App Header */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-card);
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-meta {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Main Container */
.survey-container {
  max-width: 860px;
  margin: 32px auto;
  padding: 0 20px;
}

/* Progress Bar */
.progress-container {
  margin-bottom: 28px;
}

.progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  width: 20%;
  transition: width 0.35s ease;
}

.step-indicator {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Cards & Sections */
.survey-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease-out;
}

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

.section-header {
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 16px;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

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

/* Question Blocks */
.question-block {
  margin-bottom: 28px;
}

.question-block:last-child {
  margin-bottom: 0;
}

.question-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  display: block;
}

.question-label .required-mark {
  color: var(--danger);
  margin-left: 3px;
}

.question-help {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Choice Items */
.options-grid {
  display: grid;
  gap: 10px;
}

.choice-card {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
}

.choice-card:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.choice-card.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.choice-card input {
  margin-top: 4px;
  margin-right: 12px;
  cursor: pointer;
  accent-color: var(--primary);
}

.choice-text {
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 500;
}

/* Dropdown */
.form-select, .form-input, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.95rem;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

/* Likert Scale (1-7) */
.likert-container {
  background: #f8fafc;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
}

.likert-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px 0;
}

.likert-node {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.likert-radio-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.likert-node:hover .likert-radio-circle {
  border-color: var(--primary);
  color: var(--primary);
}

.likert-node.selected .likert-radio-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.likert-anchors {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Slider Controls */
.slider-group {
  padding: 12px 0;
}

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

.slider-badge {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-border);
}

.range-slider {
  width: 100%;
  accent-color: var(--primary);
  height: 6px;
  cursor: pointer;
}

/* Course Selector Component (Paginated & Filterable) */
.course-picker-box {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 20px;
}

.picker-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .picker-controls { grid-template-columns: 1fr; }
}

/* Selected Summary Box */
.selected-summary-box {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
}

.selected-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.selected-summary-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.selected-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.selected-chip {
  background: #ffffff;
  border: 1px solid var(--primary-border);
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
  font-weight: 500;
}

.chip-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  border-radius: 50%;
}

.chip-remove-btn:hover {
  color: var(--danger);
  font-weight: 700;
}

/* Course Results Header & List */
.courses-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-card);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.course-items-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
}

.course-item-row {
  display: flex;
  align-items: flex-start;
  padding: 12px 14px;
  background: #fafafa;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.course-item-row:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.course-item-row.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.course-checkbox-wrap {
  margin-right: 12px;
  margin-top: 2px;
}

.course-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.course-content {
  flex: 1;
}

.course-title-line {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.course-title-en {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.course-badges-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.c-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: #e2e8f0;
  color: #334155;
}

.c-badge-ects {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
}

.c-badge-degree {
  background: #f1f5f9;
  color: #475569;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c-badge-syllabus {
  background: #dcfce7;
  color: #166534;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-card);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-card);
  background: #ffffff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.custom-course-toggle {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  display: inline-block;
}

/* Bottom Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
}

.btn {
  padding: 11px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-success {
  background: var(--accent);
  color: #ffffff;
}

.btn-success:hover {
  background: #047857;
}

/* Score Feedback Page */
.score-hero {
  text-align: center;
  padding: 24px 0 32px 0;
  border-bottom: 1px solid var(--border-card);
  margin-bottom: 24px;
}

.score-badge-circle {
  width: 100px;
  height: 100px;
  margin: 0 auto 16px auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
}

.score-val {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.score-unit {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
  margin-top: 2px;
}

.score-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.score-subtitle {
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto;
  font-size: 0.95rem;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

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

.metric-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-number {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Interpretation Box */
.interpretation-card {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 28px;
  color: #1e3a8a;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Synergies & Breakdown Table */
.data-table-container {
  overflow-x: auto;
  margin-bottom: 28px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-card);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-card);
  color: var(--text-main);
}

.synergy-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

.synergy-High { background: #dcfce7; color: #15803d; }
.synergy-Moderate { background: #fef3c7; color: #b45309; }
.synergy-Low { background: #f1f5f9; color: #64748b; }

/* Canvas 2D Scatter */
.canvas-wrapper {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 28px;
}

.canvas-wrapper canvas {
  max-width: 100%;
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

/* Print/Finish Actions */
.result-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

/* Admin Dashboard Specific */
.admin-login-card {
  max-width: 420px;
  margin: 60px auto;
  text-align: center;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

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

.stat-item {
  background: #ffffff;
  border: 1px solid var(--border-card);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-lbl {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
