/* ===== INDEX PAGE ===== */

.index-layout {
  display: flex;
  gap: 0;
  min-height: 100vh;
}

.index-main {
  flex: 1;
  min-width: 0;
  padding: 24px;
}

.index-right {
  width: 200px;
  flex-shrink: 0;
  padding: 24px 20px 24px 0;
}

/* ===== FEATURED HERO ===== */
.featured-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 340px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 32px;
  background: #1a1a1a;
}

.featured-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.featured-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.1) 100%);
  z-index: 1;
}

.featured-hero-content {
  position: relative;
  z-index: 2;
  padding: 28px;
  width: 100%;
}

.featured-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(224, 123, 57, 0.15);
  border: 1px solid rgba(224, 123, 57, 0.4);
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.featured-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.featured-hero h2 {
  font-size: 36px;
  font-weight: 800;
  color: white;
  line-height: 1.1;
  margin-bottom: 12px;
  max-width: 500px;
}

.featured-hero p {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
  max-width: 480px;
  margin-bottom: 20px;
}

.featured-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== SECTION HEADING ===== */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-heading-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading-bar {
  width: 4px;
  height: 20px;
  background: var(--accent);
  border-radius: 2px;
}

.section-heading h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-heading-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.section-heading-link:hover {
  color: var(--accent);
}

.section-title-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}
.section-title-link:hover {
  color: var(--accent);
}

/* ===== NOVEL GRID ===== */
.novel-grid-main {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.novel-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.novel-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}

.novel-card-image-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
}

.novel-card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.novel-card:hover .novel-card-image-wrap img {
  transform: scale(1.05);
}

.novel-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(224, 123, 57, 0.9);
  color: white;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.novel-card-likes {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
}

.novel-card-likes svg {
  width: 11px;
  height: 11px;
  fill: #e05555;
}

.novel-card-body {
  padding: 12px;
}

.novel-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.novel-card-meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* ===== SEARCH ===== */
.search-container {
  position: relative;
  margin-bottom: 28px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  gap: 10px;
  transition: border-color var(--transition);
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
}

.search-input-wrap svg {
  width: 16px;
  height: 16px;
  fill: var(--text-muted);
  flex-shrink: 0;
}

.search-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}

.search-input-wrap input::placeholder {
  color: var(--text-muted);
}

.search-results-container {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
}

.search-results-container.active {
  display: block;
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--bg-hover);
}

/* ===== GENRE PANEL (right sidebar) ===== */
.genre-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: sticky;
  top: 24px;
}

.genre-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.genre-panel-header h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.genre-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.genre-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}

.genre-item:hover {
  background: var(--bg-hover);
}

.genre-item-name {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.genre-item:hover .genre-item-name {
  color: var(--text-primary);
}

.genre-item-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.genre-view-all {
  margin-top: 14px;
  width: 100%;
  padding: 9px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.genre-view-all:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== SCRIPT.JS GENERATED NOVEL CARDS (compatibility styles) ===== */
.novel-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: block;
  border: 1px solid var(--border);
}

.novel-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  border-color: var(--border-light);
}

.novelcover-container {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
}

.novelcover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  display: block;
}

.novel-card:hover .novelcover {
  transform: scale(1.05);
}

.novelcover-container .genre-tags {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: calc(100% - 16px);
}

.genre-tag {
  background: rgba(224, 123, 57, 0.85);
  color: white;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

.genre-tag.gl { background: rgba(218, 112, 214, 0.9); }

.novel-info {
  padding: 12px;
}

.novel-info .novel-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.latest-chapter-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  background: var(--accent-dim);
  border: 1px solid rgba(224, 123, 57, 0.3);
  border-radius: 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 4px;
}

.latest-chapter-button:hover {
  background: var(--accent);
  color: white;
}

.latest-chapter-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.story-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.loading-novels {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Search results from script.js */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search-result-item img {
  width: 32px;
  height: 46px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

.error-message {
  text-align: center;
  padding: 20px;
  color: #e05555;
  font-size: 14px;
}

/* Script.js search input */
.search-input {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input input {
  width: 200px;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.search-input input:focus {
  border-color: var(--accent);
}

.search-input input::placeholder {
  color: var(--text-muted);
}

.search-result-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.search-result-card:last-child { border-bottom: none; }

.search-result-card:hover {
  background: var(--bg-hover);
}

.search-result-card img {
  width: 28px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.search-result-card h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Pagination buttons from script.js */
.pagination-button {
  padding: 7px 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.pagination-button:hover,
.pagination-button.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 7px 4px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== PAGINATION ===== */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 32px 0 16px;
}

.page-btn {
  padding: 7px 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.page-btn:hover,
.page-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== CAROUSEL ===== */
.carousel-container {
  display: flex;
  width: 100%;
  height: 340px;
  position: relative;
  margin-bottom: 32px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.carousel-slot {
  position: relative;
  overflow: hidden;
}

.slot-1 { width: 5%; }
.slot-2 { flex: 1; border: 2px solid var(--accent); border-radius: var(--radius-lg); }
.slot-3 { width: 18%; }
.slot-4 { width: 18%; }

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
}

.slot-2 .carousel-image {
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.slot-2 .carousel-image.active {
  opacity: 1;
}

.slot-3 .carousel-image,
.slot-4 .carousel-image {
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-left { transform: translateX(-100%); }
.slide-right { transform: translateX(100%); }

.carousel-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 30px 20px 20px;
  color: white;
  z-index: 10;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease;
}

.carousel-text.show {
  opacity: 1;
  transform: translateY(0);
}

.carousel-text h2 {
  font-size: 1.4rem;
  margin-bottom: 6px;
  font-weight: 700;
}

.carousel-text p {
  color: rgba(255,255,255,0.7);
  font-size: 0.82rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.6);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  z-index: 20;
  transition: all 0.2s;
}

.nav-btn:hover { background: var(--accent); }
.nav-btn.prev { left: 8px; }
.nav-btn.next { right: 8px; }

.seo-content { display: none; }
.no-js .seo-content { display: block; }
.no-js .carousel-container { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .index-right { display: none; }
  .novel-grid-main {
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
  }
}

@media (max-width: 900px) {
  .novel-grid-main {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .index-main { padding: 12px; }
  .featured-hero h2 { font-size: 20px; }
  .featured-hero p { font-size: 12px; }
  .featured-hero { min-height: 220px; }
  .slot-3, .slot-4 { display: none; }
  .slot-2 { flex: 1 !important; }
  .carousel-container { height: 240px; }
  .novel-grid-main {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .novel-info { padding: 8px; }
  .novel-info .novel-title { font-size: 10px; margin-bottom: 4px; }
  .latest-chapter-button { font-size: 9px; padding: 2px 5px; }
  .story-meta { font-size: 9px; }
  .section-heading { margin-bottom: 12px; }
  .section-heading h3 { font-size: 12px; }
}

@media (max-width: 380px) {
  .novel-grid-main {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .topbar-search-area { max-width: 140px; }
}
