/* ============================================
   BookPlatform - Dashboard Page
   Stats grid, book cards, progress bars
   ============================================ */

/* ---------- Dashboard wrapper ---------- */
.dashboard {
  min-height: 100vh;
  background-color: #0a0a0f;
  font-family: 'Noto Sans KR', sans-serif;
  color: #e0e0e0;
  padding: 2rem;
}

.dashboard h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: #ffffff;
}

.dashboard h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2.5rem 0 1.25rem;
  color: #e0e0e0;
}

/* ---------- Stats grid (4 columns) ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.stat-card {
  background-color: #12121a;
  border: 1px solid #2a2a3a;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.stat-card:hover {
  border-color: #6c5ce7;
  transform: translateY(-2px);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.stat-label {
  display: block;
  font-size: 0.8125rem;
  color: #888;
  font-weight: 400;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #a855f7;
  flex-shrink: 0;
}

/* ---------- Books grid ---------- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ---------- Book card ---------- */
.book-card {
  background-color: #12121a;
  border: 1px solid #2a2a3a;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.book-card:hover {
  border-color: #6c5ce7;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.15);
  transform: translateY(-2px);
}

/* Cover placeholder */
.book-cover {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2a2a3a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #444;
  position: relative;
}

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

/* Book info */
.book-info {
  padding: 1.25rem;
}

.book-info h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #e0e0e0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Status badges */
.book-status {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.book-status.draft {
  background-color: rgba(136, 136, 136, 0.15);
  color: #888;
}

.book-status.in-progress {
  background-color: rgba(108, 92, 231, 0.15);
  color: #6c5ce7;
}

.book-status.completed {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.book-status.published {
  background-color: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

/* Book meta */
.book-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: #888;
}

.book-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Book actions */
.book-actions {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #2a2a3a;
}

.book-actions button {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  border: none;
}

.book-actions button.primary {
  background: linear-gradient(135deg, #6c5ce7 0%, #a855f7 100%);
  color: #ffffff;
}

.book-actions button.primary:hover {
  opacity: 0.9;
}

.book-actions button.secondary {
  background-color: #1a1a2e;
  border: 1px solid #2a2a3a;
  color: #e0e0e0;
}

.book-actions button.secondary:hover {
  background-color: #2a2a3a;
}

/* ---------- Empty state ---------- */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background-color: #12121a;
  border: 2px dashed #2a2a3a;
  border-radius: 16px;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #444;
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  color: #e0e0e0;
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: #888;
  max-width: 360px;
}

.empty-state button {
  padding: 0.7rem 1.5rem;
  background: linear-gradient(135deg, #6c5ce7 0%, #a855f7 100%);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.empty-state button:hover {
  opacity: 0.9;
}

/* ---------- Progress bar ---------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background-color: #1a1a2e;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #6c5ce7 0%, #a855f7 100%);
  transition: width 0.4s ease;
}

/* ---------- Example book carousel ---------- */
.example-carousel {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.example-carousel::-webkit-scrollbar {
    display: none;
}

.example-carousel .example-book-card {
    flex: 0 0 200px;
    scroll-snap-align: start;
    padding: 18px;
    cursor: pointer;
    border-color: #2a2a3a;
    display: flex;
    flex-direction: column;
    min-height: 160px;
}

@media (max-width: 640px) {
    .example-carousel .example-book-card {
        flex: 0 0 170px;
        min-height: 140px;
        padding: 14px;
    }
}

/* ---------- Dashboard hover effects ---------- */

/* 통계 카드 호버 */
.dash-stat-card {
    transition: all 0.25s ease !important;
    position: relative;
}
.dash-stat-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(108,92,231,0.2) !important;
    border-color: #6c5ce7 !important;
}
.dash-stat-card:active {
    transform: translateY(-1px) !important;
}

/* 내 책 카드 호버 - JS 인라인 제거 후 CSS로 대체 */
.card[style*="flex-direction:column"] {
    transition: all 0.25s ease;
}
.card[style*="flex-direction:column"]:hover {
    border-color: #6c5ce7 !important;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(108,92,231,0.18);
}

/* 예시 책 카드 호버 */
.example-book-card {
    transition: all 0.25s ease !important;
    position: relative;
    overflow: hidden;
}
.example-book-card::before {
    content: '클릭하여 시작';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px;
    background: linear-gradient(135deg, #6c5ce7, #a855f7);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.25s ease;
}
.example-book-card:hover {
    border-color: #6c5ce7 !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 20px rgba(108,92,231,0.2);
}
.example-book-card:hover::before {
    transform: translateY(0);
}

/* 단계 바로가기 버튼 호버 */
.btn-step {
    transition: all 0.2s ease !important;
}
.btn-step:hover {
    background: rgba(108,92,231,0.15) !important;
    color: #a855f7 !important;
    transform: translateY(-1px);
}

/* 계속하기 버튼 호버 */
.btn-continue {
    transition: all 0.2s ease !important;
}
.btn-continue:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108,92,231,0.3);
}

/* 모달 참조 도서 아이템 호버 */
.modal-ref-item {
    transition: background 0.15s ease;
}
.modal-ref-item:hover {
    background: rgba(108,92,231,0.08) !important;
}

/* ---------- Dashboard wrapper ---------- */
.dash-wrapper {
  width: 75%;
  margin-left: auto;
  margin-right: auto;
  padding: 24px 32px;
}

/* ---------- Modal scrollbar ---------- */
#modalSearchResults::-webkit-scrollbar {
  width: 5px;
}
#modalSearchResults::-webkit-scrollbar-track {
  background: transparent;
}
#modalSearchResults::-webkit-scrollbar-thumb {
  background: #2a2a3a;
  border-radius: 3px;
}
#modalSearchResults::-webkit-scrollbar-thumb:hover {
  background: #6c5ce7;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-wrapper {
    width: 90%;
    padding: 20px 16px;
  }
}

@media (max-width: 640px) {
  .dashboard {
    padding: 1.25rem;
  }

  .dash-wrapper {
    width: 100%;
    padding: 16px 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .books-grid {
    grid-template-columns: 1fr;
  }
}
