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

:root {
  /* Core Colors */
  --bg-primary: #0f1115;
  --bg-secondary: #1a1c23;
  --bg-glass: rgba(26, 28, 35, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-primary: #6366f1;
  --accent-secondary: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 255, 255, 0.15);
  
  /* Status Colors */
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background gradient blobs */
body::before, body::after {
  content: '';
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.15;
}

body::before {
  top: -10vw;
  left: -10vw;
  background: linear-gradient(135deg, #6366f1, #a855f7);
}

body::after {
  bottom: -10vw;
  right: -10vw;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  text-decoration: underline;
  color: #818cf8;
}

/* Base Utility Classes */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-weight: 500;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px var(--accent-glow);
  text-decoration: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glow);
  text-decoration: none;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  text-decoration: none;
}

.input, .textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
  font-size: 1rem;
}

.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.text-gradient {
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.App {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2.5rem;
  background: rgba(15, 17, 21, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.nav-brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text-primary);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--accent-primary);
}

.container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Auth Cards */
.auth-container {
  max-width: 440px;
  margin: 3rem auto;
  padding: 2.5rem;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: var(--text-secondary);
}

/* Poem List */
.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1.5rem;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
  width: 100%;
}

.poem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.poem-card {
  padding: 1.75rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.poem-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: 0 12px 32px -8px var(--accent-glow);
}

.poem-card h3 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 1.3rem;
}

.poem-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.poem-excerpt {
  color: var(--text-secondary);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
  line-height: 1.6;
}

/* Poem Detail Split Layout */
.poem-detail-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  align-items: start;
}

.poem-content-card {
  padding: 2.5rem;
}

.poem-content-card .poem-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.poem-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text-primary);
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-panel {
  padding: 1.5rem;
  position: sticky;
  top: 6rem;
}

.sidebar-header {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Tree visualization */
.branch-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.branch-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.branch-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.branch-item.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

.version-timeline {
  margin-top: 1.5rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.version-dot {
  position: relative;
  border-radius: 6px;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
  color: var(--text-primary);
}

.version-dot::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--text-secondary);
}

.version-dot:hover {
  border-color: var(--accent-primary);
  text-decoration: none;
}

.version-dot.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}

.version-dot.active::before {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Editor */
.editor-controls {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-textarea {
  min-height: 400px;
  font-family: inherit;
  font-size: 1.15rem;
  line-height: 1.8;
  resize: vertical;
}

/* Diff View */
.diff-container {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  font-family: monospace;
  font-size: 1.1rem;
  line-height: 1.6;
  white-space: pre-wrap;
  border: 1px solid var(--border-color);
  margin-top: 1.5rem;
}

.diff-added {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  text-decoration: underline;
  padding: 0.1rem;
  border-radius: 4px;
}

.diff-removed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  text-decoration: line-through;
  padding: 0.1rem;
  border-radius: 4px;
}

/* Comments */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.comment-item {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.comment-content {
  color: var(--text-primary);
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.comment-reply {
  margin-left: 2rem;
  margin-top: 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-color);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
  border-radius: 16px;
  border: 1px dashed var(--border-color);
}

.empty-state svg {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  opacity: 0.5;
}

@media (max-width: 900px) {
  .poem-detail-container {
    grid-template-columns: 1fr;
  }
}

/* Custom Additions */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.badge-accent {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent-primary);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.alert-message {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.vote-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.vote-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
  padding: 0.2rem;
}

.vote-btn:hover {
  color: var(--text-primary);
}

.vote-btn.active-up {
  color: var(--success);
}

.vote-btn.active-down {
  color: var(--error);
}

.vote-score {
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 1.5rem;
  text-align: center;
}

.interactive-graph {
  width: 100%;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
