/* ==========================================================================
   2026 인문학 베스트셀러 큐레이션 웹 대시보드 스타일시트 (style.css)
   ========================================================================== */

:root {
  /* 라이트 테마 변수 */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-tag: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --brand-primary: #3b82f6;
  --brand-primary-hover: #2563eb;
  --brand-gold: #f59e0b;
  --brand-gold-subtle: #fef3c7;
  --brand-teal: #0d9488;
  
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  
  --badge-kyobo: #1e3a8a;
  --badge-yes24: #b91c1c;
  
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Noto Serif KR', 'Batang', serif;
  --font-brand: 'Outfit', 'Pretendard', sans-serif;
}

body.dark-theme {
  /* 다크 테마 변수 */
  --bg-main: #0b0f19;
  --bg-card: #151d2f;
  --bg-card-hover: #1e293b;
  --bg-subtle: #1e293b;
  --bg-tag: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --brand-primary: #60a5fa;
  --brand-primary-hover: #3b82f6;
  --brand-gold: #fbbf24;
  --brand-gold-subtle: #3b2803;
  --brand-teal: #14b8a6;
  
  --border-color: #27354f;
  --border-focus: #60a5fa;
  
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  
  --badge-kyobo: #3b82f6;
  --badge-yes24: #f87171;
}

/* ==========================================================================
   기본 리셋 & 레이아웃
   ========================================================================== */

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ==========================================================================
   상단 네비게이션
   ========================================================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  padding: 14px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2rem;
  line-height: 1;
}

.brand-title {
  font-family: var(--font-brand);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-year {
  font-size: 0.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background-color: var(--bg-subtle);
}

.btn-theme {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-theme:hover {
  background: var(--bg-subtle);
}

/* ==========================================================================
   히어로 & 트렌드 섹션
   ========================================================================== */

.hero-section {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px 28px;
  margin-bottom: 32px;
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-primary);
  background: rgba(59, 130, 246, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 820px;
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--card-shadow);
}

.stat-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-brand);
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* 2026 3대 트렌드 */
.trends-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
}

.trends-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.trends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.trend-card {
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 14px;
  border-left: 4px solid var(--brand-primary);
}

.trend-card:nth-child(2) {
  border-left-color: var(--brand-teal);
}

.trend-card:nth-child(3) {
  border-left-color: var(--brand-gold);
}

.trend-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.trend-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.trend-books {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.trend-books strong {
  color: var(--text-secondary);
}

/* ==========================================================================
   검색 & 필터 섹션
   ========================================================================== */

.filter-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 28px;
  box-shadow: var(--card-shadow);
}

.search-bar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.search-bar-wrap input {
  width: 100%;
  padding: 12px 42px 12px 42px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}

.search-bar-wrap input:focus {
  border-color: var(--border-focus);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}

.filter-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.pill:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.pill.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.secondary-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.pill-group-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-mini {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.pill-mini:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.pill-mini.active {
  background: var(--text-primary);
  color: var(--bg-card);
  border-color: var(--text-primary);
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.sort-wrap select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.filter-status {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-text {
  background: none;
  border: none;
  color: var(--brand-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   도서 카드 그리드
   ========================================================================== */

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

.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--card-shadow);
  position: relative;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: rgba(59, 130, 246, 0.4);
}

/* 랭킹 뱃지 */
.rank-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.rank-badge.rank-1 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #ffffff;
}

.rank-badge.rank-3 {
  background: linear-gradient(135deg, #b45309, #78350f);
  color: #ffffff;
}

/* 카드 상단 영역 (표지 + 기본 메타) */
.card-header-flex {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border-color);
}

.cover-wrap {
  width: 95px;
  min-width: 95px;
  height: 135px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  background: var(--bg-tag);
  flex-shrink: 0;
}

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

.meta-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.category-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--brand-primary);
  margin-bottom: 4px;
}

.book-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 4px;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.stars {
  color: var(--brand-gold);
  font-weight: 700;
}

.review-count {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* 서점 뱃지 */
.bookstore-badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.badge-store {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.badge-store.kyobo {
  color: var(--badge-kyobo);
}

.badge-store.yes24 {
  color: var(--badge-yes24);
}

/* 카드 본문 (한줄 요약 및 태그) */
.card-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.quote-box {
  position: relative;
  background: var(--bg-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 12px;
  flex: 1;
}

.quote-box::before {
  content: '“';
  font-family: var(--font-brand);
  font-size: 1.6rem;
  color: var(--brand-primary);
  position: absolute;
  top: -2px;
  left: 6px;
  opacity: 0.4;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
}

.tag-item {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-tag);
  padding: 2px 6px;
  border-radius: 4px;
}

/* 카드 하단 액션 */
.card-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.btn-synopsis {
  flex: 1;
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-synopsis:hover {
  background: var(--brand-primary-hover);
}

.btn-icon-action {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.btn-icon-action:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--bg-subtle);
}

.btn-icon-action.bookmarked {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fee2e2;
}

/* ==========================================================================
   상세 모달 (3단 줄거리 & 심층분석)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-card);
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  border-radius: 18px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.2s ease-out;
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--bg-subtle);
  transform: rotate(90deg);
}

.modal-body {
  overflow-y: auto;
  padding: 28px 24px 32px;
}

/* 모달 상단 도서 정보 */
.modal-book-header {
  display: flex;
  gap: 20px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-cover {
  width: 115px;
  height: 165px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

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

.modal-info {
  flex: 1;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.modal-meta-grid {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 12px;
  margin-bottom: 12px;
}

.modal-meta-grid strong {
  color: var(--text-secondary);
}

.modal-store-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.btn-store {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-store.kyobo {
  background: rgba(30, 58, 138, 0.1);
  color: #1e3a8a;
}

.btn-store.yes24 {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

/* 모달 탭 메뉴 */
.modal-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
}

.modal-tab-btn {
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* 탭 컨텐츠 영역 */
.tab-pane {
  display: none;
  line-height: 1.7;
}

.tab-pane.active {
  display: block;
}

/* 3단 줄거리 섹션 */
.synopsis-block {
  margin-bottom: 18px;
  background: var(--bg-subtle);
  border-radius: 12px;
  padding: 16px;
}

.synopsis-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin-bottom: 8px;
}

.synopsis-text {
  font-size: 0.92rem;
  color: var(--text-primary);
}

/* 인사이트 섹션 */
.insight-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(13, 148, 136, 0.08) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  padding: 18px;
}

.insight-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.insight-text {
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.75;
}

/* 명문장 리스트 */
.quotes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.quote-item {
  background: var(--bg-subtle);
  border-left: 3px solid var(--brand-gold);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.publisher-box {
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 16px;
}

.publisher-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.publisher-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* TTS 듣기 바 */
.tts-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.tts-info {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.btn-tts {
  background: var(--text-primary);
  color: var(--bg-card);
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   저장한 책 드로어 & 토스트
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  background: var(--bg-card);
  width: 100%;
  max-width: 380px;
  height: 100%;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  padding: 20px;
  animation: slideLeft 0.2s ease-out;
}

@keyframes slideLeft {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.drawer-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bookmark-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--bg-subtle);
  border-radius: 8px;
  align-items: center;
}

.bookmark-thumb {
  width: 45px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.bookmark-info {
  flex: 1;
}

.bookmark-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.bookmark-author {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-remove-bm {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.9rem;
}

/* 토스트 메시지 */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: toastIn 0.2s ease-out;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: 16px;
  margin-top: 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* 유틸리티 */
.hidden {
  display: none !important;
}

/* 푸터 */
.footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 28px 20px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-copy strong {
  color: var(--text-primary);
}

.footer-note {
  margin-top: 4px;
}

/* ==========================================================================
   인쇄 / PDF 전용 스타일
   ========================================================================== */

@media print {
  .navbar, .filter-section, .hero-badge, .btn, .card-actions, .trends-container, .footer {
    display: none !important;
  }
  
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  
  .hero-section {
    border: none;
    background: none;
    padding: 0;
    margin-bottom: 20px;
  }
  
  .books-grid {
    display: block;
  }
  
  .book-card {
    page-break-inside: avoid;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* ==========================================================================
   모바일 전용 컴포넌트 & QR 모달 & 플로팅 버튼 스타일
   ========================================================================== */

/* 상단 모바일 QR 버튼 */
.btn-mobile-qr {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
  color: var(--brand-primary);
  font-weight: 700;
}

.btn-mobile-qr:hover {
  background: var(--brand-primary);
  color: #ffffff;
}

/* 드래그 핸들 (모바일 바텀 시트) */
.modal-drag-handle {
  display: none;
  width: 44px;
  height: 5px;
  background: var(--border-color);
  border-radius: 999px;
  margin: 10px auto 4px;
  cursor: grab;
}

/* QR 코드 모달 전용 스타일 */
.modal-dialog-qr {
  max-width: 460px;
  text-align: center;
  border-radius: 20px;
}

.qr-modal-body {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-icon-badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 12px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.qr-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.qr-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-width: 320px;
}

.qr-code-wrapper {
  background: #ffffff;
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  min-height: 210px;
}

.qr-canvas-box {
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-canvas-box canvas, .qr-canvas-box svg {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.qr-url-box {
  width: 100%;
  margin-bottom: 16px;
  text-align: left;
}

.qr-url-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.qr-url-display {
  display: flex;
  gap: 8px;
}

.qr-url-display input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: monospace;
  font-weight: 600;
  outline: none;
}

.btn-copy {
  padding: 10px 16px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.qr-tip-box {
  width: 100%;
  background: var(--bg-subtle);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.qr-tip-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 6px;
}

.qr-tip-list {
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding-left: 16px;
  line-height: 1.6;
}

.qr-tip-list li {
  margin-bottom: 2px;
}

.qr-tip-list code {
  background: var(--bg-tag);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* 맨 위로 스크롤 플로팅 버튼 */
.btn-scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  transform: translateY(0);
}

.btn-scroll-top:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
}

/* 모바일 전용 하단 바텀 네비게이션 바 (기본 숨김) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 6px 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:active {
  transform: scale(0.92);
}

.bottom-nav-item.active {
  color: var(--brand-primary);
}

.bnav-icon {
  font-size: 1.3rem;
  line-height: 1.1;
  position: relative;
}

.bnav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bnav-badge-wrap {
  position: relative;
  display: inline-block;
}

.bnav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   완벽한 반응형 미디어 쿼리 (태블릿 & 스마트폰)
   ========================================================================== */

/* 태블릿 (1024px 이하) */
@media (max-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
  }
}

/* 스마트폰 & 소형 태블릿 (768px 이하) */
@media (max-width: 768px) {
  /* 바텀 네비바 공간 확보 */
  .main-container {
    padding: 16px 14px 90px;
  }

  /* 상단 네비바 컴팩트화 */
  .navbar {
    padding: 10px 0;
  }

  .nav-container {
    padding: 0 14px;
    gap: 8px;
  }

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

  .brand-title {
    font-size: 1.05rem;
  }

  .brand-subtitle {
    display: none; /* 모바일에서 서브타이틀 숨김으로 공간 확보 */
  }

  .badge-year {
    font-size: 0.58rem;
    padding: 1px 5px;
  }

  /* PC 전용 텍스트 숨기고 아이콘 중심 헤더 버튼 */
  .nav-btn-text {
    display: none;
  }

  .nav-actions {
    gap: 6px;
  }

  .btn {
    padding: 7px 10px;
    font-size: 0.8rem;
  }

  #btnPrintReport, #btnExportCsv {
    display: none; /* 모바일 바텀바 또는 서브메뉴에서 처리 */
  }

  /* 히어로 섹션 모바일 최적화 */
  .hero-section {
    padding: 20px 16px;
    border-radius: 14px;
    margin-bottom: 20px;
  }

  .hero-title {
    font-size: 1.35rem;
    line-height: 1.35;
  }

  .hero-desc {
    font-size: 0.88rem;
    margin-bottom: 18px;
  }

  /* 지표 통계 카드 2열 그리드 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }

  .stat-card {
    padding: 12px;
    gap: 10px;
    border-radius: 10px;
  }

  .stat-icon {
    font-size: 1.4rem;
  }

  .stat-value {
    font-size: 1.15rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  /* 트렌드 인사이트 모바일 */
  .trends-container {
    padding: 14px;
    border-radius: 10px;
  }

  .trends-heading {
    font-size: 0.95rem;
    margin-bottom: 10px;
  }

  .trends-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .trend-card {
    padding: 12px;
  }

  /* 검색 및 필터 모바일 최적화 (터치 스와이프) */
  .filter-section {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 20px;
  }

  .search-bar-wrap {
    margin-bottom: 12px;
  }

  .search-bar-wrap input {
    padding: 10px 38px 10px 38px;
    font-size: 0.9rem;
  }

  /* 카테고리 필터 좌우 부드러운 스와이프 터치 스크롤 */
  .pill-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none; /* Firefox */
  }

  .pill-group::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
  }

  .pill {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .secondary-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 10px;
  }

  .pill-group-mini {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .pill-group-mini::-webkit-scrollbar {
    display: none;
  }

  .pill-mini {
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .sort-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .sort-wrap select {
    flex: 1;
    max-width: 220px;
  }

  /* 도서 카드 모바일 1열 뷰 */
  .books-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .book-card {
    border-radius: 12px;
  }

  .card-header-flex {
    padding: 14px;
    gap: 12px;
  }

  .cover-wrap {
    width: 80px;
    min-width: 80px;
    height: 116px;
    border-radius: 6px;
  }

  .book-title {
    font-size: 0.98rem;
    margin-bottom: 3px;
  }

  .book-author {
    font-size: 0.78rem;
    margin-bottom: 4px;
  }

  .rating-row {
    font-size: 0.76rem;
  }

  .badge-store {
    font-size: 0.65rem;
    padding: 1px 5px;
  }

  .card-content {
    padding: 14px;
  }

  .quote-box {
    padding: 10px 12px;
    font-size: 0.82rem;
    margin-bottom: 10px;
  }

  .card-actions {
    gap: 6px;
    padding-top: 10px;
  }

  .btn-synopsis {
    padding: 9px;
    font-size: 0.82rem;
    min-height: 42px;
  }

  .btn-icon-action {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
  }

  /* 상세 모달 ➔ 모바일 바텀 시트(Bottom Sheet) 모달 */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-dialog {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
    animation: bottomSheetSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes bottomSheetSlideUp {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .modal-drag-handle {
    display: block;
  }

  .modal-close {
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .modal-body {
    padding: 18px 16px 36px;
  }

  .modal-book-header {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
    gap: 14px;
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  .modal-cover {
    width: 85px;
    height: 122px;
  }

  .modal-title {
    font-size: 1.15rem;
  }

  .modal-subtitle {
    font-size: 0.8rem;
  }

  .modal-meta-grid {
    grid-template-columns: 1fr;
    font-size: 0.78rem;
    gap: 3px;
  }

  .modal-store-links {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .btn-store {
    justify-content: center;
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .modal-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 16px;
  }

  .modal-tabs::-webkit-scrollbar {
    display: none;
  }

  .modal-tab-btn {
    padding: 8px 12px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  .tts-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .btn-tts {
    justify-content: center;
    padding: 8px;
  }

  .synopsis-block, .insight-box, .publisher-box {
    padding: 14px;
    border-radius: 10px;
  }

  .synopsis-text, .insight-text {
    font-size: 0.88rem;
  }

  .quote-item {
    font-size: 0.84rem;
    padding: 10px 12px;
  }

  /* 북마크 드로어 모바일 */
  .drawer-panel {
    max-width: 100%;
    padding: 16px 16px 80px;
  }

  /* 모바일 바텀 네비바 표시 */
  .mobile-bottom-nav {
    display: flex;
  }

  /* 플로팅 스크롤 탑 버튼 위치 조정 */
  .btn-scroll-top {
    bottom: 74px;
    right: 16px;
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  .toast-container {
    bottom: 76px;
    right: 16px;
    left: 16px;
  }

  .toast {
    font-size: 0.8rem;
    text-align: center;
  }

  .footer {
    padding-bottom: 80px;
  }
}

/* 초소형 스마트폰 (380px 이하) */
@media (max-width: 380px) {
  .hero-title {
    font-size: 1.2rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .modal-book-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .modal-cover {
    width: 100px;
    height: 145px;
  }
}
