/* =============================================
   LITERATURA PRO — Custom Styles
   ============================================= */

:root {
  --brand-primary: #7c3aed;
  --brand-secondary: #4f46e5;
  --brand-accent: #f59e0b;
  --brand-dark: #0f0a1e;
  --brand-surface: #1a1035;
  --brand-card: #241847;
  --text-main: #f1f0f5;
  --text-muted: #9ca3af;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--brand-dark);
  color: var(--text-main);
  overflow-x: hidden;
}

body.light-mode {
  --brand-dark: #f8f7ff;
  --brand-surface: #ede9fe;
  --brand-card: #ffffff;
  --text-main: #1e1b4b;
  --text-muted: #6b7280;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--brand-surface); }
::-webkit-scrollbar-thumb { background: var(--brand-primary); border-radius: 3px; }

/* ---- HERO GRADIENT ---- */
.hero-gradient {
  background: radial-gradient(ellipse 80% 60% at 50% -10%, #7c3aed55, transparent),
              radial-gradient(ellipse 60% 40% at 80% 80%, #4f46e533, transparent),
              var(--brand-dark);
}

/* ---- GLASS CARD ---- */
.glass {
  background: rgba(124,58,237,0.10);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(124,58,237,0.25);
}

/* ---- GRADIENT TEXT ---- */
.gradient-text {
  background: linear-gradient(135deg, #a78bfa, #818cf8, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- BOOK CARD ---- */
.book-card {
  background: var(--brand-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 16px;
  transition: all 0.3s ease;
  overflow: hidden;
  cursor: pointer;
}
.book-card:hover {
  transform: translateY(-6px);
  border-color: var(--brand-primary);
  box-shadow: 0 20px 40px rgba(124,58,237,0.3);
}

.book-cover {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-radius: 8px;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--brand-surface);
  border-right: 1px solid rgba(124,58,237,0.2);
  transition: width 0.3s ease;
  flex-shrink: 0;
}
.sidebar.collapsed { width: 72px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(124,58,237,0.2);
  color: #a78bfa;
}
.sidebar-link.active { border-left: 3px solid var(--brand-primary); }

/* ---- BUTTONS ---- */
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(124,58,237,0.4);
}
.btn-secondary {
  background: transparent;
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,0.5);
  padding: 12px 28px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-secondary:hover { background: rgba(124,58,237,0.15); }

.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1e1b4b;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(245,158,11,0.4); }

/* ---- FORM INPUTS ---- */
.form-input {
  background: var(--brand-surface);
  border: 1px solid rgba(124,58,237,0.3);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 10px;
  width: 100%;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--brand-primary); }
.form-input::placeholder { color: var(--text-muted); }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- READING PROGRESS ---- */
.progress-bar {
  height: 4px;
  background: rgba(124,58,237,0.2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #f59e0b);
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ---- READING SCREEN ---- */
#reading-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 32px;
  line-height: 1.9;
  font-size: 18px;
  color: var(--text-main);
}
#reading-view.dark { background: #0f0a1e; color: #e2e0f0; }
#reading-view.sepia { background: #f5efe0; color: #3d2b1f; }

/* ---- PLAN BADGE ---- */
.plan-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.plan-free { background: rgba(156,163,175,0.2); color: #9ca3af; }
.plan-iniciante { background: rgba(59,130,246,0.2); color: #60a5fa; }
.plan-premium { background: rgba(245,158,11,0.2); color: #fbbf24; }
.plan-autor { background: rgba(124,58,237,0.2); color: #a78bfa; }
.plan-admin { background: rgba(239,68,68,0.2); color: #f87171; }

/* ---- STAT CARD ---- */
.stat-card {
  background: var(--brand-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s ease;
}
.stat-card:hover { border-color: rgba(124,58,237,0.5); }

/* ---- TOAST ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease;
  min-width: 280px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-success { background: #064e3b; border: 1px solid #10b981; color: #6ee7b7; }
.toast-error   { background: #450a0a; border: 1px solid #ef4444; color: #fca5a5; }
.toast-info    { background: #1e1b4b; border: 1px solid #6366f1; color: #a5b4fc; }
.toast-warn    { background: #451a03; border: 1px solid #f59e0b; color: #fcd34d; }

@keyframes slideIn {
  from { opacity:0; transform: translateX(50px); }
  to   { opacity:1; transform: translateX(0); }
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--brand-card);
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: 20px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn 0.25s ease;
}
@keyframes popIn {
  from { opacity:0; transform: scale(0.9); }
  to   { opacity:1; transform: scale(1); }
}

/* ---- TABS ---- */
.tab-bar { display: flex; gap: 4px; background: var(--brand-surface); border-radius: 12px; padding: 4px; }
.tab-btn {
  flex: 1; padding: 10px 16px; border: none; border-radius: 9px;
  font-weight: 600; font-size: 13px; cursor: pointer;
  background: transparent; color: var(--text-muted); transition: all 0.2s;
}
.tab-btn.active { background: var(--brand-primary); color: #fff; }

/* ---- STAR RATING ---- */
.star { color: #6b7280; font-size: 20px; cursor: pointer; transition: color 0.1s; }
.star.active, .star:hover { color: #f59e0b; }

/* ---- GAMIFICATION BADGE ---- */
.achievement {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  border: 2px solid rgba(124,58,237,0.4);
  background: rgba(124,58,237,0.1);
  transition: all 0.3s;
}
.achievement.earned {
  border-color: #f59e0b;
  background: rgba(245,158,11,0.15);
  box-shadow: 0 0 20px rgba(245,158,11,0.3);
}

/* ---- LOADER ---- */
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(124,58,237,0.2);
  border-top-color: var(--brand-primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- NAVIGATION ---- */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,10,30,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(124,58,237,0.2);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ---- LANDING SPECIFIC ---- */
.feature-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  margin-bottom: 16px;
}

.pricing-card {
  background: var(--brand-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 20px;
  padding: 32px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.pricing-card.popular {
  border-color: var(--brand-primary);
  box-shadow: 0 0 40px rgba(124,58,237,0.25);
}
.pricing-card:hover { transform: translateY(-4px); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -260px; z-index: 200; transition: left 0.3s ease; }
  .sidebar.mobile-open { left: 0; }
  #reading-view { padding: 24px 16px; font-size: 16px; }
}

/* ---- WALLET ---- */
.wallet-card {
  background: linear-gradient(135deg, #7c3aed, #4f46e5, #2563eb);
  border-radius: 20px;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.wallet-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}

/* ---- CHART PLACEHOLDER ---- */
.chart-bar {
  background: linear-gradient(180deg, #7c3aed, #4f46e540);
  border-radius: 4px 4px 0 0;
  min-width: 32px;
  transition: height 0.8s cubic-bezier(0.34,1.56,0.64,1);
}

/* ---- ANTI FRAUD INDICATORS ---- */
.fraud-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 99px;
}
.fraud-safe   { background: rgba(16,185,129,0.15); color: #34d399; }
.fraud-risk   { background: rgba(245,158,11,0.15); color: #fbbf24; }
.fraud-block  { background: rgba(239,68,68,0.15);  color: #f87171; }

/* ---- READING ENGAGEMENT BAR (fixed bottom) ---- */
#engagement-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(15,10,30,0.95);
  border-top: 1px solid rgba(124,58,237,0.3);
  padding: 10px 24px;
  display: flex; align-items: center; gap: 20px;
  z-index: 50;
  backdrop-filter: blur(8px);
}

/* ---- CATEGORY PILL ---- */
.category-pill {
  padding: 6px 16px; border-radius: 99px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  border: 1px solid rgba(124,58,237,0.3);
  background: transparent; color: var(--text-muted);
  white-space: nowrap;
}
.category-pill:hover, .category-pill.active {
  background: var(--brand-primary); color: #fff; border-color: var(--brand-primary);
}

/* ---- PAGE VIEWS ---- */
.page-view { display: none; }
.page-view.active { display: block; }
.app-layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; overflow-y: auto; }
