/* ============================================================
   MentorIA - Global CSS
   Design: Clean Modern SaaS, similar to ChatOn
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* CSS Variables */
:root {
  --primary: #6C63FF;
  --primary-dark: #5A52E8;
  --primary-light: #EEF0FF;
  --primary-rgb: 108, 99, 255;

  --accent: #FF6B6B;
  --accent-green: #26de81;
  --accent-yellow: #FED330;
  --accent-blue: #45B7D1;

  --bg: #FAFAFA;
  --bg-white: #FFFFFF;
  --sidebar-bg: #FFFFFF;
  --card-bg: #FFFFFF;

  --text: #1A1A2E;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;

  --border: #E5E7EB;
  --border-light: #F3F4F6;

  --sidebar-width: 260px;
  --header-height: 64px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.15);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: all 0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

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

h1, h2, h3, h4, h5, h6 {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  line-height: 1.3;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.85; }

img { max-width: 100%; height: auto; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ============================================================
   LAYOUT - Sidebar + Main
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(108,99,255,0.3);
}

.sidebar-logo .logo-name {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-name span { color: var(--primary); }

.sidebar-nav { padding: 12px 12px; flex: 1; }

.nav-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  text-decoration: none;
  position: relative;
}

.nav-item:hover, .nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }

.nav-item .badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

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

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.user-card:hover { background: var(--border-light); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { flex: 1; min-width: 0; }
.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .user-plan { font-size: 11px; color: var(--text-muted); }

/* Plan badge */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.plan-badge.free { background: #F3F4F6; color: #6B7280; }
.plan-badge.starter { background: #DBEAFE; color: #2563EB; }
.plan-badge.pro { background: linear-gradient(135deg, #6C63FF, #a78bfa); color: white; }
.plan-badge.enterprise { background: linear-gradient(135deg, #F59E0B, #EF4444); color: white; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.top-header {
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title { font-size: 16px; font-weight: 600; color: var(--text); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.btn-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 16px;
  color: var(--text-secondary);
  position: relative;
}

.btn-icon:hover { background: var(--border-light); color: var(--text); }

.btn-icon .notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid white;
}

/* Credits badge in header */
.credits-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(108,99,255,0.35);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,99,255,0.4); }

.btn-secondary { background: var(--border-light); color: var(--text); }
.btn-secondary:hover { background: var(--border); }

.btn-success { background: var(--accent-green); color: white; }
.btn-danger { background: var(--accent); color: white; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; border-radius: var(--radius); }
.btn-full { width: 100%; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }
.btn .spinner { animation: spin 0.7s linear infinite; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow); }

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

.card-title { font-size: 16px; font-weight: 600; }

/* Mentor Cards */
.mentor-card {
  display: flex; flex-direction: column;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.mentor-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--primary));
  transform: scaleX(0);
  transition: transform 0.3s ease;
  transform-origin: left;
}

.mentor-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  color: inherit;
}

.mentor-card:hover::before { transform: scaleX(1); }

.mentor-card-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin-bottom: 14px;
  background: var(--icon-bg, var(--primary-light));
}

.mentor-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.mentor-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; flex: 1; }

.mentor-card .card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.mentor-card .premium-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: white; font-size: 10px; font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-white);
  transition: var(--transition);
  outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.12); }
.form-control.error { border-color: var(--accent); }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--accent); margin-top: 4px; }

/* ============================================================
   CHAT INTERFACE
   ============================================================ */

.chat-container {
  display: flex;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

.chat-sidebar {
  width: 280px;
  border-right: 1px solid var(--border);
  background: var(--bg-white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.chat-history { flex: 1; overflow-y: auto; padding: 8px; }

.chat-history-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}
.chat-history-item:hover, .chat-history-item.active { background: var(--primary-light); }
.chat-history-item .title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-history-item .meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.chat-header {
  padding: 16px 20px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}

.chat-mentor-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}

.chat-mentor-info h3 { font-size: 15px; font-weight: 700; }
.chat-mentor-info p { font-size: 12px; color: var(--text-secondary); }

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

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: messageIn 0.3s ease;
}

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

.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }

.message-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.message.user .message-avatar { background: linear-gradient(135deg, var(--primary), #a78bfa); color: white; font-size: 13px; font-weight: 700; }
.message.assistant .message-avatar { background: var(--primary-light); }

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.message.user .message-bubble {
  background: var(--primary);
  color: white;
  border-radius: 16px 4px 16px 16px;
}

.message.assistant .message-bubble {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px;
  box-shadow: var(--shadow-sm);
}

.message.assistant .message-bubble pre {
  background: #1a1a2e;
  color: #e8e8e8;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  margin: 8px 0;
}

.message.assistant .message-bubble code {
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

.message-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; text-align: right; }

/* Typing indicator */
.typing-indicator .message-bubble {
  padding: 14px 18px;
}
.typing-dots {
  display: flex; gap: 4px; align-items: center;
}
.typing-dots span {
  width: 8px; height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.chat-input-area {
  padding: 16px 20px;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
}

.chat-input-credits {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.chat-input-credits span { color: var(--primary); font-weight: 600; }
.chat-input-credits a { color: var(--accent-green); font-weight: 600; }

.chat-input-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: var(--transition);
}

.chat-input-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.1); }

.chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 14px;
  color: var(--text);
  min-height: 24px;
  max-height: 120px;
  line-height: 1.5;
}

.chat-textarea::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Empty chat state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.chat-empty .mentor-big-icon {
  font-size: 64px; margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.chat-empty h2 { font-size: 22px; margin-bottom: 8px; }
.chat-empty p { font-size: 14px; color: var(--text-secondary); max-width: 340px; line-height: 1.6; }

.suggested-questions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.suggested-question {
  padding: 8px 16px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.suggested-question:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ============================================================
   ADMIN / DASHBOARD STATS
   ============================================================ */

.page-content { padding: 28px; }
.page-title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--primary));
}

.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-content { flex: 1; }
.stat-value { font-size: 26px; font-weight: 800; font-family: 'Sora', sans-serif; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-change { font-size: 12px; font-weight: 600; margin-top: 6px; }
.stat-change.up { color: var(--accent-green); }
.stat-change.down { color: var(--accent); }

/* Charts */
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 28px; }

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

.chart-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.chart-card canvas { max-height: 280px; }

/* ============================================================
   TABLES
   ============================================================ */

.table-container { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--primary-light); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-secondary { background: #F3F4F6; color: #374151; }

/* ============================================================
   MODAL / OVERLAY
   ============================================================ */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

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

.modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 20px; font-weight: 800; }
.modal-close { width: 30px; height: 30px; border: none; background: var(--border-light); border-radius: 50%; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: var(--transition); }
.modal-close:hover { background: var(--border); }

/* PIX Modal */
.pix-qr-container { text-align: center; padding: 20px 0; }
.pix-qr-container img { width: 200px; height: 200px; border: 4px solid var(--primary-light); border-radius: var(--radius); }
.pix-code-box {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  word-break: break-all;
  color: var(--text-secondary);
  margin: 16px 0;
  cursor: pointer;
  transition: var(--transition);
}
.pix-code-box:hover { border-color: var(--primary); color: var(--text); }

/* ============================================================
   ALERTS / TOAST
   ============================================================ */

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* Toast */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  display: flex; align-items: center; gap: 10px;
  min-width: 250px;
  max-width: 380px;
}

.toast.success { background: #065F46; }
.toast.error { background: #991B1B; }
.toast.warning { background: #92400E; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   UPGRADE MODAL / PRICING
   ============================================================ */

.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 20px 0; }

.plan-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.plan-card.popular {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}

.plan-card.selected { border-color: var(--primary); background: var(--primary-light); }

.plan-popular-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: white;
  padding: 3px 12px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700;
}

.plan-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.plan-price { font-size: 28px; font-weight: 800; font-family: 'Sora', sans-serif; color: var(--primary); }
.plan-price span { font-size: 14px; font-weight: 400; color: var(--text-secondary); }
.plan-credits { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }

.plan-features { list-style: none; margin-top: 14px; }
.plan-features li { font-size: 13px; padding: 4px 0; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.plan-features li::before { content: '✓'; color: var(--accent-green); font-weight: 700; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    transition: transform 0.3s ease;
    z-index: 200;
  }

  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }

  .main-content { margin-left: 0; }

  .chat-sidebar { display: none; }
  .chat-sidebar.open { display: flex; position: absolute; z-index: 50; top: 0; bottom: 0; left: 0; width: 280px; box-shadow: var(--shadow-xl); }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }

  .modal { padding: 20px; }
}

/* ============================================================
   ANIMATIONS & UTILITIES
   ============================================================ */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.loading { animation: pulse 1.5s infinite; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner-dark { border-color: rgba(0,0,0,0.15); border-top-color: var(--primary); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #f8f7ff 0%, #ffffff 50%, #f0f9ff 100%);
}

.auth-left {
  flex: 1;
  background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 50%, #A78BFA 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 40px;
  color: white;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='rgba(255,255,255,0.05)' stroke-width='1'/%3E%3C/svg%3E") repeat;
  background-size: 80px;
}

.auth-left .auth-brand { font-family: 'Sora', sans-serif; font-size: 32px; font-weight: 800; margin-bottom: 12px; position: relative; }
.auth-left .auth-tagline { font-size: 16px; opacity: 0.85; position: relative; max-width: 340px; text-align: center; line-height: 1.6; }

.auth-mentor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 40px; position: relative; }
.auth-mentor-card { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); border-radius: 12px; padding: 14px; text-align: center; backdrop-filter: blur(10px); }
.auth-mentor-card .icon { font-size: 28px; margin-bottom: 6px; }
.auth-mentor-card .name { font-size: 12px; font-weight: 600; opacity: 0.9; }

.auth-right {
  width: 480px;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}

.auth-form-container { width: 100%; max-width: 400px; }
.auth-form-container h2 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.auth-form-container p { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }

@media (max-width: 768px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; padding: 24px; }
}
