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

:root {
  --bg-base: #070711;
  --bg-surface: #0d0d1a;
  --bg-card: #111128;
  --purple-light: #a855f7;
  --purple-primary: #7c3aed;
  --purple-glow: rgba(124,58,237,0.4);
}

body {
  background-color: var(--bg-base);
  color: #f1f5f9;
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
}

.card-glow {
  background: rgba(17,17,40,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  transition: all 300ms ease;
}
.card-glow:hover {
  border-color: rgba(124,58,237,0.6);
  box-shadow: 0 10px 40px -10px var(--purple-glow);
}
.card-glow::before {
  content: '';
  position: absolute;
  top: -40px; left: -40px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-primary), var(--purple-light));
  color: white;
  padding: 10px 24px;
  border-radius: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(124,58,237,0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124,58,237,0.5);
}

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(124,58,237,0.4);
  color: var(--purple-light);
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-secondary:hover {
  background: rgba(124,58,237,0.1);
}

.input-dark {
  background: var(--bg-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 12px;
  padding: 10px 16px;
  color: white;
  width: 100%;
  transition: all 0.3s;
  outline: none;
}
.input-dark:focus {
  border-color: rgba(124,58,237,0.6);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

.tag-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(124,58,237,0.2);
  color: #94a3b8;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}
.tag-btn:hover {
  background: rgba(124,58,237,0.1);
  color: white;
}
.tag-btn.selected {
  background: rgba(124,58,237,0.2);
  border-color: var(--purple-primary);
  color: white;
  font-weight: 600;
}

.sidebar {
  position: fixed;
  left: 0; top: 0;
  height: 100vh; width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid rgba(124,58,237,0.1);
  display: flex; flex-direction: column;
}
.sidebar-logo {
  padding: 24px;
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 700; font-size: 20px;
  background: linear-gradient(135deg, #fff, var(--purple-light));
  -webkit-background-clip: text;
  color: transparent;
}
.sidebar-nav { padding: 0 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  color: #94a3b8;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
}
.nav-item:hover, .nav-item.active {
  background: rgba(124,58,237,0.1);
  color: white;
}
.nav-item.active {
  border-left: 3px solid var(--purple-primary);
}

.main-content {
  margin-left: 260px;
  padding: 24px;
  min-height: 100vh;
}

.spinner {
  border: 2px solid rgba(124,58,237,0.2);
  border-top-color: var(--purple-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 9999; }
.toast { background: var(--bg-card); border-left: 4px solid var(--purple-primary); padding: 16px 20px; border-radius: 8px; color: white; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); animation: slideIn 0.3s ease; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Editor Layout */
.editor-body { margin: 0; padding: 0; background: var(--bg-base); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.chapter-nav { width: 240px; background: var(--bg-surface); border-right: 1px solid rgba(124,58,237,0.1); overflow-y: auto; }
.chapter-item { padding: 10px 16px; margin: 4px 8px; border-radius: 8px; cursor: pointer; color: #94a3b8; display: flex; align-items: center; gap: 8px; transition: all 0.2s; }
.chapter-item:hover { background: rgba(124,58,237,0.05); }
.chapter-item.active { background: rgba(124,58,237,0.15); color: white; }
.chapter-status-dot { width: 8px; height: 8px; border-radius: 50%; }

.editor-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.editor-toolbar { padding: 10px 16px; background: var(--bg-surface); border-bottom: 1px solid rgba(124,58,237,0.1); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.toolbar-btn { background: transparent; border: none; color: #94a3b8; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.toolbar-btn:hover { background: rgba(124,58,237,0.15); color: white; }

.editor-area { max-width: 800px; width: 100%; margin: 0 auto; outline: none; font-family: Georgia, serif; font-size: 16px; line-height: 1.8; color: #e2e8f0; padding: 40px; min-height: 500px; }
.editor-area h2, .editor-area h3 { font-family: 'Inter', sans-serif; color: white; margin-top: 1.5em; margin-bottom: 0.5em; }
.editor-area p { margin-bottom: 1em; }
.editor-area ul, .editor-area ol { margin-left: 24px; margin-bottom: 1em; }

.ai-panel { width: 280px; background: var(--bg-surface); border-left: 1px solid rgba(124,58,237,0.1); padding: 16px; overflow-y: auto; }
.ai-action-btn { width: 100%; text-align: left; background: transparent; border: 1px solid rgba(124,58,237,0.2); color: #94a3b8; padding: 10px 14px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; transition: all 0.2s; }
.ai-action-btn:hover { background: rgba(124,58,237,0.1); color: white; border-color: rgba(124,58,237,0.4); }

.floating-menu { background: var(--bg-card); border: 1px solid rgba(124,58,237,0.3); border-radius: 8px; padding: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 1000; }
.floating-menu-btn { background: transparent; border: none; color: white; cursor: pointer; padding: 6px; border-radius: 4px; }
.floating-menu-btn:hover { background: rgba(124,58,237,0.2); }
