:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-elevated: #243447;
  --primary: #c9a227;
  --primary-hover: #dbb83d;
  --text-primary: #f5f5f0;
  --text-secondary: #a8b4c4;
  --accent: #2d5a7b;
  --accent-light: #3d7a9b;
  --border: #2a3a4d;
  --font-heading: 'Georgia', serif;
  --font-body: 'Georgia', serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.8;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at top, rgba(45, 90, 123, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
  border: none;
  outline: none;
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 20, 25, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: normal;
  color: var(--primary);
  letter-spacing: 0.05em;
  font-style: italic;
}

.logo-img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 40px;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: normal;
  color: var(--text-secondary);
  position: relative;
  transition: color 0.3s;
  letter-spacing: 0.02em;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--primary);
  transition: width 0.3s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link.active::after {
  width: 100%;
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}

.mobile-menu-btn span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: 0.3s;
}

/* Main Content */
#mainContent {
  padding-top: 70px;
  min-height: calc(100vh - 200px);
}

.page {
  animation: fadeIn 0.5s ease;
}

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

/* Hero Section (Home) */
.hero {
  min-height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 80px 24px;
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a227' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

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

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: normal;
  margin-bottom: 24px;
  line-height: 1.3;
  color: var(--text-primary);
}

.hero h1 span {
  color: var(--primary);
  font-style: italic;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 48px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 4px;
  font-size: 1rem;
  letter-spacing: 0.02em;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--primary);
  color: var(--bg);
}

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

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

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Section Styles */
.section {
  padding: 80px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 48px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: normal;
  position: relative;
  padding-bottom: 12px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--primary);
}

.section-link {
  color: var(--primary);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}

.section-link:hover {
  gap: 8px;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
}

@media (max-width: 1400px) {
  .cards-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1100px) {
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 800px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .cards-grid { grid-template-columns: 1fr; }
}

/* Book Card */
.book-card {
  background: var(--surface-elevated);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.book-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.book-card.skeleton {
  pointer-events: none;
}

.book-card.skeleton .skeleton-cover,
.book-card.skeleton .skeleton-title,
.book-card.skeleton .skeleton-author {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-elevated) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-cover {
  aspect-ratio: 3/4;
  background: var(--surface);
}

.skeleton-title {
  height: 20px;
  width: 80%;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-author {
  height: 14px;
  width: 50%;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

.book-cover {
  position: relative;
  aspect-ratio: 3/4;
  background: var(--surface);
  overflow: hidden;
}

.book-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--surface);
  padding: 16px;
  box-sizing: border-box;
  transition: transform 0.3s;
}

.book-card:hover .book-cover img {
  transform: scale(1.05);
}

.book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-elevated) 100%);
  color: var(--text-secondary);
}

.book-cover-placeholder svg {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  opacity: 0.4;
}

.book-cover-placeholder span {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-top: 8px;
  letter-spacing: 0.1em;
}

.book-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s;
}

.book-card:hover .book-overlay,
.book-card .book-cover-img:not([style*="display: none"]) ~ .book-overlay {
  opacity: 1;
}

.read-btn {
  background: var(--primary);
  color: var(--bg);
  padding: 10px 24px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.book-info {
  padding: 16px;
}

.book-title {
  font-size: 0.95rem;
  font-weight: normal;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.book-author {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Page Headers */
.page-header {
  padding: 100px 24px 60px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.page-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: normal;
  margin-bottom: 16px;
}

.page-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Footer */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 64px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--primary);
  font-style: italic;
  margin-bottom: 12px;
}

.footer-logo-img {
  height: 24px;
  width: auto;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.footer-links h4,
.footer-contact h4 {
  font-size: 0.95rem;
  font-weight: normal;
  margin-bottom: 16px;
}

.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-contact p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* PDF Modal */
.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  flex-direction: column;
}

.pdf-modal.active {
  display: flex;
}

.pdf-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.pdf-title {
  font-weight: normal;
  color: var(--text-primary);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

.pdf-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
  border-radius: 4px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.pdf-btn:hover {
  background: var(--primary);
  color: var(--bg);
}

.pdf-btn svg {
  width: 16px;
  height: 16px;
}

.pdf-page-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pdf-page-info input {
  width: 45px;
  padding: 4px 8px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-primary);
  text-align: center;
  font-size: 0.85rem;
}

.pdf-zoom-level {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 45px;
  text-align: center;
}

.pdf-viewer {
  flex: 1;
  overflow: auto;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  background: #0a0a0a;
  height: calc(100vh - 80px);
}

.pdf-viewer iframe {
  width: 100%;
  height: 100%;
  border: none;
  overflow: auto;
}

#pdfCanvas {
  max-width: 100%;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-secondary);
}

.pdf-loading.hidden {
  display: none;
}

.loader {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* About Page */
.about-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 24px;
}

.about-content h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: normal;
  margin-bottom: 16px;
  color: var(--primary);
}

.about-content p {
  margin-bottom: 24px;
  color: var(--text-secondary);
  line-height: 1.9;
}

.about-content ul {
  margin-bottom: 24px;
  padding-left: 24px;
}

.about-content li {
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.about-content li::marker {
  color: var(--primary);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: normal;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.load-more-container {
  text-align: center;
  padding: 32px;
}

.load-more-btn {
  padding: 14px 32px;
  font-size: 1rem;
}

.books-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.loader-content {
  text-align: center;
  color: var(--text-secondary);
}

.loader-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  color: var(--primary);
}

.loader-icon svg {
  width: 100%;
  height: 100%;
}

.loader-content p {
  font-size: 1.1rem;
}

.books-container {
  width: 100%;
}

.books-section {
  margin-bottom: 48px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 16px;
  }

  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s, opacity 0.3s;
  }

  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .hero {
    padding: 60px 16px;
  }

  .section {
    padding: 48px 16px;
  }

  .cards-grid {
    gap: 16px;
  }

  .pdf-toolbar {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .pdf-controls {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .footer-content {
    padding: 32px 16px;
  }
}