/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --accent: #00cec9;
  --accent-glow: rgba(0, 206, 201, 0.15);
  --bg: #0a0a1a;
  --bg-card: #12122a;
  --bg-card-hover: #1a1a3e;
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --border: #2d2d5e;
  --success: #00e676;
  --success-bg: rgba(0, 230, 118, 0.1);
  --locked: #4a4a6a;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(108, 92, 231, 0.15);
  --shadow-hover: 0 8px 30px rgba(108, 92, 231, 0.25);
  --gradient: linear-gradient(135deg, #6c5ce7, #00cec9);
}

body {
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 206, 201, 0.06) 0%, transparent 50%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-shadow: 0 0 8px var(--accent-glow); }

code {
  background: rgba(108, 92, 231, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.9em;
  color: var(--accent);
  border: 1px solid rgba(108, 92, 231, 0.2);
}

pre {
  background: #080818;
  color: var(--accent);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  border: none;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 2px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover { box-shadow: 0 4px 25px rgba(108, 92, 231, 0.5); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; transform: none; }

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

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-full { width: 100%; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn-large { padding: 14px 32px; font-size: 1.1rem; }
.btn-completed { background: var(--success); }

/* === Login Page === */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0a1a 0%, #12122a 50%, #0a1628 100%);
  background-image:
    radial-gradient(ellipse at 30% 60%, rgba(108, 92, 231, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 30%, rgba(0, 206, 201, 0.08) 0%, transparent 50%);
}

.login-container {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(108, 92, 231, 0.1);
}

.login-logo {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 12px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 1.8rem;
  color: var(--text);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.tagline {
  font-size: 0.9rem;
  color: var(--text-light);
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  background: #0a0a1a;
  color: var(--text);
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(108, 92, 231, 0.2);
}

.login-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-light);
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 12px;
  text-align: center;
}

.bootcamp-over-message {
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-light);
  padding: 24px 0;
  line-height: 1.6;
}

/* === Header === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 1.2rem;
  color: var(--text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-link {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.progress-badge {
  background: var(--gradient);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* === Dashboard === */
.dashboard {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px;
}

.progress-bar-container {
  background: #1a1a3e;
  border-radius: 10px;
  height: 8px;
  margin-bottom: 32px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--gradient);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.modules-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}

.module-card.available {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.1);
}

.module-card.available:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.module-card.completed {
  border-color: var(--success);
  background: var(--success-bg);
}

.module-card.locked {
  opacity: 0.5;
}

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

.module-number {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

.module-duration {
  font-size: 0.8rem;
  background: rgba(0, 206, 201, 0.1);
  padding: 2px 10px;
  border-radius: 12px;
  color: var(--accent);
  border: 1px solid rgba(0, 206, 201, 0.2);
}

.module-title {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.module-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

.module-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-icon {
  font-size: 1rem;
}

.completed-icon { color: var(--success); }
.available-icon { color: var(--primary); }
.locked-icon { color: var(--locked); font-size: 0.85rem; }

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
}

/* === Module Layout === */
.module-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  height: calc(100vh - 65px);
}

.module-content {
  overflow-y: auto;
  padding: 32px;
}

.module-content-inner {
  max-width: 700px;
}

.module-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.module-duration-badge,
.module-number-badge {
  background: rgba(108, 92, 231, 0.1);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  border: 1px solid rgba(108, 92, 231, 0.2);
}

.module-content h2 {
  font-size: 1.6rem;
  margin-bottom: 16px;
  color: var(--text);
}

.module-content h3 {
  font-size: 1.2rem;
  margin: 24px 0 12px;
  color: var(--text);
}

.module-content h4 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.module-content p {
  margin-bottom: 12px;
  color: var(--text);
}

.module-content ul, .module-content ol {
  margin: 8px 0 16px 24px;
}

.module-content li {
  margin-bottom: 6px;
}

.exercise {
  background: rgba(0, 206, 201, 0.05);
  border: 1px solid rgba(0, 206, 201, 0.25);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
  border-left: 3px solid var(--accent);
}

.exercise h4 {
  color: var(--accent);
}

.exercise ol, .exercise ul {
  margin-left: 20px;
}

.check-understanding {
  background: rgba(108, 92, 231, 0.08);
  border: 1px solid rgba(108, 92, 231, 0.25);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
  border-left: 3px solid var(--primary);
}

.check-understanding h4 {
  color: var(--primary);
}

/* === Assessment Section === */
.assessment-section {
  background: rgba(108, 92, 231, 0.08);
  border: 1px solid rgba(108, 92, 231, 0.3);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}

.assessment-section h4 {
  color: var(--primary);
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.assessment-intro {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

.assessment-question {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

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

.question-text {
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.assessment-answer {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.assessment-answer:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(108, 92, 231, 0.15);
}

.assessment-answer:disabled {
  background: #0a0a1a;
  color: var(--text);
}

.assessment-answer {
  background: #0a0a1a;
  color: var(--text);
}

.assessment-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.score-display.scored {
  margin-top: 4px;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  min-width: 50px;
}

.score-high { background: var(--success); }
.score-mid { background: #f59e0b; }
.score-low { background: #ef4444; }

.score-feedback {
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
}

.score-error {
  font-size: 0.85rem;
  color: #ef4444;
}

.grading-spinner {
  font-size: 0.85rem;
  color: var(--primary);
  font-style: italic;
}

.module-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 400px;
  padding: 16px 32px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  z-index: 50;
  background: var(--bg-card);
}

/* === Chatbot Panel === */
.chatbot-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  height: calc(100vh - 65px);
  position: sticky;
  top: 65px;
}

.chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.chatbot-header h3 {
  font-size: 1rem;
}

.chatbot-status {
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 600;
}

.chatbot-status.thinking {
  color: var(--primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-message.user .chat-bubble {
  background: var(--gradient);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
  background: #1a1a3e;
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.chat-bubble.streaming::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 14px;
  background: var(--primary);
  margin-left: 2px;
  animation: blink 0.8s infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.chat-bubble p { margin-bottom: 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul { margin: 4px 0 8px 16px; }
.chat-bubble li { margin-bottom: 2px; }

.chat-input-form {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.chat-input-form input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  background: #0a0a1a;
  color: var(--text);
}

.chat-input-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(108, 92, 231, 0.15);
}

.chat-input-form .btn {
  padding: 10px 16px;
}

/* === Mobile Chatbot Toggle === */
.chatbot-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 14px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
  z-index: 200;
}

/* === Responsive === */
@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
  }

  .header h1 {
    font-size: 1rem;
  }

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

  .chatbot-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    z-index: 300;
  }

  .chatbot-panel.mobile-open {
    display: flex;
  }

  .chatbot-toggle {
    display: block;
  }

  .chatbot-toggle.active {
    display: none;
  }

  .module-actions {
    right: 0;
  }

  .module-content {
    padding: 20px 16px;
    padding-bottom: 80px;
  }

  .login-card {
    padding: 32px 24px;
  }
}
