/* === Base === */
html {
  scrollbar-color: #c4c4c4 #f1f5f9;
}

body {
  background-color: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  font-family: system-ui, -apple-system, sans-serif;
}

/* === Animations === */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

/* === Card image === */
.card-img-wrap {
  aspect-ratio: 16 / 10;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
}

/* === Search input === */
.search-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.625rem 1rem 0.625rem 2.5rem;
  font-size: 0.875rem;
  color: #1e293b;
  transition: all 0.15s;
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #818cf8;
  border-color: transparent;
}

/* === Menu tabs === */
.menu-tab {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.15s;
  color: #64748b;
  cursor: pointer;
  border: none;
  background: none;
}

.menu-tab:hover {
  color: #334155;
  background: #e2e8f0;
}

.menu-tab.active {
  background: #6366f1;
  color: #fff;
}

.menu-tab.active:hover {
  background: #4f46e5;
}

/* === Catalogue badge === */
.catalogue-badge {
  display: none;
  align-items: center;
  gap: 0.375rem;
  background: #eef2ff;
  color: #4338ca;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.catalogue-badge.visible {
  display: flex;
}

.catalogue-badge-name {
  font-weight: 600;
  color: #312e81;
}

.catalogue-badge-clear {
  margin-left: 0.25rem;
  padding: 0.125rem;
  border-radius: 0.25rem;
  border: none;
  background: none;
  color: #6366f1;
  cursor: pointer;
  transition: background 0.15s;
}

.catalogue-badge-clear:hover {
  background: rgba(99, 102, 241, 0.15);
}

/* === Card === */
.card {
  background: #fff;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  transition: all 0.2s;
}

.card:hover {
  border-color: #a5b4fc;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card:hover .card-title {
  color: #4f46e5;
}

.catalogue-link {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  background: #eef2ff;
  color: #4338ca;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  text-decoration: none;
  transition: background 0.15s;
}

.catalogue-link:hover {
  background: #c7d2fe;
}

.card-date {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* === Quality pills === */
.quality-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  background: #f1f5f9;
  color: #64748b;
  text-decoration: none;
  transition: all 0.15s;
}

.quality-pill:hover {
  background: #e0e7ff;
  color: #4338ca;
}

.quality-pill-label {
  font-weight: 600;
  color: #334155;
}

.quality-pill:hover .quality-pill-label {
  color: #312e81;
}

/* === Loader === */
.loader-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid #cbd5e1;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 5rem 0;
  color: #94a3b8;
  font-size: 1.125rem;
}

/* === Back link === */
.back-link {
  font-size: 0.875rem;
  color: #6366f1;
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover {
  color: #4338ca;
}

/* === Detail page === */
.detail-container {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 0.75rem;
  line-height: 1.3;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.detail-meta-item {
  font-size: 0.875rem;
  color: #64748b;
}

/* === Carousel === */
.carousel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.carousel-viewport {
  position: relative;
  background: #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 60vh;
}

.carousel-main {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 2;
  user-select: none;
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.65);
}

.carousel-prev { left: 0.75rem; }
.carousel-next { right: 0.75rem; }

/* Thumbnail strip */
.carousel-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.carousel-thumb {
  flex: 0 0 auto;
  width: 5.5rem;
  height: 4rem;
  border-radius: 0.375rem;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: all 0.15s;
}

.carousel-thumb:hover {
  opacity: 0.85;
}

.carousel-thumb.active {
  border-color: #6366f1;
  opacity: 1;
}

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

/* === Image modal === */
.img-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 1.5rem;
}

.img-modal.open {
  display: flex;
}

.img-modal img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.img-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.img-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* === Header layout === */
.header-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  text-decoration: none;
  white-space: nowrap;
}

.header-search {
  position: relative;
  flex: 1 1 0;
  min-width: 8rem;
  max-width: 32rem;
}

.header-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.header-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* === Hamburger toggle === */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: auto;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  border-color: #94a3b8;
  color: #334155;
}

.hamburger-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* === Mobile nav drawer === */
.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e2e8f0;
}

.mobile-nav .auth-btn {
  justify-content: flex-start;
  width: 100%;
}

/* === Auth button === */
.auth-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.auth-btn:hover {
  border-color: #94a3b8;
  color: #334155;
}

.auth-btn-active {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}

.auth-btn-active:hover {
  background: #d1fae5;
  border-color: #34d399;
}

/* === Detail / simple header === */
.header-simple {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-simple-end {
  margin-left: auto;
}

/* === Responsive header === */
/* Large desktop - full layout */
@media (min-width: 1280px) {
  .header-search {
    max-width: 32rem;
  }
}

/* Tablet and smaller desktop - more compact */
@media (max-width: 1279px) {
  .header-search {
    max-width: 20rem;
  }
}

/* Mobile - hamburger menu */
@media (max-width: 1100px) {
  .hamburger-btn {
    display: flex !important;
  }

  .header-actions {
    display: none !important;
  }

  .header-actions.open {
    display: flex !important;
  }

  .mobile-nav.open {
    display: flex;
  }

  .header-search {
    max-width: none;
    order: 10;
    flex-basis: 100%;
  }

  .header-top {
    gap: 0.5rem;
  }

  .header-bottom {
    gap: 0.5rem;
  }

  .menu-tab {
    padding: 0.375rem 0.5rem;
    font-size: 0.7rem;
  }
  
  .header-logo {
    font-size: 1.1rem;
  }
}

/* === Auth modal === */
.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-modal.open {
  display: flex;
}

.auth-modal-box {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.25rem;
  width: 100%;
  max-width: 28rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.auth-textarea {
  width: 100%;
  font-family: monospace;
  font-size: 0.75rem;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  resize: vertical;
  color: #1e293b;
  box-sizing: border-box;
}

.auth-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.auth-save-btn,
.auth-clear-btn,
.auth-close-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-save-btn {
  background: #6366f1;
  color: #fff;
}

.auth-save-btn:hover {
  background: #4f46e5;
}

.auth-clear-btn {
  background: #fef2f2;
  color: #dc2626;
}

.auth-clear-btn:hover {
  background: #fee2e2;
}

.auth-close-btn {
  background: #f1f5f9;
  color: #64748b;
}

.auth-close-btn:hover {
  background: #e2e8f0;
}

/* === Download section === */
.download-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  background: #6366f1;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.download-btn:hover {
  background: #4f46e5;
}

.download-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.download-link-btn {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0.375rem;
  background: #ecfdf5;
  color: #047857;
  text-decoration: none;
  transition: background 0.15s;
}

.download-link-btn:hover {
  background: #d1fae5;
}

/* === Favorite button === */
.fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.fav-btn:hover {
  border-color: #fbbf24;
  color: #b45309;
}

.fav-btn-active {
  background: #fffbeb;
  border-color: #fbbf24;
  color: #b45309;
}

.fav-btn-active:hover {
  background: #fef3c7;
}
