/* LiterasiKita PWA Modern Stylesheet v1.0 */
:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: #131c31;
  --bg-card-hover: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #0284c7;
  --accent-light: #38bdf8;
  --accent-amber: #f59e0b;
  --border-color: #1e293b;
  --border-active: #0284c7;
  --radius-lg: 1rem;
  --radius-md: 0.75rem;
  --radius-sm: 0.5rem;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navbar */
header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgba(9, 13, 22, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-dmca, .btn-install {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
}

.btn-dmca {
  background: transparent;
  color: var(--text-secondary);
}

.btn-dmca:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-install {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  display: none;
}

.btn-install:hover {
  background: #0369a1;
}

/* Hero Section */
.hero {
  padding: 2.5rem 1.25rem 1.5rem;
  text-align: center;
  background: radial-gradient(circle at 50% 20%, rgba(2, 132, 199, 0.12) 0%, rgba(9, 13, 22, 0) 70%);
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

/* Search Bar */
.search-wrapper {
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1.25rem 0.85rem 2.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
}

.search-icon {
  position: absolute;
  left: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.clear-search {
  position: absolute;
  right: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  font-size: 1rem;
}

/* Categories Bar */
.categories-container {
  max-width: 1200px;
  margin: 0.5rem auto 1.5rem;
  padding: 0 1.25rem;
}

.categories-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories-bar::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cat-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

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

.cat-count {
  font-size: 0.7rem;
  opacity: 0.75;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
}

/* Main Content Area */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

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

.category-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.items-found {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Book Grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.15rem;
}

@media (min-width: 768px) {
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.5rem;
  }
}

/* Book Card */
.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.book-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.15);
}

.book-cover-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.cover-fallback {
  text-align: center;
  padding: 1rem;
}

.cover-fallback .fallback-icon {
  width: 42px;
  height: 42px;
  color: var(--accent-light);
  margin-bottom: 0.5rem;
}

.cover-fallback .fallback-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-info {
  padding: 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

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

.book-author {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.65rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.badge-pdf {
  background: rgba(2, 132, 199, 0.15);
  color: var(--accent-light);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

/* Pagination & Loading */
.loading-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}

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

.load-more-btn {
  display: block;
  margin: 2rem auto 0;
  padding: 0.75rem 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.load-more-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

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

.modal-close:hover {
  color: #fff;
  background: var(--bg-card-hover);
}

.modal-body {
  padding: 1.75rem;
}

.modal-header-wrap {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.modal-cover {
  width: 100px;
  aspect-ratio: 3 / 4;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.modal-title-area h2 {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.modal-title-area p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.modal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.pill-item {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.quote-box {
  background: rgba(2, 132, 199, 0.12);
  border-left: 4px solid var(--accent-light);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-style: italic;
  font-size: 0.85rem;
  color: #e0f2fe;
  margin-bottom: 1rem;
}

.quote-box cite {
  display: block;
  font-size: 0.72rem;
  color: var(--accent-light);
  margin-top: 0.35rem;
  font-style: normal;
  font-weight: 700;
}

.toc-list {
  list-style: none;
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* Action Buttons in Modal */
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-traktir {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}

.btn-traktir:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  transform: translateY(-2px);
}

.btn-free {
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-free:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Footer */
footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 2rem 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

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