/* ─────────────────────────────────────────────────────────────────────────── */
/*  eStanteVirtual — CSS                                                        */
/* ─────────────────────────────────────────────────────────────────────────── */

:root {
  --bg-base:       #0d0d0f;
  --bg-surface:    #16161a;
  --bg-card:       #1e1e24;
  --bg-card-hover: #252530;
  --bg-modal:      #1a1a21;

  --amber-100: #fef3c7;
  --amber-300: #fcd34d;
  --amber-400: #f59e0b;
  --amber-500: #d97706;
  --amber-600: #b45309;

  --text-primary:   #f0ebe3;
  --text-secondary: #9d9aaa;
  --text-muted:     #5e5b73;

  --border:       rgba(255,255,255,0.08);
  --border-glow:  rgba(245, 158, 11, 0.35);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-modal: 0 24px 80px rgba(0,0,0,0.7);

  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;

  --status-lendo:      #3b82f6;
  --status-lido:       #22c55e;
  --status-quero_ler:  #f59e0b;
  --status-relendo:    #a78bfa;
  --status-abandonado: #ef4444;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }

/* ── Links ── */
a { color: inherit; text-decoration: none; }

/* ══════════════════════════════════════════════════════════════════ NAVBAR */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: rgba(13,13,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
}

.brand-icon { font-size: 1.5rem; }

.brand-text {
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}
.brand-text strong {
  font-weight: 700;
  color: var(--amber-400);
}

/* ══════════════════════════════════════════════════════════════════ BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--amber-500);
  color: #000;
  border-color: var(--amber-500);
}
.btn-primary:hover {
  background: var(--amber-400);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245,158,11,0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: #ef4444;
  border-color: rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.22); }

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

.btn-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition);
}
.btn-link:hover { color: var(--text-primary); }
.btn-link.danger:hover { color: #ef4444; }

/* ══════════════════════════════════════════════════════════════════ MAIN */
.main-content { max-width: 1400px; margin: 0 auto; padding: 2rem; }

/* ══════════════════════════════════════════════════════════════════ SHELF HEADER */
.shelf-header {
  margin-bottom: 2.5rem;
}

.shelf-title-wrap { margin-bottom: 1.5rem; }

.shelf-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f0ebe3, var(--amber-300));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shelf-subtitle {
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  color: var(--text-secondary);
}

.stat-chip:hover {
  border-color: var(--border-glow);
  color: var(--text-primary);
}

.stat-chip.active {
  background: var(--amber-500);
  border-color: var(--amber-500);
  color: #000;
  font-weight: 600;
}

.stat-chip.active .stat-count { color: #000; }
.stat-count { font-weight: 700; color: var(--text-primary); min-width: 16px; text-align: center; }

/* ── Search ── */
.shelf-search {
  display: flex;
  gap: 8px;
  max-width: 420px;
}

.shelf-search-input {
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════════ BOOK GRID */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 1.5rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform var(--transition);
}
.book-card:hover { transform: translateY(-6px); }
.book-card:hover .book-cover-wrap { box-shadow: 0 20px 50px rgba(0,0,0,0.7); }

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-slow);
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(145deg, var(--bg-card), var(--bg-card-hover));
  color: var(--text-muted);
}

.book-status-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: rgba(13,13,15,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
}

.card-delete-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(239,68,68,0.4);
  background: rgba(13,13,15,0.85);
  backdrop-filter: blur(8px);
  color: #ef4444;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
  z-index: 2;
}

.book-card:hover .card-delete-btn {
  opacity: 1;
  transform: scale(1);
}

.card-delete-btn:hover {
  background: rgba(239,68,68,0.25) !important;
  border-color: rgba(239,68,68,0.7);
}

.book-info { padding: 0 2px; }

.book-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-rating-mini {
  display: flex;
  gap: 1px;
  margin-top: 4px;
}
.book-rating-mini .star { font-size: 11px; color: var(--text-muted); }
.book-rating-mini .star.filled { color: var(--amber-400); }

/* ══════════════════════════════════════════════════════════════════ EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 6rem 2rem;
}
.empty-icon { font-size: 5rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h2 { font-size: 1.5rem; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); margin-bottom: 2rem; }

/* ══════════════════════════════════════════════════════════════════ FORMS */
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus { border-color: var(--amber-500); }
.form-input::placeholder { color: var(--text-muted); }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

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

textarea.form-input { resize: vertical; }

/* ══════════════════════════════════════════════════════════════════ MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  animation: slideUp 0.25s ease;
}

.modal-sm { max-width: 440px; }

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 50%;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ── Search Box in Modal ── */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.search-results { display: flex; flex-direction: column; gap: 12px; }

.search-result-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}
.search-result-card:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.result-cover {
  width: 56px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.result-cover-placeholder {
  width: 56px;
  height: 80px;
  background: var(--bg-surface);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.result-info { flex: 1; min-width: 0; }
.result-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  line-height: 1.3;
}
.result-author { color: var(--text-secondary); font-size: 13px; margin-bottom: 6px; }
.result-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.result-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-add-btn {
  align-self: center;
  flex-shrink: 0;
}

.search-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════════ DETAIL PAGE */
.detail-page { max-width: 860px; }

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 2rem;
  transition: color var(--transition);
}
.back-link:hover { color: var(--amber-400); }

.detail-hero {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 640px) {
  .detail-hero { grid-template-columns: 1fr; }
}

.detail-cover-wrap {
  position: sticky;
  top: 80px;
  align-self: start;
}

/* ── Cover Upload ── */
.cover-upload-area {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: block;
}

.cover-upload-area .detail-cover,
.cover-upload-area .detail-cover-placeholder {
  display: block;
  width: 100%;
  transition: filter 0.2s ease;
}

.cover-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: var(--radius-md);
}

.cover-upload-area:hover .cover-upload-overlay { opacity: 1; }
.cover-upload-area:hover .detail-cover { filter: brightness(0.6); }

.cover-upload-icon { font-size: 2rem; }
.cover-upload-label {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Uploading state */
.cover-upload-area.uploading .cover-upload-overlay { opacity: 1; }
.cover-upload-area.uploading .cover-upload-icon {
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.detail-cover {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 16px 60px rgba(0,0,0,0.7);
  display: block;
}

.detail-cover-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.status-lendo    { background: rgba(59,130,246,0.15); color: var(--status-lendo); border: 1px solid rgba(59,130,246,0.3); }
.status-badge.status-lido     { background: rgba(34,197,94,0.15);  color: var(--status-lido);  border: 1px solid rgba(34,197,94,0.3); }
.status-badge.status-quero_ler{ background: rgba(245,158,11,0.15); color: var(--amber-400);    border: 1px solid rgba(245,158,11,0.3); }
.status-badge.status-relendo  { background: rgba(167,139,250,0.15);color: var(--status-relendo);border: 1px solid rgba(167,139,250,0.3); }
.status-badge.status-abandonado{background: rgba(239,68,68,0.15);  color: var(--status-abandonado);border: 1px solid rgba(239,68,68,0.3); }

.lang-badge { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); }

.detail-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.9rem;
  line-height: 1.3;
  margin-bottom: 6px;
}

.detail-authors { color: var(--text-secondary); margin-bottom: 1.25rem; font-size: 1rem; }

.detail-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 1.25rem;
}

.detail-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-secondary);
}

.stat-icon-sm { opacity: 0.7; }

/* ── Rating ── */
.rating-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.rating-label { font-size: 13px; color: var(--text-secondary); }

.star-rating { display: flex; gap: 2px; }

.star {
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), transform var(--transition);
}
.star:hover, .star.hovered, .star.filled { color: var(--amber-400); }
.star:hover { transform: scale(1.2); }

.rating-value { font-size: 13px; color: var(--text-secondary); }

/* ── Status Buttons ── */
.status-actions { margin-bottom: 0; }

.status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.status-btn {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.status-btn:hover {
  border-color: var(--border-glow);
  color: var(--text-primary);
}
.status-btn.active {
  background: var(--amber-500);
  border-color: var(--amber-500);
  color: #000;
}

/* ── Tabs ── */
.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--amber-400); border-bottom-color: var(--amber-400); }

.tab-content { animation: fadeIn 0.2s ease; }

.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.tab-header h3 { font-size: 1rem; font-weight: 600; }

/* ── Sessions ── */
.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 10px;
  animation: fadeIn 0.2s ease;
}

.session-dates {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.session-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-date .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.session-date .value { font-weight: 600; font-size: 15px; }

.session-arrow { color: var(--text-muted); font-size: 1.2rem; }

.session-duration {
  margin-left: auto;
  background: rgba(245,158,11,0.1);
  color: var(--amber-400);
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}

.session-notes {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-style: italic;
}

.session-actions { display: flex; gap: 8px; }

.empty-sessions { text-align: center; padding: 2.5rem; color: var(--text-muted); font-size: 14px; }

/* ── Notes ── */
.notes-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}
.notes-textarea:focus { border-color: var(--amber-500); }
.notes-textarea::placeholder { color: var(--text-muted); }

/* ── Description ── */
.description-text {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 14px;
  margin-bottom: 1.25rem;
}

.categories-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.5rem; }

.category-chip {
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Danger Zone ── */
.danger-zone {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════════ TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-modal);
  max-width: 320px;
  animation: slideUp 0.3s ease;
}
.toast.success { border-color: rgba(34,197,94,0.4); color: #22c55e; }
.toast.error   { border-color: rgba(239,68,68,0.4);  color: #ef4444; }

/* ══════════════════════════════════════════════════════════════════ RESPONSIVE */
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .navbar { padding: 0 1rem; }
  .shelf-title { font-size: 1.8rem; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem; }
  .detail-title { font-size: 1.5rem; }
}

/* ══════════════════════════════════════════════════════════════════ MANUAL ENTRY */
.manual-entry-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.manual-entry-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.manual-entry-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row { display: flex; flex-direction: column; }

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.required { color: var(--amber-400); }

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}
