/* ==============================================================================
   ChatGPT-Style Minimalist UI - Grade 8 Science Platform
   ============================================================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f9f9f9;
  --bg-sidebar: #f7f7f8;
  --bg-sidebar-hover: #ececf1;
  --bg-card: #ffffff;

  --border-light: #e5e5e5;
  --border-subtle: #f0f0f0;

  --text-main: #0d0d0d;
  --text-muted: #707070;
  --text-light: #999999;

  --brand-color: #10a37f;
  /* ChatGPT Teal / Accent */
  --brand-hover: #0e8c6d;
  --brand-subtle: #f0fdf4;

  --correct: #10a37f;
  --wrong: #ef4444;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==============================================================================
   SLIM MINIMALIST SIDEBAR
   ============================================================================== */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 12px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-new-chat {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-new-chat:hover {
  background: var(--bg-sidebar-hover);
}

.sidebar-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 8px 8px 4px;
  letter-spacing: 0.5px;
}

.semester-pills {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  transition: all 0.15s;
}

.pill-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-main);
}

.pill-item.active {
  background: #e9e9ec;
  color: var(--text-main);
  font-weight: 600;
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

.btn-assessment-action {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--text-main);
  color: white;
  border: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s;
}

.btn-assessment-action:hover {
  opacity: 0.88;
}

/* ==============================================================================
   MAIN CHAT & ASSESSMENT ARENA
   ============================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 40px 0 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container-narrow {
  width: 100%;
  max-width: 760px;
  padding: 0 20px;
}

/* Messages */
.message-row {
  display: flex;
  gap: 16px;
  padding: 18px 0;
  width: 100%;
  border-bottom: 1px solid transparent;
}

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.message-row.bot .message-avatar {
  background: var(--brand-color);
  color: white;
}

.message-row.user .message-avatar {
  background: #e2e8f0;
  color: var(--text-main);
}

.message-body {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-main);
}

.message-body p {
  margin-bottom: 12px;
}

.message-body p:last-child {
  margin-bottom: 0;
}

.message-body ul,
.message-body ol {
  margin: 8px 0 12px 20px;
}

.message-body li {
  margin-bottom: 4px;
}

/* Suggestion Pills */
.suggestion-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.suggestion-chip {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.suggestion-chip:hover {
  background: var(--bg-secondary);
  border-color: #ccc;
  color: var(--text-main);
}

/* ==============================================================================
   CLEAN FLOATING INPUT BAR (CHATGPT STYLE)
   ============================================================================== */
.input-dock {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 40%, rgba(255, 255, 255, 1) 100%);
  padding: 16px 20px 24px;
  display: flex;
  justify-content: center;
}

.input-box-wrapper {
  width: 100%;
  max-width: 760px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 8px 14px 8px 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-box-wrapper:focus-within {
  border-color: #b0b0b0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
}

.chat-input::placeholder {
  color: var(--text-light);
}

.btn-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--text-main);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.btn-send:hover {
  opacity: 0.8;
}

.btn-send:disabled {
  background: #e5e5e5;
  cursor: default;
}

/* ==============================================================================
   MINIMALIST INLINE ASSESSMENT WIDGET (ARTIFACT STYLE)
   ============================================================================== */
.assessment-widget {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  margin: 16px 0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}

.widget-title {
  font-weight: 600;
  color: var(--text-main);
}

.widget-score {
  font-weight: 600;
  color: var(--brand-color);
}

.widget-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Question Items */
.question-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.1s ease;
}

.option-btn:hover:not(:disabled) {
  background: var(--bg-secondary);
}

.option-btn.correct {
  background: var(--brand-subtle);
  border-color: var(--correct);
  color: #065f46;
  font-weight: 500;
}

.option-btn.wrong {
  background: #fef2f2;
  border-color: var(--wrong);
  color: #991b1b;
}

.explanation-inline {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

/* Short answer model toggle */
.toggle-inline-btn {
  background: none;
  border: none;
  color: var(--primary, #2563eb);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 4px 0;
  text-decoration: underline;
  display: inline-block;
}

.toggle-inline-btn:hover {
  color: var(--text-main);
}

.student-answer-wrap {
  margin: 8px 0 6px 0;
}

.student-answer-input {
  width: 100%;
  min-height: 68px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  background: #ffffff;
  border: 1.5px dashed var(--border-light, #cbd5e1);
  border-radius: var(--radius-sm, 6px);
  resize: vertical;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.student-answer-input:focus {
  outline: none;
  border: 1.5px solid var(--primary, #2563eb);
  background: #f8fafc;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.student-answer-input::placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.inline-answer-box {
  font-size: 0.88rem;
  color: #1e3a8a;
  background: #f0f7ff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

/* Diagram Card (Minimalist) */
.diagram-inline-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 24px;
  margin-bottom: 24px;
}

.diagram-inline-view:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.diagram-inline-img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: white;
  cursor: zoom-in;
}

/* Assessment Picker Modal / Sheet */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
}

.type-selector-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--bg-sidebar);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.type-tab {
  padding: 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

.type-tab.active {
  background: white;
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.select-clean {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: white;
  outline: none;
}

.select-clean:focus {
  border-color: #888;
}

/* Animations */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.thinking-dot {
  display: inline-block;
  animation: pulse 1.2s infinite;
}

/* Student Blank Answer Input Area */
.student-answer-wrap {
  margin: 10px 0 8px 0;
}

.student-answer-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
  background-color: #fafbfc;
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-sm, 6px);
  resize: vertical;
  min-height: 72px;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.student-answer-input:focus {
  background-color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Student Blank Answer Input Area */
.student-answer-wrap {
  margin: 10px 0 8px 0;
}

.student-answer-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
  background-color: #fafbfc;
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-sm, 6px);
  resize: vertical;
  min-height: 72px;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.student-answer-input:focus {
  background-color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
