:root {
    --bg: #1e1e1e;
    --card: #2a2a2a;
    --text: #f1f1f1;
    --red: #cc0000;
    --blue: #007bff;
    --discord: #505050;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    user-select: none;
    font-family: 'Roboto', sans-serif;
    padding-top: 120px;
    background: var(--bg);
    color: var(--text);
}

/* ================= TOP BAR ================= */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;

    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;

    font-family: 'Oswald', sans-serif;

    background: #333;
    background-image: url("https://rj-novels.github.io/RJ-Novels/assets/images/header-bg.jpg");
    background-size: cover;
    background-position: center;
}

.top-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.top-bar * {
    position: relative;
    z-index: 1;
}

.menu-btn {
    font-size: 22px;
    cursor: pointer;
}

/* ================= SIDEBAR ================= */
.sidebar {
    height: 100%;
    width: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 102;

    padding-top: 60px;
    overflow-x: hidden;
    transition: 0.4s;

    background: #111;
}

.sidebar a {
    display: block;
    padding: 15px 30px;
    color: #bbb;
    text-decoration: none;
    font-family: 'Oswald', sans-serif;
}

.sidebar a:hover {
    background: #333;
    color: #fff;
}

.closebtn {
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 30px;
    cursor: pointer;
}

/* ===== SEARCH BOX ===== */
.search-icon {
    margin-left: auto;
    font-size: 18px;
    cursor: pointer;
}

.search-box {
    position: fixed;
    top: 115px;
    left: 0;
    width: 100%;
    height: 0;
    overflow: hidden;

    background: var(--bg);
    z-index: 101;

    transition: height 0.25s ease;
}

.search-box.active {
    height: 48px;
}

.search-box input {
    width: calc(100% - 20px);
    margin: 10px;
    padding: 8px 10px;

    background: var(--card);
    border: 1px solid #444;
    border-radius: 5px;
    color: var(--text);
}

body.search-open {
    padding-top: 168px;
}

/* ================= CATEGORY ================= */
.category-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
}

.cat-btn {
    padding: 6px 14px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--red);
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Oswald', sans-serif;
}

.cat-btn.active {
    background: var(--red);
}

/* ================= GRID ================= */
.novel-grid {
    max-width: 900px;
    margin: auto;
    padding: 10px;

    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* ================= CARD ================= */
.novel-card {
    position: relative;
    background: var(--card);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
}

/* COVER */
.cover-box {
    position: relative;
    width: 100%;
    padding-bottom: 133%;
}

.cover-box img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* TAG */
.tag {
    position: absolute;
    top: 0;
    left: 0;

    padding: 3px 6px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    font-family: 'Oswald', sans-serif;

    border-bottom-right-radius: 4px;
}

.tag.light { background: var(--red); }
.tag.web { background: var(--blue); }

/* TITLE */
.title {
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.3;

    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;

    color: var(--text) !important;
    text-decoration: none !important;
}

/* ================= POST PAGE ================= */
.post-container {
    max-width: 720px;
    margin: auto;
    padding: 20px;
}

.novel-title {
    font-family: 'Oswald', sans-serif;
    font-size: 26px;
    margin-bottom: 15px;
    color: var(--text) !important;
    text-decoration: none !important;
}

.cover-wrapper img {
    width: 100%;
    border-radius: 6px;
    filter: blur(0.3px);
}

/* SECTIONS */
.section {
    margin-top: 25px;
}

.section-header {
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    border-left: 4px solid var(--red);
    padding-left: 10px;
    margin-bottom: 10px;
}

.genre-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.genre-list span {
    background: var(--card);
    padding: 5px 10px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #444;
}

.description {
    font-size: 14px;
    line-height: 1.6;
}

/* BUTTONS */
.download-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    padding: 10px;
    text-align: center;
    text-decoration: none;
    font-family: 'Oswald', sans-serif;
    font-weight: bold;
    border-radius: 5px;
    color: #fff;
}

.btn.pdf { background: var(--red); }
.btn.epub { background: var(--blue); }
.btn.discord { background: var(--discord); }

/* ===== IMAGE QUALITY & COLOR BOOST ===== */
.cover-box img,
.cover-wrapper img {
    image-rendering: auto;
    filter: contrast(1) saturate(1.35) brightness(0.95);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.novel-card:hover .cover-box img {
    transform: scale(1.03);
}

/* SCROLL TO TOP BUTTON */
#scrollTopBtn {
    position: fixed;
    bottom: 80px;
    right: 23px;

    width: 50px;
    height: 50px;

    border-radius: 50%;
    background: #333;
    color: #fff;
    font-size: 26px;

    border: none;
    cursor: pointer;
    display: none;
    z-index: 999;

    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    transition: opacity 0.3s, transform 0.3s;
}

#scrollTopBtn:hover {
    transform: translateY(-3px);
}

/* SAVED icon */
.save-btn {
    position: absolute;
    top: 8px;
    right: 8px;

    background: rgba(0,0,0,0.7);
    border: none;
    color: white;

    padding: 6px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    z-index: 10;
}

.save-btn.saved {
    color: #ff5b7f;
}

/* BADGE */
.time-badge {
    position: absolute;
    bottom: 8px;
    right: 15px;

    width: 43px;
    height: 23px;

    background: #000;
    color: #fff;

    font-size: 10px;
    font-weight: 700;

    display: none;
    align-items: center;
    justify-content: center;

    transform: rotate(180deg);

    clip-path: polygon(
        0 0,
        85% 0,
        100% 50%,
        85% 100%,
        0 100%
    );

    filter: drop-shadow(0 0 1px #000)
            drop-shadow(0 0 1px #000);
}

.time-badge::before {
    content: "";
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);

    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
}

.time-badge::after {
    transform: rotate(180deg);
}

.time-badge.hot {
    display: flex;
    background: var(--red);
}
.time-badge.hot::after {
    content: "\2003\2009HOT";
}

.time-badge.new {
    display: flex;
    background: #ffb703;
    color: #000;
}
.time-badge.new::after {
    content: "\2003\2009NEW";
}

/* ===== 404 PAGE ===== */
.error-404 {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.error-img {
    width: 260px;
    max-width: 90%;
    display: block;
    margin: 20px auto;
}

.error-404 p {
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 25px;
}

.error-404 .btn-home {
    font-family: 'Roboto', sans-serif;
    padding: 10px 22px;
    border-radius: 6px;
    background: #1e293b;
    color: #fff;
    text-decoration: none;
}

.error-404 .btn-home:hover {
    background: #334155;
    }

/* ===== Premium ===== */
.premium {
  padding: 20px;
  text-align: center;
  margin: 18px 0;
  display: none;
}

.premium h2 {
  color: var(--red);
  font-family: 'Oswald', sans-serif;
}

.premium p {
  color: #ccc;
  margin: 10px 0;
}

.premium-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 12px 22px;
  background: var(--red);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: bold;
  transition: 0.2s;
}

.premium-btn:hover {
  background: var(--red);
  transform: scale(1.03);
}

/* ===== Comments ===== */
.comments-wrapper {
  margin-top: 40px;
  padding: 0 15px;
}

.comments-container {
  max-width: 650px;
  margin: 0 auto;

  background: var(--bg);
  border-radius: 10px;
  padding: 12px;

  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  border: 1px solid #333;
}

.comments-title {
  font-size: 16px;
  margin-bottom: 10px;
  color: var(--text);
}

@media (max-width: 768px) {
  .comments-container {
    max-width: 95%;
    padding: 10px;
  }
}
