/* ============================================================
   Minha Biblioteca — Design System
   Paleta pastel · Mobile-first · Tipografia elegante
   ============================================================ */

/* ---- Google Fonts ----------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ---- Custom Properties ------------------------------------ */
:root {
  /* Cores principais */
  --pink:        #F8C8DC;
  --pink-dark:   #f0a8c4;
  --blue:        #CDE7F0;
  --blue-dark:   #aad3e8;
  --green:       #DFF5E1;
  --green-dark:  #bfe8c2;
  --beige:       #F7F3ED;
  --beige-dark:  #ede7de;

  /* UI */
  --bg:          #F4EFE8;
  --surface:     #FFFFFF;
  --surface-2:   #FAFAFA;
  --border:      #E8E3DC;
  --border-dark: #D5CFC7;

  /* Texto */
  --text:        #2D2D2D;
  --text-muted:  #6B7280;
  --text-light:  #9CA3AF;

  /* Status */
  --status-quero-ler:  #CDE7F0;
  --status-lendo:      #F8C8DC;
  --status-lido:       #DFF5E1;
  --status-abandonado: #FDE8C8;
  --status-favorito:   #F0D0F8;

  /* Rating */
  --star-on:   #F59E0B;
  --star-off:  #D1D5DB;

  /* Layout */
  --sidebar-w:   260px;
  --header-h:    68px;

  /* Sombras */
  --shadow-xs:   0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,.09);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
  --shadow-xl:   0 16px 48px rgba(0,0,0,.14);

  /* Raios */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;

  /* Fonte */
  --font-title: 'Playfair Display', Georgia, serif;
  --font-body:  'Inter', system-ui, sans-serif;

  /* Transições */
  --t: .2s ease;
  --t-slow: .35s ease;
}

/* ---- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a  { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
ul { list-style: none; }

/* ---- Typography ------------------------------------------- */
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 600; line-height: 1.3; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; font-family: var(--font-body); font-weight: 600; }
p  { line-height: 1.7; }

/* ============================================================
   LAYOUT APP (sidebar + main)
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--t-slow);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--pink);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.sidebar-tagline {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: .03em;
}

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: .85rem;
  color: #374151;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav */
.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}
.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 500;
  transition: background var(--t), color var(--t);
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--beige); color: var(--text); }
.nav-item.active {
  background: var(--pink);
  color: var(--text);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--pink-dark);
  color: #333;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}

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

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

/* ---- Top Header -------------------------------------------- */
.top-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.header-search input {
  width: 100%;
  background: var(--beige);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  padding: 9px 16px 9px 42px;
  font-size: .88rem;
  transition: border-color var(--t), background var(--t);
  outline: none;
}
.header-search input:focus {
  background: var(--surface);
  border-color: var(--pink-dark);
}
.header-search .search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: .9rem;
  pointer-events: none;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--beige); color: var(--text); }

/* Hamburger (mobile) */
.hamburger {
  display: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
  font-size: 1.3rem;
}

/* ---- Page Content ----------------------------------------- */
.page-content {
  padding: 28px;
  flex: 1;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.breadcrumb {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.breadcrumb span { color: var(--text); }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  font-size: .88rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary  { background: var(--pink);  color: #333; }
.btn-primary:hover:not(:disabled)  { background: var(--pink-dark); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--blue); color: #333; }
.btn-secondary:hover:not(:disabled) { background: var(--blue-dark); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-success  { background: var(--green); color: #1a5c1a; }
.btn-success:hover:not(:disabled) { background: var(--green-dark); }
.btn-outline  { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border-dark); }
.btn-outline:hover:not(:disabled) { border-color: var(--text-muted); color: var(--text); }
.btn-danger   { background: #FEE2E2; color: #B91C1C; }
.btn-danger:hover:not(:disabled) { background: #FECACA; }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--beige); color: var(--text); }
.btn-sm  { padding: 7px 14px; font-size: .8rem; }
.btn-lg  { padding: 13px 28px; font-size: .95rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 9px; }
.btn-google {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-dark);
  gap: 10px;
}
.btn-google:hover { background: var(--beige); border-color: var(--border-dark); }
.btn-google img { width: 18px; height: 18px; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: .83rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: .02em;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--beige);
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  font-size: .9rem;
  color: var(--text);
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
  outline: none;
}
.form-control:focus {
  background: var(--surface);
  border-color: var(--pink-dark);
  box-shadow: 0 0 0 3px rgba(248,200,220,.25);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: .78rem; color: #DC2626; margin-top: 4px; }
.input-group { position: relative; }
.input-group .input-icon {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  cursor: pointer;
}

/* ============================================================
   CARDS ESTATÍSTICA (Dashboard)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.stat-card.pink::before   { background: var(--pink); }
.stat-card.blue::before   { background: var(--blue-dark); }
.stat-card.green::before  { background: var(--green-dark); }
.stat-card.purple::before { background: #E9D5FF; }
.stat-card.orange::before { background: #FDE68A; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 14px;
}
.stat-card.pink   .stat-icon { background: var(--pink);  }
.stat-card.blue   .stat-icon { background: var(--blue);  }
.stat-card.green  .stat-icon { background: var(--green); }
.stat-card.purple .stat-icon { background: #F3E8FF; }
.stat-card.orange .stat-icon { background: #FEF3C7; }

.stat-value {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   LIVROS — CARDS
   ============================================================ */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
}
.books-grid.large { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px; }

.book-card {
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t), box-shadow var(--t);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.book-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--beige);
}
.book-cover-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}
.book-card:hover .book-cover-wrap img { transform: scale(1.04); }

.book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--beige), var(--blue));
  color: var(--text-muted);
  font-size: .75rem;
  text-align: center;
  padding: 12px;
  gap: 8px;
}
.book-cover-placeholder .cover-icon { font-size: 2rem; opacity: .5; }

.book-status-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.4);
}
.status-quero_ler  { background: rgba(205,231,240,.85); color: #1e6080; }
.status-lendo      { background: rgba(248,200,220,.85); color: #7d2050; }
.status-lido       { background: rgba(223,245,225,.85); color: #1a5c1a; }
.status-abandonado { background: rgba(253,232,200,.85); color: #7c4a00; }
.status-favorito   { background: rgba(240,208,248,.85); color: #5c1a7c; }

.book-card-actions {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--t);
}
.book-card:hover .book-card-actions { opacity: 1; }
.book-card-actions .btn { padding: 8px 14px; font-size: .78rem; }

.book-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.book-title {
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.book-author {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}
.book-card-rating { margin-top: auto; }

/* ============================================================
   LISTA DE LIVROS (visualização em tabela)
   ============================================================ */
.books-list { display: flex; flex-direction: column; gap: 10px; }
.book-list-item {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t);
}
.book-list-item:hover { box-shadow: var(--shadow-sm); }
.book-list-cover {
  width: 48px; height: 72px;
  border-radius: var(--r-xs);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--beige);
}
.book-list-info { flex: 1; min-width: 0; }
.book-list-title {
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-list-meta {
  font-size: .78rem;
  color: var(--text-muted);
}
.book-list-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   ESTRELAS / RATING
   ============================================================ */
.star-rating {
  display: inline-flex;
  gap: 2px;
}
.star {
  color: var(--star-off);
  font-size: .95rem;
  cursor: default;
  transition: color var(--t), transform var(--t);
  line-height: 1;
}
.star.filled { color: var(--star-on); }
.star-rating.interactive .star {
  cursor: pointer;
}
.star-rating.interactive .star:hover,
.star-rating.interactive .star:hover ~ .star { color: var(--star-off); }
.star-rating.interactive:hover .star,
.star-rating.interactive .star.hovered { color: var(--star-on); }

/* ============================================================
   STATUS SELECTOR
   ============================================================ */
.status-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.status-btn {
  padding: 7px 14px;
  border-radius: var(--r-full);
  font-size: .8rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--t);
  background: var(--beige);
  color: var(--text-muted);
}
.status-btn:hover { border-color: var(--border-dark); color: var(--text); }
.status-btn.active.quero_ler  { background: var(--status-quero-ler);  border-color: var(--blue-dark);  color: #1e6080; }
.status-btn.active.lendo      { background: var(--status-lendo);      border-color: var(--pink-dark);  color: #7d2050; }
.status-btn.active.lido       { background: var(--status-lido);       border-color: var(--green-dark); color: #1a5c1a; }
.status-btn.active.abandonado { background: var(--status-abandonado); border-color: #f0b860;           color: #7c4a00; }
.status-btn.active.favorito   { background: var(--status-favorito);   border-color: #d0a0e8;           color: #5c1a7c; }

/* ============================================================
   PROGRESS / GOALS
   ============================================================ */
.progress-bar-wrap {
  background: var(--border);
  border-radius: var(--r-full);
  height: 10px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--pink), var(--pink-dark));
  transition: width .6s ease;
}
.progress-bar.blue  { background: linear-gradient(90deg, var(--blue), var(--blue-dark)); }
.progress-bar.green { background: linear-gradient(90deg, var(--green), var(--green-dark)); }

.goal-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.goal-numbers {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.goal-current { font-family: var(--font-title); font-size: 1.8rem; font-weight: 700; }
.goal-target  { font-size: .88rem; color: var(--text-muted); }
.goal-percent { font-size: .78rem; color: var(--text-muted); margin-top: 8px; text-align: right; }

/* ============================================================
   CHARTS / SECTION CARDS
   ============================================================ */
.section-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-card h3 {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
}
.chart-container { position: relative; }

/* ============================================================
   TAGS
   ============================================================ */
.tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--beige);
  color: var(--text-muted);
  border-radius: var(--r-full);
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 500;
  border: 1px solid var(--border-dark);
  transition: background var(--t);
}
.tag:hover { background: var(--border); }
.tag .tag-remove {
  cursor: pointer;
  color: var(--text-light);
  font-size: .7rem;
  line-height: 1;
  transition: color var(--t);
}
.tag .tag-remove:hover { color: #DC2626; }
.tag-input-wrap { display: flex; gap: 8px; align-items: center; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 32px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(.95) translateY(20px);
  transition: transform var(--t-slow);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-family: var(--font-title); font-size: 1.3rem; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--beige);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  transition: background var(--t), color var(--t);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 340px;
  pointer-events: all;
  animation: toastIn .35s ease forwards;
  border-left: 4px solid var(--border);
}
.toast.success { border-color: var(--green-dark); }
.toast.error   { border-color: #F87171; }
.toast.info    { border-color: var(--blue-dark); }
.toast.warning { border-color: #FBBF24; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: .88rem; font-weight: 600; margin-bottom: 2px; }
.toast-msg   { font-size: .8rem; color: var(--text-muted); }
.toast-dismiss {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: .85rem;
  padding: 0 0 0 4px;
  align-self: flex-start;
  flex-shrink: 0;
}
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform: translateX(0); } }
@keyframes toastOut { to   { opacity:0; transform: translateX(40px); } }

/* ============================================================
   UPLOAD DE CAPA
   ============================================================ */
.cover-upload-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--r-md);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  position: relative;
}
.cover-upload-zone:hover,
.cover-upload-zone.dragover {
  border-color: var(--pink-dark);
  background: var(--pink);
  background: rgba(248,200,220,.1);
}
.cover-upload-zone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.cover-preview {
  display: none;
  width: 120px;
  height: 180px;
  object-fit: cover;
  border-radius: var(--r-sm);
  margin: 0 auto 10px;
  box-shadow: var(--shadow-md);
}
.cover-upload-zone.has-preview .cover-preview { display: block; }
.cover-upload-icon { font-size: 2.2rem; color: var(--text-light); margin-bottom: 8px; }
.cover-upload-text { font-size: .85rem; color: var(--text-muted); }
.cover-upload-hint { font-size: .75rem; color: var(--text-light); margin-top: 4px; }

/* ============================================================
   FILTRO / CATALOG CONTROLS
   ============================================================ */
.catalog-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.catalog-search {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.catalog-search input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .88rem;
  outline: none;
  transition: border-color var(--t);
}
.catalog-search input:focus { border-color: var(--pink-dark); }
.catalog-search .search-icon {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}
.filter-select {
  padding: 9px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .85rem;
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color var(--t);
}
.filter-select:focus { border-color: var(--pink-dark); }
.view-toggle {
  display: flex;
  background: var(--beige);
  border-radius: var(--r-sm);
  padding: 3px;
}
.view-btn {
  width: 34px; height: 30px;
  border: none;
  background: transparent;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--text-muted);
  font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t), color var(--t);
}
.view-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ============================================================
   PÁGINA DO LIVRO
   ============================================================ */
.book-detail {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}
.book-detail-cover {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}
.book-detail-cover img {
  width: 100%;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.book-cover-empty {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--beige), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  color: var(--text-light);
  box-shadow: var(--shadow-lg);
}
.book-detail-meta { display: flex; flex-direction: column; gap: 24px; }
.book-detail-title {
  font-family: var(--font-title);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
}
.book-detail-author {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.book-specs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.spec-item { }
.spec-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-light);
  margin-bottom: 3px;
}
.spec-value { font-size: .9rem; font-weight: 500; }
.book-description {
  font-size: .92rem;
  line-height: 1.8;
  color: #444;
}
.notes-editor {
  width: 100%;
  padding: 14px;
  background: var(--beige);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font-size: .9rem;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color var(--t);
}
.notes-editor:focus { background: var(--surface); border-color: var(--pink-dark); }

/* ============================================================
   AUTH PAGE (login/register)
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--bg);
}
.auth-hero {
  flex: 1;
  background: linear-gradient(145deg, var(--pink) 0%, var(--blue) 60%, var(--green) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  top: -80px; right: -80px;
}
.auth-hero::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
  bottom: -60px; left: -60px;
}
.auth-hero-content { position: relative; z-index: 1; }
.auth-hero-logo {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.auth-hero-tagline {
  font-size: 1rem;
  opacity: .8;
  margin-bottom: 36px;
  max-width: 300px;
}
.auth-hero-books {
  font-size: 4rem;
  opacity: .7;
  margin-bottom: 24px;
}
.auth-hero-features {
  text-align: left;
  display: inline-flex;
  flex-direction: column;
  gap: 12px;
}
.auth-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  opacity: .85;
}
.auth-feature-icon {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.3);
  border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.auth-panel {
  width: min(480px, 100%);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  overflow-y: auto;
}
.auth-panel-inner { max-width: 380px; margin: auto; width: 100%; }
.auth-tabs {
  display: flex;
  background: var(--beige);
  border-radius: var(--r-sm);
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  border-radius: var(--r-xs);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t);
  color: var(--text-muted);
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-light);
  font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: .8rem;
  color: var(--text-muted);
}
.auth-links a:hover { color: var(--text); text-decoration: underline; }
.auth-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  margin: auto;
  width: 100%;
}
.auth-title { font-family: var(--font-title); font-size: 1.5rem; margin-bottom: 24px; }
.form-msg .error   { color: #DC2626; font-size: .85rem; }
.form-msg .success { color: #059669; font-size: .85rem; }

/* ============================================================
   PROFILE
   ============================================================ */
.profile-hero {
  background: linear-gradient(135deg, var(--pink), var(--blue));
  border-radius: var(--r-xl);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}
.profile-avatar-lg {
  width: 88px; height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,.5);
  overflow: hidden;
}
.profile-hero-info h2 { font-size: 1.4rem; font-family: var(--font-title); }
.profile-hero-stats {
  display: flex;
  gap: 24px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.profile-hero-stat { font-size: .85rem; opacity: .85; }
.profile-hero-stat strong { font-weight: 700; display: block; font-size: 1.1rem; }

/* ============================================================
   HISTORY / ACTIVITY FEED
   ============================================================ */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--beige);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.activity-text { flex: 1; }
.activity-text strong { font-size: .88rem; font-weight: 600; }
.activity-text p { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.activity-time { font-size: .72rem; color: var(--text-light); margin-top: 3px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
}
.page-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
}
.page-btn:hover { border-color: var(--pink-dark); color: var(--text); }
.page-btn.active { background: var(--pink); border-color: var(--pink); color: #333; font-weight: 700; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: .5; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text); font-family: var(--font-title); }
.empty-state p  { font-size: .9rem; max-width: 300px; margin: 0 auto 20px; }

/* ============================================================
   SKELETON LOADER
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--beige) 50%, var(--border) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-xs);
}
.skeleton-book-card {
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.skeleton-cover { aspect-ratio: 2/3; }
.skeleton-text  { height: 14px; margin: 8px 12px 4px; }
.skeleton-text.short { width: 60%; }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2          { gap: 8px; }
.gap-3          { gap: 12px; }
.gap-4          { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .82rem; }
.text-xs     { font-size: .75rem; }
.font-medium { font-weight: 500; }
.font-bold   { font-weight: 700; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rounded-full { border-radius: var(--r-full); }
.w-full      { width: 100%; }
.hidden      { display: none !important; }
.sr-only     { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.fade-in     { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ============================================================
   RESPONSIVE — Tablet
   ============================================================ */
@media (max-width: 1024px) {
  .book-detail { grid-template-columns: 220px 1fr; gap: 24px; }
  .books-grid  { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

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

  .main-content { margin-left: 0; }
  .hamburger    { display: flex; }

  .page-content { padding: 16px; }

  .auth-hero    { display: none; }
  .auth-panel   { width: 100%; padding: 32px 24px; }

  .book-detail  { grid-template-columns: 1fr; }
  .book-detail-cover { position: static; max-width: 200px; margin: 0 auto; }

  .form-row     { grid-template-columns: 1fr; }

  .stats-grid   { grid-template-columns: repeat(2, 1fr); }

  .books-grid   { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }

  .top-header   { padding: 0 16px; gap: 10px; }
  .header-title { display: none; }

  .modal        { padding: 24px 20px; }
  .modal-overlay { align-items: flex-end; }
  .modal        { border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; }

  .profile-hero { flex-direction: column; text-align: center; padding: 24px; }
  .profile-hero-stats { justify-content: center; }

  .toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { max-width: none; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 199;
    display: none;
  }
  .sidebar-overlay.open { display: block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .books-grid { grid-template-columns: repeat(2, 1fr); }
  .catalog-controls { gap: 8px; }
  .filter-select { font-size: .8rem; padding: 8px 10px; }
}

/* ============================================================
   SCROLLBAR custom (WebKit)
   ============================================================ */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ============================================================
   FAB (Floating Action Button)
   ============================================================ */
.fab {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--pink);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: #333;
  transition: transform var(--t), box-shadow var(--t), background var(--t);
  z-index: 500;
}
.fab:hover { transform: scale(1.1) rotate(90deg); background: var(--pink-dark); box-shadow: var(--shadow-xl); }

/* ============================================================
   DIVIDERS, SEPARATORS
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}
