/* ============================================
   INKUBADORA - Complete Stylesheet (DARK MODE DEFAULT)
   ============================================ */

/* ===== RESET & BASE (DARK) ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

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

/* ===== LANDING PAGE (DARK) ===== */
body.landing-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.landing-container {
  max-width: 1000px;
  width: 100%;
  text-align: center;
}

.landing-content {
  background: rgba(20, 20, 35, 0.95);
  padding: 3rem;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  margin-bottom: 2rem;
  border: 1px solid rgba(127, 124, 245, 0.2);
}

.landing-logo {
  font-size: 3.5rem;
  color: #7f7cf5;
  margin-bottom: 0.5rem;
}

.landing-tagline {
  font-size: 1.5rem;
  color: #a0a0c0;
  margin-bottom: 1rem;
}

.landing-description {
  font-size: 1.1rem;
  color: #9090b0;
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto 2rem auto;
}

.landing-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2.5rem;
  border-radius: 12px;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  min-width: 220px;
  text-align: center;
  border: none;
  cursor: pointer;
}

.landing-btn.primary {
  background: #5a52f7;
  color: white;
  box-shadow: 0 4px 15px rgba(90, 82, 247, 0.4);
}

.landing-btn.primary:hover {
  background: #6b64f8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(90, 82, 247, 0.5);
}

.landing-btn.secondary {
  background: transparent;
  color: #7f7cf5;
  border: 2px solid #7f7cf5;
}

.landing-btn.secondary:hover {
  background: #7f7cf5;
  color: white;
  transform: translateY(-2px);
}

.landing-features {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.feature {
  background: rgba(20, 20, 35, 0.9);
  padding: 2rem;
  border-radius: 16px;
  width: 250px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
  border: 1px solid rgba(127, 124, 245, 0.1);
}

.feature:hover {
  transform: translateY(-5px);
  border-color: rgba(127, 124, 245, 0.3);
}

.feature-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.feature h3 {
  color: #7f7cf5;
  margin-bottom: 0.5rem;
}

.feature p {
  color: #9090b0;
  font-size: 0.95rem;
}

.landing-footer {
  margin-top: 2rem;
  color: #606080;
  font-size: 0.9rem;
}

/* ===== LOGIN PAGE (DARK) ===== */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.back-btn {
  position: absolute;
  top: 2rem;
  left: 2rem;
  color: #a0a0c0;
  text-decoration: none;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.back-btn:hover {
  color: #7f7cf5;
  transform: translateX(-5px);
}

.login-container {
  background: rgba(20, 20, 35, 0.95);
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  width: 360px;
  text-align: center;
  border: 1px solid rgba(127, 124, 245, 0.2);
}

.login-container h1 {
  margin-bottom: 0.5rem;
  color: #7f7cf5;
  font-size: 2rem;
}

.login-container p {
  margin-bottom: 1.5rem;
  color: #9090b0;
}

.login-container input,
.login-container select {
  width: 100%;
  padding: 0.9rem;
  margin-bottom: 1rem;
  border: 2px solid #2a2a45;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.2s;
  background: #1a1a2e;
  color: #e0e0e0;
}

.login-container input:focus,
.login-container select:focus {
  outline: none;
  border-color: #5a52f7;
}

.login-container label {
  display: block;
  text-align: left;
  margin-bottom: 0.5rem;
  color: #a0a0c0;
  font-weight: 500;
}

.login-container button[type="submit"] {
  width: 100%;
  padding: 1rem;
  margin-top: 0.5rem;
  background: #5a52f7;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.login-container button[type="submit"]:hover {
  background: #6b64f8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(90, 82, 247, 0.4);
}

.secondary {
  background: #2a2a45;
  color: #e0e0e0;
  border: 2px solid #3a3a55;
  margin-top: 1rem;
  width: 100%;
  padding: 1rem;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.secondary:hover {
  background: #3a3a55;
  transform: translateY(-2px);
}

.note {
  font-size: 0.85rem;
  color: #606080;
  margin-top: 1.5rem;
}

#registerSection {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px dashed #2a2a45;
}

#registerSection h3 {
  margin-bottom: 1rem;
  color: #7f7cf5;
}

/* ===== SIDEBAR (DARK) ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: #1e1e32;
  color: #e0e0e0;
  padding: 1.5rem 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(127, 124, 245, 0.1);
}

/* Clean hamburger button */
.menu-btn {
  background: rgba(127, 124, 245, 0.15);
  border: none;
  color: #e0e0e0;
  font-size: 1.4rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
}

.menu-btn:hover {
  background: rgba(127, 124, 245, 0.3);
  transform: scale(1.05);
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1rem 0;
  padding-left: 0.5rem;
  color: #7f7cf5;
}

/* Navigation menu */
.side-nav {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(127, 124, 245, 0.08);
  border-radius: 16px;
  padding: 1rem;
  backdrop-filter: blur(10px);
}

.side-nav a,
.side-nav button.nav-btn {
  background: transparent;
  border: none;
  color: #e0e0e0;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  transition: all 0.2s ease;
  width: 100%;
  box-shadow: none;
  margin: 0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.side-nav a:hover,
.side-nav button.nav-btn:hover {
  background: rgba(127, 124, 245, 0.2);
  transform: translateX(5px);
  color: #7f7cf5;
}

/* Theme toggle at bottom */
.theme-btn {
  background: rgba(127, 124, 245, 0.1);
  border: none;
  color: #e0e0e0;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.8rem;
  border-radius: 10px;
  margin-top: auto;
  transition: all 0.2s ease;
  width: 100%;
  box-shadow: none;
}

.theme-btn:hover {
  background: rgba(127, 124, 245, 0.25);
  transform: scale(1.05);
}

.hidden {
  display: none !important;
}

/* ===== MAIN CONTENT (DARK) ===== */
main {
  margin-left: 220px;
  padding: 2rem;
  min-height: 100vh;
  background: #0f0f1a;
}

/* Home page */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

.intro {
  text-align: center;
  margin-bottom: 3rem;
}

.intro h2 {
  font-size: 2rem;
  color: #7f7cf5;
  margin-bottom: 1rem;
}

.intro p {
  line-height: 1.8;
  color: #9090b0;
  font-size: 1.1rem;
}

/* Hero section */
.hero {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.hero-content {
  background: #1a1a2e;
  padding: 3rem 4rem;
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  text-align: center;
  max-width: 520px;
  width: 100%;
  border: 1px solid rgba(127, 124, 245, 0.1);
}

.hero-logo {
  width: 90px;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 0.3rem;
  color: #e0e0e0;
}

.tagline {
  color: #9090b0;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  width: 100%;
}

.hero-btn {
  padding: 0.9rem 1.4rem;
  border-radius: 14px;
  text-decoration: none;
  font-size: 1.1rem;
  background: #5a52f7;
  color: white;
  font-weight: 600;
  transition: all 0.2s ease;
  width: 200px;
  text-align: center;
  display: block;
}

.hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(90, 82, 247, 0.3);
}

/* Stats cards */
.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 3rem;
}

.card {
  background: #1a1a2e;
  padding: 1.5rem;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  width: 200px;
  text-align: center;
  transition: transform 0.2s;
  border: 1px solid rgba(127, 124, 245, 0.1);
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(127, 124, 245, 0.3);
}

.card h3 {
  margin-bottom: 0.5rem;
  color: #9090b0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card p {
  font-size: 2rem;
  color: #7f7cf5;
  font-weight: 700;
}

/* ===== LIBRARY PAGE (DARK) ===== */
.library-page {
  max-width: 1200px;
  margin: 0 auto;
}

.library-header {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

#searchInput {
  width: 100%;
  max-width: 600px;
  padding: 1rem 1.5rem;
  border: 2px solid #2a2a45;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s;
  background: #1a1a2e;
  color: #e0e0e0;
}

#searchInput:focus {
  outline: none;
  border-color: #5a52f7;
}

.library-books {
  display: grid;
  gap: 1.5rem;
}

.book {
  background: #1a1a2e;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  padding: 1.5rem;
  transition: transform 0.2s;
  border: 1px solid rgba(127, 124, 245, 0.1);
}

.book:hover {
  transform: translateY(-3px);
  border-color: rgba(127, 124, 245, 0.3);
}

.book h3 {
  color: #7f7cf5;
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
}

.book img {
  margin: 1rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.book details {
  margin: 1rem 0;
  padding: 1rem;
  background: #141425;
  border-radius: 10px;
}

.book details summary {
  cursor: pointer;
  font-weight: 600;
  color: #7f7cf5;
}

.views {
  font-size: 0.9rem;
  color: #606080;
  margin-top: 0.5rem;
}

.comments {
  background: #141425;
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1rem;
}

.comments h4 {
  margin-bottom: 0.8rem;
  color: #7f7cf5;
}

.comments p {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: #1a1a2e;
  border-radius: 8px;
  color: #c0c0d0;
}

.comments textarea {
  width: 100%;
  height: 80px;
  resize: none;
  border-radius: 10px;
  border: 2px solid #2a2a45;
  padding: 0.8rem;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  background: #1a1a2e;
  color: #e0e0e0;
}

.comments button {
  background: #5a52f7;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.comments button:hover {
  background: #6b64f8;
  transform: scale(1.05);
}

.ad {
  background: linear-gradient(135deg, #1a1a2e, #252538);
  border: 2px solid #3a3555;
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  margin: 1rem 0;
}

.ad h4 {
  color: #f6d365;
  margin-bottom: 0.5rem;
}

.export-btn {
  margin-top: 0.5rem;
  background: #00a86b;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.export-btn:hover {
  background: #00c77b;
  transform: scale(1.05);
}

/* ===== PUBLISH PAGE (DARK) ===== */
.publish-page {
  max-width: 900px;
  margin: 0 auto;
  background: #1a1a2e;
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border: 1px solid rgba(127, 124, 245, 0.1);
}

.submit-form h2 {
  margin-bottom: 1.5rem;
  color: #7f7cf5;
  font-size: 1.8rem;
}

.submit-form input,
.submit-form textarea,
.submit-form select {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 2px solid #2a2a45;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.2s;
  background: #141425;
  color: #e0e0e0;
}

.submit-form input:focus,
.submit-form textarea:focus {
  outline: none;
  border-color: #5a52f7;
}

.submit-form label {
  display: block;
  margin-bottom: 0.5rem;
  color: #a0a0c0;
  font-weight: 500;
}

.editor-tools {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.editor-tools button,
.editor-tools select {
  padding: 0.6rem 1rem;
  border: 2px solid #2a2a45;
  border-radius: 8px;
  background: #1a1a2e;
  color: #e0e0e0;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.editor-tools button:hover {
  background: #5a52f7;
  color: white;
  border-color: #5a52f7;
}

.editor-area {
  border: 2px solid #2a2a45;
  border-radius: 12px;
  padding: 1.5rem;
  min-height: 200px;
  background: #141425;
  margin-bottom: 1.5rem;
  line-height: 1.6;
  color: #e0e0e0;
}

.preview {
  margin-top: 2rem;
  padding: 2rem;
  background: #141425;
  border-radius: 16px;
  border: 2px dashed #5a52f7;
}

.preview h2 {
  color: #7f7cf5;
  margin-bottom: 1rem;
}

/* ===== PROFILE PAGE (DARK) ===== */
.profile-page {
  max-width: 900px;
  margin: 0 auto;
  background: #1a1a2e;
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border: 1px solid rgba(127, 124, 245, 0.1);
}

.profile-info {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid #2a2a45;
}

.profile-info h2 {
  color: #7f7cf5;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.profile-info p {
  color: #9090b0;
}

.my-books h3 {
  color: #e0e0e0;
  margin-bottom: 1.5rem;
}

.my-books .book {
  background: #141425;
  border-left: 4px solid #5a52f7;
}

.my-books button {
  margin-top: 0.5rem;
  margin-right: 0.5rem;
  background: #5a52f7;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.my-books button.delete {
  background: #e74c3c;
}

.my-books button:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

/* ===== DASHBOARD PAGE (DARK) ===== */
/* Fix dashboard layout */
.dashboard-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: calc(100% - 240px); /* Account for sidebar */
}

.dashboard-page h1 {
  color: #7f7cf5;
  margin-bottom: 2rem;
  font-size: 1.8rem;
  word-wrap: break-word;
}

/* Fix the cards */
.admin-panel,
#analyticsSection {
  background: #1a1a2e;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(127, 124, 245, 0.1);
  width: 100%;
  box-sizing: border-box;
}

.admin-panel h2,
#analyticsSection h2 {
  color: #e0e0e0;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  word-wrap: break-word;
}

/* Fix book cards in admin */
#adminBooks .book {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1.5rem;
}

#adminBooks h3 {
  color: #9090b0;
  margin: 2rem 0 1rem 0;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  word-wrap: break-word;
}

/* Admin book header fix */
.admin-book-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap; /* Allow wrapping */
}

.admin-book-header h3 {
  margin: 0;
  color: #7f7cf5;
  word-wrap: break-word;
  max-width: 100%;
}

.admin-book-header p {
  word-wrap: break-word;
  max-width: 100%;
}

/* Stats grid fix */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-item {
  background: #141425;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(127, 124, 245, 0.1);
  word-wrap: break-word;
}

/* Admin actions wrap */
.admin-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Ensure main content doesn't overflow */
main {
  margin-left: 220px;
  padding: 2rem;
  min-height: 100vh;
  background: #0f0f1a;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Fix for long text */
.book {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.book h3, .book p {
  max-width: 100%;
  word-wrap: break-word;
}

/* ===== LIGHT MODE (Optional toggle) ===== */
body.light {
  background: #f7f8fc;
  color: #333;
}

body.light main {
  background: #f7f8fc;
}

body.light .sidebar {
  background: #5a52f7;
  color: white;
}

body.light .hero-content,
body.light .card,
body.light .profile-page,
body.light .publish-page,
body.light .book {
  background: white;
  color: #333;
}

/* ===== FOOTER ===== */
footer {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 0.8rem 1.2rem;
  font-size: 0.9rem;
  color: #606080;
  background: rgba(15, 15, 26, 0.9);
  backdrop-filter: blur(6px);
  border-top-left-radius: 12px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
  z-index: 50;
}

/* ===== SCROLLBAR (DARK) ===== */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #1a1a2e;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: #5a52f7;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b64f8;
}
/* ============================================
   NEW FEATURES CSS
   ============================================ */

/* Achievement Popup */
.achievement-popup {
  position: fixed;
  top: 20px;
  right: -400px;
  background: linear-gradient(135deg, #5a52f7, #7f7cf5);
  color: white;
  padding: 1.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(90, 82, 247, 0.4);
  z-index: 1000;
  transition: right 0.5s ease;
  max-width: 350px;
}

.achievement-popup.show {
  right: 20px;
}

.achievement-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.achievement-icon {
  font-size: 3rem;
}

.achievement-popup h4 {
  margin: 0 0 0.3rem 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.achievement-popup p {
  margin: 0;
  font-size: 1rem;
}

/* Achievement Badges */
.achievements-showcase {
  margin-top: 3rem;
  padding: 2rem;
  background: #1a1a2e;
  border-radius: 16px;
  border: 1px solid rgba(127, 124, 245, 0.2);
}

.achievements-showcase h3 {
  color: #7f7cf5;
  margin-bottom: 1rem;
  text-align: center;
}

.achievements-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.achievement-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: rgba(127, 124, 245, 0.1);
  border-radius: 12px;
  min-width: 80px;
  cursor: help;
  transition: transform 0.2s;
}

.achievement-badge:hover {
  transform: scale(1.1);
  background: rgba(127, 124, 245, 0.2);
}

.achievement-badge span {
  font-size: 2rem;
  margin-bottom: 0.3rem;
}

.achievement-badge small {
  font-size: 0.75rem;
  color: #9090b0;
  text-align: center;
}

.achievement-badge.large {
  min-width: 100px;
  padding: 1.5rem;
}

.achievement-badge.large span {
  font-size: 3rem;
}

/* Reading Progress Bar */
.reading-progress-container {
  position: fixed;
  top: 0;
  left: 220px;
  right: 0;
  height: 4px;
  background: rgba(127, 124, 245, 0.1);
  z-index: 100;
}

.reading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #5a52f7, #7f7cf5);
  width: 0%;
  transition: width 0.3s;
}

.progress-bar.small {
  height: 6px;
  background: rgba(127, 124, 245, 0.2);
  border-radius: 3px;
  margin: 0.5rem 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #5a52f7;
  border-radius: 3px;
  transition: width 0.3s;
}

/* Auto-save Status */
.autosave-status {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: #00a86b;
  color: white;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  font-weight: 500;
}

.autosave-status.show {
  opacity: 1;
  transform: translateY(0);
}

/* Word Counter */
.word-counter {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(127, 124, 245, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #7f7cf5;
  font-weight: 600;
}

/* Bookmarks */
.bookmark-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s;
  padding: 0.5rem;
}

.bookmark-btn:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

.bookmark-btn.active {
  opacity: 1;
}

/* Grid View */
.library-books.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.library-books.grid-view .book {
  display: flex;
  flex-direction: column;
}

.library-books.grid-view .book-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
}

/* Book Covers */
.book-cover {
  width: 120px;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.book-cover.placeholder {
  background: linear-gradient(135deg, #2a2a45, #3a3a55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

/* Category Tags */
.category-tag {
  background: rgba(127, 124, 245, 0.2);
  color: #7f7cf5;
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Book Header with Bookmark */
.book-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

/* Preview in Publish */
.preview-header {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid rgba(127, 124, 245, 0.2);
}

.preview-cover {
  width: 150px;
  height: 220px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.preview-meta h3 {
  color: #7f7cf5;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.meta-line {
  color: #9090b0;
  margin-bottom: 0.5rem;
}

.category-preview {
  display: inline-block;
  background: rgba(127, 124, 245, 0.2);
  color: #7f7cf5;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

.preview-desc {
  font-style: italic;
  color: #a0a0c0;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(127, 124, 245, 0.05);
  border-radius: 8px;
  border-left: 3px solid #5a52f7;
}

/* Writer Stats */
.writer-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #1a1a2e;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(127, 124, 245, 0.2);
}

.stat-card span {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #7f7cf5;
  margin-bottom: 0.3rem;
}

.stat-card label {
  font-size: 0.85rem;
  color: #9090b0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Mini Book in Profile */
.book-mini {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.mini-cover {
  width: 80px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
}

.mini-cover.placeholder {
  background: linear-gradient(135deg, #2a2a45, #3a3a55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.mini-info {
  flex: 1;
}

.mini-info h4 {
  color: #7f7cf5;
  margin-bottom: 0.3rem;
}

.mini-info p {
  color: #9090b0;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* Admin Dashboard */
.admin-book-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-thumb {
  width: 60px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
}

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.status-badge.pending {
  background: rgba(246, 211, 101, 0.2);
  color: #f6d365;
}

.status-badge.approved {
  background: rgba(0, 168, 107, 0.2);
  color: #00a86b;
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.admin-actions button {
  width: auto;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

.approve-btn {
  background: #00a86b;
}

.approve-btn:hover {
  background: #00c77b;
}

.delete-btn {
  background: #e74c3c;
}

.delete-btn:hover {
  background: #ff6b6b;
}

/* Filters */
.library-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  color: #9090b0;
}

.view-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #5a52f7;
}

/* More Comments */
.more-comments {
  color: #5a52f7;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  padding: 0.5rem;
}

.more-comments:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .writer-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .preview-header {
    flex-direction: column;
  }
  
  .preview-cover {
    width: 100%;
    height: 300px;
  }
  
  .reading-progress-container {
    left: 0;
  }
}
/* Add to STYLE.CSS - Fix publish form */
#bookForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#bookForm input,
#bookForm select,
#bookForm textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid #2a2a45;
  border-radius: 10px;
  background: #141425;
  color: #e0e0e0;
  font-size: 1rem;
}

#bookForm input:focus,
#bookForm select:focus,
#bookForm textarea:focus {
  outline: none;
  border-color: #5a52f7;
}

#bookForm label {
  color: #a0a0c0;
  font-weight: 500;
  margin-bottom: -0.5rem;
}
/* Fix dashboard layout */
.dashboard-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Force main content to stay right of sidebar */
main {
  margin-left: 220px !important;
  padding: 2rem;
  min-height: 100vh;
  background: #0f0f1a;
  box-sizing: border-box;
  width: calc(100% - 220px) !important;
  max-width: calc(100% - 220px) !important;
  overflow-x: hidden;
}

/* Dashboard specific */
.dashboard-page {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

/* Ensure cards don't overflow */
.admin-panel,
#analyticsSection {
  background: #1a1a2e;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(127, 124, 245, 0.1);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Stats grid - force 5 columns max */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  width: 100%;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 800px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

.admin-panel h2,
#analyticsSection h2 {
  color: #e0e0e0;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-item {
  background: #141425;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(127, 124, 245, 0.1);
}

.stat-item span {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: #7f7cf5;
  margin-bottom: 0.5rem;
}

.stat-item label {
  font-size: 0.9rem;
  color: #9090b0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Admin book cards */
#adminBooks .book {
  margin-bottom: 1.5rem;
}

#adminBooks h3 {
  color: #9090b0;
  margin: 2rem 0 1rem 0;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#adminBooks h3:first-child {
  margin-top: 0;
}
/* Role-based menu items */
/* Role-based menu visibility */
.writer-only,
.admin-only,
.reader-only {
  display: none;
}

/* Writers see writer-only items */
body.is-writer .writer-only {
  display: flex;
}

/* Admins see writer-only AND admin-only items */
body.is-admin .writer-only,
body.is-admin .admin-only {
  display: flex;
}

/* Readers see reader-only items */
body.is-reader .reader-only {
  display: flex;
}

/* Disabled nav item (for readers trying to publish) */
.nav-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 1rem;
  color: #606080;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  user-select: none;
}

.nav-disabled:hover {
  background: rgba(255, 0, 0, 0.05);
}
/* Fix publish button */
#bookForm button[type="submit"] {
  background: #5a52f7 !important;
  color: white !important;
  border: none !important;
  padding: 1rem 2rem !important;
  border-radius: 10px !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  width: 100% !important;
  margin-top: 1rem !important;
  display: block !important;
}

#bookForm button[type="submit"]:hover {
  background: #6b64f8 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(90, 82, 247, 0.4) !important;
}
/* AI Assistant */
.ai-assistant {
  background: #1a1a2e;
  padding: 1.5rem;
  border-radius: 12px;
  margin-top: 1.5rem;
  border: 1px solid rgba(127, 124, 245, 0.2);
}

.ai-assistant h4 {
  color: #7f7cf5;
  margin-bottom: 0.5rem;
}

#aiResult {
  margin-top: 1rem;
  padding: 1rem;
  background: #141425;
  border-radius: 8px;
}

/* Idea Generator */
.ideas-page {
  max-width: 800px;
  margin: 0 auto;
}

.idea-generator {
  background: #1a1a2e;
  padding: 2rem;
  border-radius: 16px;
  margin-top: 2rem;
}

.idea-card {
  background: #141425;
  padding: 1.5rem;
  border-radius: 12px;
  margin: 1.5rem 0;
  border-left: 4px solid #5a52f7;
}

.saved-idea {
  background: #141425;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Room Customization */
.my-room {
  margin-top: 2rem;
}

.room-preview {
  background: #141425;
  min-height: 200px;
  border-radius: 12px;
  padding: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: center;
}

.room-item {
  font-size: 3rem;
}

.shop-items {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.shop-items button {
  width: auto;
  padding: 0.8rem 1.2rem;
}