/* ============================
   educ.ai Design System
   Bright, friendly, office-app feel
   ============================ */

:root {
  --teal: #2dd4bf;
  --teal-dim: rgba(45, 212, 191, 0.12);
  --purple: #7c3aed;
  --purple-dim: rgba(124, 58, 237, 0.1);
  --purple-light: #ede9fe;
  --pink: #f472b6;
  --orange: #fb923c;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --bg: #f8f9fb;
  --white: #ffffff;
  --border: #e5e7eb;
  --border-light: #f0f1f3;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Space Grotesk', 'Inter', sans-serif; }

/* ============================
   Buttons
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient);
  color: white;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-microsoft {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  width: 100%;
  padding: 12px;
}
.btn-microsoft:hover { background: #f9fafb; border-color: #d1d5db; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: rgba(0,0,0,0.04); }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.btn-icon:hover { background: var(--bg); }

/* ============================
   Login Page
   ============================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f8f9fb 0%, #ede9fe 50%, #ccfbf1 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-bulb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--purple), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.logo-sm { width: 32px; height: 32px; font-size: 0.9rem; }
.logo-xs { width: 26px; height: 26px; font-size: 0.75rem; }

.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}
.logo-text-sm { font-size: 1.2rem; }
.logo-text-xs { font-size: 1rem; }

.login-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-light);
  font-size: 0.8rem;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.login-form input:focus { border-color: var(--purple); }

.login-form .btn { width: 100%; margin-top: 4px; }

.login-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 12px;
}

.login-footer {
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 20px;
}

/* ============================
   Top Navigation
   ============================ */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.topnav-left, .topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-user {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================
   Dashboard
   ============================ */
.dashboard-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px;
}

.dashboard-welcome {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 32px;
}

.dashboard-section {
  margin-bottom: 40px;
}

.dashboard-section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.tutorial-card, .session-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s;
}
.tutorial-card:hover, .session-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.session-card { cursor: pointer; }

.tutorial-card h3, .session-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.tutorial-card p, .session-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 14px;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
}
.badge-beginner { background: var(--teal-dim); color: #0d9488; }
.badge-intermediate { background: var(--purple-dim); color: var(--purple); }
.badge-advanced { background: rgba(251,146,60,0.12); color: #ea580c; }

/* ============================
   Workspace Layout
   ============================ */
.workspace-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-back {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}
.topbar-back:hover { color: var(--purple); }

.topbar-center {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-user {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.workspace-panels {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  flex: 1;
  overflow: hidden;
}

/* Left: Tutorial Guide */
.panel-guide {
  background: #f9fafb;
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.guide-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.guide-sub {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 14px;
}

.guide-progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  margin-bottom: 18px;
  overflow: hidden;
}

.guide-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--purple));
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.guide-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-light);
}

.guide-step.active {
  background: var(--purple-light);
  color: var(--purple);
  font-weight: 600;
}

.guide-step.done { color: var(--text-light); text-decoration: line-through; }

.step-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.guide-step.done .step-icon { background: var(--green-dim); color: var(--green); }
.guide-step.active .step-icon { background: var(--purple); color: white; }
.guide-step.upcoming .step-icon { background: #f3f4f6; color: var(--text-light); }

/* Clue Box */
.clue-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: auto;
}

.clue-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.clue-tab {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  background: #f3f4f6;
  color: var(--text-light);
  transition: all 0.2s;
}

.clue-tab.active {
  background: var(--green-dim);
  color: var(--green);
}

.clue-content {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
}

/* Center: Chat */
.panel-chat {
  display: flex;
  flex-direction: column;
  background: var(--white);
  overflow: hidden;
}

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

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: fadeInUp 0.25s ease;
}

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

.chat-user {
  background: var(--gradient);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-ai {
  background: #f3f4f6;
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-sender {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 4px;
}

.chat-ai-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--purple));
}

.chat-text { white-space: pre-wrap; }

.files-changed {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.file-chip {
  font-size: 0.72rem;
  background: var(--purple-light);
  color: var(--purple);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.chat-system {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-light);
  padding: 4px 0;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--text-light);
  border-radius: 50%;
  animation: typing 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Chat input */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--white);
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--purple); }

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.chat-send-btn:hover { opacity: 0.85; }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Right: Preview */
.panel-preview {
  background: #f9fafb;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.preview-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.preview-header .btn-icon { margin-left: auto; }

.preview-iframe {
  flex: 1;
  border: none;
  background: white;
  margin: 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.file-browser {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  max-height: 160px;
  overflow-y: auto;
}

.file-browser-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.file-list { display: flex; flex-direction: column; gap: 2px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}
.file-item:hover { background: rgba(0,0,0,0.03); color: var(--text); }

.file-icon { font-size: 0.9rem; }

.file-empty {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
  padding: 12px 0;
}
