/* ================================================
   FOLIO — Dark Warm Library Design System
   ================================================ */

:root {
  --bg:           #0b0906;
  --surface:      #161109;
  --surface-2:    #1e1710;
  --surface-3:    #2a2016;
  --border:       #2e2519;
  --border-light: #3d3224;

  --gold:         #c9973e;
  --gold-light:   #e8bc6a;
  --gold-pale:    #f5dfa0;
  --gold-dim:     #7a5e28;

  --text:         #ede0cc;
  --text-mid:     #b5a48c;
  --text-muted:   #7a6b55;
  --text-faint:   #4a3f30;

  --green:        #5c9e6e;
  --green-dim:    #2a4d35;
  --amber:        #c08240;
  --amber-dim:    #4d3318;
  --red:          #a04040;
  --red-dim:      #3d1a1a;

  --radius:       10px;
  --radius-lg:    16px;
  --sidebar-w:    240px;
  --mobile-nav-h: 64px;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Lora', Georgia, serif;
  --font-ui:      'DM Sans', system-ui, sans-serif;

  --shadow:       0 4px 24px rgba(0,0,0,0.5);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --glow:         0 0 20px rgba(201,151,62,0.12);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  height: 100%;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }

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

/* ════════════════════════════════════════════
   AUTH SCREEN
════════════════════════════════════════════ */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-bg-decoration {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(201,151,62,0.08) 0%, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 60px,
      rgba(255,255,255,0.012) 60px,
      rgba(255,255,255,0.012) 61px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 60px,
      rgba(255,255,255,0.012) 60px,
      rgba(255,255,255,0.012) 61px
    );
  pointer-events: none;
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--glow);
  animation: fadeUp 0.6s ease;
}

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

.auth-logo-wrap {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-icon {
  font-size: 48px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 16px rgba(201,151,62,0.4));
}

.auth-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 600;
  color: var(--gold-pale);
  letter-spacing: 0.04em;
  line-height: 1;
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font-body);
  font-style: italic;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
  padding: 20px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.auth-feature {
  font-size: 13px;
  color: var(--text-mid);
  font-family: var(--font-ui);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.btn-google:hover {
  background: var(--surface-2);
  border-color: var(--gold-dim);
  box-shadow: 0 0 12px rgba(201,151,62,0.15);
}

.btn-google img { width: 20px; height: 20px; }

.auth-notice {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

/* ════════════════════════════════════════════
   APP SHELL LAYOUT
════════════════════════════════════════════ */
#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 22px;
}

.sidebar-brand span:first-child { font-size: 26px; }

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--gold-pale);
  letter-spacing: 0.04em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s;
  position: relative;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text-mid);
}

.nav-link.active {
  background: var(--surface-3);
  color: var(--gold-light);
  border: 1px solid var(--border-light);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-icon { display: flex; width: 18px; height: 18px; flex-shrink: 0; }
.nav-icon svg { width: 18px; height: 18px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main Area ── */
.main-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px 40px;
  min-width: 0;
}

/* ── View ── */
.view { animation: fadeIn 0.3s ease; }

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

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.view-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--gold-pale);
  line-height: 1.1;
}

.view-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s;
  white-space: nowrap;
  font-family: var(--font-ui);
}

.btn-primary {
  background: var(--gold);
  color: var(--bg);
  border: 1px solid transparent;
}

.btn-primary:hover {
  background: var(--gold-light);
  box-shadow: 0 0 16px rgba(201,151,62,0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--gold-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 9px 12px;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--red-dim);
  color: #e07070;
  border: 1px solid var(--red);
}

.btn-danger:hover { background: var(--red); color: white; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ── Filter Tabs ── */
.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all 0.18s;
}

.filter-tab:hover { color: var(--text); border-color: var(--border-light); }

.filter-tab.active {
  background: var(--surface-3);
  color: var(--gold-light);
  border-color: var(--gold-dim);
}

/* ════════════════════════════════════════════
   BOOKS GRID
════════════════════════════════════════════ */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
}

.book-card {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: fadeIn 0.3s ease;
}

.book-card:hover { transform: translateY(-4px); }
.book-card:hover .book-cover { box-shadow: 0 12px 32px rgba(0,0,0,0.6), var(--glow); }

.book-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

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

.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 700;
  color: var(--gold-dim);
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface-3) 100%);
}

.status-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.reading  { background: var(--amber-dim); color: var(--gold-light); border: 1px solid var(--amber); }
.status-badge.finished { background: var(--green-dim); color: #8ed4a0; border: 1px solid var(--green); }
.status-badge.want_to_read { background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border-light); }

.lent-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: var(--red-dim);
  color: #e07070;
  border: 1px solid var(--red);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.book-info { padding: 10px 2px 0; }
.book-info h4 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}

.book-info p { font-size: 11px; color: var(--text-muted); }
.owner-tag { font-size: 11px; color: var(--gold-dim); margin-top: 4px; display: block; }

.progress-mini {
  margin-top: 6px;
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}

.progress-mini-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.3s;
}

.progress-mini-text { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Empty / Loading States ── */
.empty-state, .loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state span { font-size: 48px; display: block; margin-bottom: 12px; filter: grayscale(0.3); }
.empty-state p { font-family: var(--font-body); font-style: italic; line-height: 1.6; }

/* ════════════════════════════════════════════
   COMMUNITIES
════════════════════════════════════════════ */
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.invites-section {
  margin-bottom: 32px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.invite-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.invite-card:last-child { border-bottom: none; }

.communities-list { display: flex; flex-direction: column; gap: 12px; }

.community-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.community-card:hover {
  background: var(--surface-2);
  border-color: var(--gold-dim);
  transform: translateX(4px);
}

.community-emoji { font-size: 32px; flex-shrink: 0; }

.community-info h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.community-info p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.community-info span { font-size: 12px; color: var(--gold-dim); margin-top: 4px; display: block; }

/* Community detail */
.community-hero {
  text-align: center;
  padding: 32px 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.community-hero-emoji { font-size: 56px; margin-bottom: 12px; }

.community-hero-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  color: var(--gold-pale);
}

.community-hero-desc { font-size: 14px; color: var(--text-muted); margin-top: 6px; font-style: italic; }

.community-members-row { margin-bottom: 28px; }

.members-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-mid);
}

.remove-btn {
  color: var(--red);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.2s;
}

.remove-btn:hover { color: #e07070; }

/* ════════════════════════════════════════════
   FEED
════════════════════════════════════════════ */
.feed-container {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
  animation: fadeIn 0.3s ease;
}

.activity-item:hover { border-color: var(--border-light); }

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.activity-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.activity-cover {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.activity-content > div { flex: 1; min-width: 0; }
.activity-content strong { color: var(--text); font-weight: 600; }
.activity-content p { color: var(--text-mid); font-size: 14px; line-height: 1.5; }

.activity-time {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ════════════════════════════════════════════
   PROFILE
════════════════════════════════════════════ */
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold-dim);
  box-shadow: 0 0 20px rgba(201,151,62,0.2);
  flex-shrink: 0;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--gold-pale);
}

.profile-email-display { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.profile-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.stat-card {
  flex: 1;
  min-width: 100px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.stat-card.clickable { cursor: pointer; transition: all 0.2s; }
.stat-card.clickable:hover { border-color: var(--gold-dim); background: var(--surface-2); }

.stat-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--gold-pale);
  line-height: 1;
}

.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

.user-search-section { margin-top: 16px; }

.user-search-section .input { margin-bottom: 12px; }

.user-search-results { display: flex; flex-direction: column; gap: 8px; max-width: 480px; }

.user-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.18s;
}

.user-result:hover { border-color: var(--gold-dim); background: var(--surface-2); }

.user-mini-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
  background: var(--surface-3);
}

.user-result > div { flex: 1; }
.user-result strong { font-size: 14px; color: var(--text); }
.user-result p { font-size: 12px; color: var(--text-muted); }

/* ════════════════════════════════════════════
   FORMS & INPUTS
════════════════════════════════════════════ */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-ui);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}

.input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201,151,62,0.1);
}

.input::placeholder { color: var(--text-faint); }

.input.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6b55' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

select option { background: var(--surface-3); color: var(--text); }

.textarea { resize: vertical; min-height: 80px; }
.input-sm { max-width: 80px; text-align: center; font-size: 20px; }

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group { margin-bottom: 16px; }

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

.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-faint);
  margin: 16px 0;
}

.form-divider::before, .form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Cover Upload */
.cover-upload-area {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-upload-area:hover { border-color: var(--gold-dim); }

#cover-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

#cover-upload-placeholder span:first-child { font-size: 24px; }

.cover-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
}

/* ════════════════════════════════════════════
   SEARCH RESULTS (Book Search)
════════════════════════════════════════════ */
.search-results {
  margin-top: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--surface-3); }

.search-result img {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--surface-3);
}

.search-result strong { font-size: 13px; color: var(--text); display: block; }
.search-result p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.no-results { padding: 12px 14px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* ════════════════════════════════════════════
   MODALS
════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow), var(--glow);
  animation: slideUp 0.3s ease;
}

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

.modal-wide  { max-width: 820px; }
.modal-sm    { max-width: 400px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--gold-pale);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 16px;
  transition: all 0.18s;
}

.modal-close:hover { background: var(--surface-3); color: var(--text); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
}

.modal-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Book Detail Modal ── */
.book-detail-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
}

.detail-cover-wrap { position: relative; }

.detail-cover {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.detail-cover-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 64px;
  color: var(--gold-dim);
}

.detail-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold-pale);
  line-height: 1.2;
  margin-bottom: 6px;
}

.detail-author { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; font-style: italic; }

.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 20px;
}

.lending-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.lending-section p { font-size: 13px; color: var(--text-mid); margin-bottom: 10px; }

.progress-row { margin-bottom: 8px; }

.progress-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 100%);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-percent { font-size: 13px; color: var(--gold); font-weight: 600; width: 36px; text-align: right; }

/* ════════════════════════════════════════════
   TOAST
════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 12px 24px;
  border-radius: 40px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════
   MOBILE NAV
════════════════════════════════════════════ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 50;
  padding: 0 8px;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 100%;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.18s;
  padding: 8px 4px;
}

.mobile-nav-item svg { width: 22px; height: 22px; }
.mobile-nav-item.active { color: var(--gold); }

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 900px) {
  .main-area { padding: 20px 16px 90px; }
  .sidebar { display: none; }
  .mobile-nav { display: flex; }

  .book-detail-body {
    grid-template-columns: 1fr;
  }

  .detail-cover {
    max-width: 180px;
    margin: 0 auto;
  }
  .detail-cover-placeholder { max-width: 180px; margin: 0 auto; }

  .stats-row { gap: 8px; }
  .stat-card { min-width: 80px; padding: 12px 8px; }
  .stat-num { font-size: 22px; }

  .form-row { grid-template-columns: 1fr; }
  .view-title { font-size: 26px; }
}

@media (max-width: 520px) {
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
  .auth-container { padding: 32px 24px; }
  .modal-body, .modal-header, .modal-footer { padding-left: 16px; padding-right: 16px; }
}
