body {
    background-color: var(--bg-cream);
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    scroll-behavior: smooth;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* NAVBAR */
.reader-navbar {
    background-color: var(--teal);
    padding: 10px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    transition: background-color 0.3s ease;
}

/* wrapper komik */
.comic-viewer-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding-top: 20px;
    padding-bottom: 30px;
    min-height: 80vh;
    text-align: center;
}

.comic-image {
    width: 100%;
    max-width: 800px;
    display: block;
    margin: 0 auto 0 auto;
}

/* darkmode (dm) */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode .text-muted {
    color: #a0a0a0 !important;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #f0f0f0;
}

body.dark-mode .reader-navbar {
    background-color: #1f1f1f;
    border-bottom: 1px solid #333;
}

body.dark-mode .reader-toolbar {
    background-color: #1f1f1f;
    border: 3px solid #333;
}

body.dark-mode .btn-tool {
    background-color: #2d2d2d;
    color: #aaa;
    border: 2px solid #333;
}

body.dark-mode .btn-tool:hover {
    color: white;
    background-color: #444;
}

body.dark-mode footer {
    background-color: #1f1f1f !important;
    border-top-color: #333 !important;
}

/* komentar dm */
body.dark-mode .comment-card {
    background-color: #1f1f1f;
    border: 3px solid #555;
    color: #ccc;
}

body.dark-mode .comment-user {
    color: #fff;
}

body.dark-mode .comment-text {
    color: #bbb;
}

body.dark-mode .editor-toolbar {
    background-color: #2d2d2d;
    border-color: #555;
}

body.dark-mode .btn-format {
    color: #ccc;
    border-color: transparent;
}

body.dark-mode .btn-format:hover {
    background-color: #444;
    border-color: #555;
}

body.dark-mode textarea#commentContent {
    background-color: #262626 !important;
    color: #fff;
    border-color: #555 !important;
}

body.dark-mode textarea#commentContent::placeholder {
    color: #777;
}

body.dark-mode .border-light {
    border-color: #333 !important;
}

body.dark-mode .comic-image {
    border-color: #555;
}

/* tombol reaksi dm */
body.dark-mode .reaction-btn {
    background-color: transparent;
    border: none;
    color: #aaa;
}

body.dark-mode .reaction-btn:hover {
    background-color: transparent;
    transform: scale(1.1);
}

/* input gif dm */
body.dark-mode .gif-search-container {
    background-color: #2d2d2d;
}

body.dark-mode .modal-content {
    background-color: #1f1f1f;
    color: #eee;
    border: 3px solid #555;
}

body.dark-mode .input-group-text,
body.dark-mode #gifSearchInput {
    background-color: #333 !important;
    color: white;
    border-color: #555;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode .chip {
    background-color: #333;
    color: #ccc;
    border-color: #555;
}

body.dark-mode .chip:hover {
    background-color: var(--teal);
    color: white;
    border-color: var(--teal);
}

.comic-title-text {
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.2;
    margin-bottom: 2px;
    justify-content: center;
}

.chapter-info-text {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

.btn-nav-icon {
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-nav-icon:hover {
    background-color: white;
    color: var(--teal);
    border-color: white;
}

.image-container {
    min-height: 60vh;
}

/* section tools */
.reader-tools-wrapper {
    position: sticky;
    bottom: 20px;
    z-index: 100;
    display: flex;
    justify-content: center;
    padding: 10px 0 20px 0;
    pointer-events: none;
}

.reader-toolbar {
    pointer-events: auto;
    background-color: white;
    padding: 5px 10px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 3px solid #111;
    /* Diubah menjadi solid tebal ala komik */
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.btn-tool {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #111;
    /* Ditambah border tebal */
    background-color: #f8f9fa;
    color: var(--teal);
    font-size: 0.9rem;
    transition: all 0.2s;
    text-decoration: none;
    cursor: pointer;
}

.btn-tool:hover {
    background-color: var(--teal);
    color: white;
    transform: translateY(-1px);
}

.btn-tool-menu {
    width: 42px;
    height: 42px;
    background-color: var(--teal);
    color: white;
    font-size: 1.1rem;
    border: 2px solid #111;
}

.btn-tool-menu:hover {
    background-color: var(--teal-dark);
    color: white;
}

/* Section reaksi */
.reaction-container {
    width: 100%;
    margin: 60px auto 80px auto;
    padding: 0 20px;
    text-align: center;
}

.reaction-btn-group {
    display: inline-flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.reaction-btn {
    position: relative;
    background: transparent;
    border: none;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

.reaction-btn:focus {
    outline: none;
}

.reaction-icon {
    font-size: 2.5rem;
    line-height: 1;
    filter: grayscale(0.9) opacity(0.7);
    transition: all 0.3s ease;
}

.reaction-btn:hover .reaction-icon,
.reaction-btn[class*="active-"] .reaction-icon {
    filter: grayscale(0) opacity(1);
    transform: scale(1.25);
}

/* badge jumlah reaksi */
.reaction-count-badge {
    position: absolute;
    top: 0;
    right: -5px;
    background-color: #555;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    border: 2px solid #111;
    transition: background-color 0.3s;
}

.reaction-btn.active-like .reaction-count-badge {
    background-color: #ff4757;
}

.reaction-btn.active-interested .reaction-count-badge {
    background-color: #ffa502;
}

.reaction-btn.active-sad .reaction-count-badge {
    background-color: #5352ed;
}

.reaction-btn.active-dislike .reaction-count-badge {
    background-color: #2f3542;
}

body.dark-mode .reaction-count-badge {
    border-color: #121212;
}

/* komen */
.comment-section-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 40px auto;
    padding: 0 20px;
}

.comment-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    border: 3px solid #111;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #eee;
    border: 2px solid #111;
}

.comment-user {
    font-weight: 900;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.comment-date {
    font-size: 0.75rem;
    color: #999;
    font-weight: bold;
}

.comment-text {
    font-size: 0.95rem;
    color: #222;
    font-weight: bold;
    line-height: 1.5;
    margin-top: 5px;
}

.comment-text a {
    color: var(--teal);
    text-decoration: underline;
    font-weight: 900;
    word-break: break-all;
}

.comment-text a:hover {
    color: var(--teal-dark);
}

.comment-text img {
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
    display: block;
    border: 2px solid #111;
}

.reply-box {
    margin-left: 50px;
    margin-top: 10px;
    padding-left: 15px;
    border-left: 3px solid #111;
}

body.dark-mode .reply-box {
    border-left-color: #555;
}

.btn-reply {
    font-size: 0.8rem;
    color: var(--teal);
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-reply:hover {
    text-decoration: underline;
}

.btn-show-replies {
    font-size: 0.85rem;
    color: var(--teal);
    font-weight: 900;
    background: none;
    border: none;
    padding: 0;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
}

.btn-show-replies:hover {
    text-decoration: underline;
}

/* toolbar editor */
.editor-toolbar {
    display: flex;
    gap: 5px;
    background-color: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px 8px 0 0;
    border: 2px solid #111;
    /* Gaya komik */
    border-bottom: none;
}

.btn-format {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    background: transparent;
    border-radius: 4px;
    color: #111;
    transition: all 0.2s;
}

.btn-format:hover {
    background-color: var(--accent-yellow);
    color: #111;
    border-color: #111;
}

textarea#commentContent {
    border-radius: 0 0 8px 8px;
    border: 2px solid #111 !important;
    /* Gaya komik */
    border-top: 1px dashed #111 !important;
}

/* spoiler tag */
.spoiler {
    background-color: #2d3748;
    color: #2d3748;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    border: 2px solid #111;
}

.spoiler a {
    color: inherit !important;
    text-decoration: none;
    pointer-events: none;
}

.spoiler:hover {
    background-color: #4a5568;
    color: #4a5568;
}

.spoiler.revealed {
    background-color: #e2e8f0;
    color: #2d3748;
    cursor: text;
    user-select: text;
}

.spoiler.revealed a {
    color: var(--teal) !important;
    text-decoration: underline;
    pointer-events: auto;
}

.chapter-list-item {
    display: block;
    padding: 12px 15px;
    border-bottom: 2px solid #111;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.chapter-list-item:hover {
    background-color: #f8f9fa;
    color: var(--teal);
}

.chapter-list-item.active {
    background-color: var(--accent-yellow);
    color: #111;
    font-weight: 900;
    border-left: 6px solid #111;
}

body.dark-mode .chapter-list-item {
    border-bottom-color: #333;
    color: #eee;
}

body.dark-mode .chapter-list-item:hover {
    background-color: #333;
    color: var(--teal);
}

body.dark-mode .chapter-list-item.active {
    background-color: #1a1a1a;
    color: var(--accent-yellow);
    border-left-color: var(--accent-yellow);
}

/* pin */
.pinned-comment {
    background-color: #f0fdf4;
    border: 3px solid #111 !important;
    border-radius: 12px;
    padding: 15px;
}

body.dark-mode .pinned-comment {
    background-color: #051b11;
    border-color: #0f5132 !important;
}

.pinned-badge {
    font-size: 0.75rem;
    background-color: #111;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    margin-right: 5px;
    font-weight: 900;
    text-transform: uppercase;
}

/* sorting tab */
.sort-link {
    text-decoration: none;
    color: #999;
    font-size: 0.9rem;
    font-weight: 900;
    margin-left: 15px;
    transition: color 0.2s;
    text-transform: uppercase;
}

.sort-link:hover,
.sort-link.active {
    color: var(--teal);
}

.sort-link.active {
    border-bottom: 3px solid var(--teal);
    padding-bottom: 2px;
}

:target {
    animation: highlight 2s ease;
}

@keyframes highlight {
    0% {
        background-color: #e0f2f1;
    }

    100% {
        background-color: transparent;
    }
}

/* role & title */
.role-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 50px;
    margin-left: 5px;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.5px;
    border: 2px solid #111;
}

.role-reader {
    background-color: #fff;
    color: #111;
}

.role-author {
    background-color: var(--teal);
    color: #fff;
}

.role-admin {
    background-color: #dc3545;
    color: #fff;
}

.role-leader {
    background-color: #111;
    color: #fff;
}

.gamification-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 50px;
    margin-left: 4px;
    border: 2px solid #111;
    color: #111;
    background-color: var(--accent-yellow);
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    text-transform: uppercase;
}

body.dark-mode .role-reader {
    background-color: #444;
    color: #ccc;
    border-color: #555;
}

body.dark-mode .gamification-badge {
    background-color: #333;
    color: #ffc107;
    border-color: #555;
}

/* gif picker */
.gif-search-container {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-bottom: 15px;
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    min-height: 200px;
}

.gif-item {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    background-color: #f0f0f0;
    border: 2px solid #111;
}

.gif-item:hover {
    transform: scale(1.05);
}

/* shadow dihapus */
.chip-group {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.chip-group::-webkit-scrollbar {
    display: none;
}

.chip {
    white-space: nowrap;
    padding: 5px 12px;
    background-color: #fff;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid #111;
}

.chip:hover,
.chip.active {
    background-color: var(--accent-yellow);
    color: #111;
}

/* floating scroll */
.scroll-btn-group {
    position: fixed;
    bottom: 25px;
    right: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.scroll-btn-group:hover {
    opacity: 1;
}

.btn-scroll {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--teal);
    color: white;
    border: 2px solid #111;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.btn-scroll:hover {
    background-color: var(--accent-yellow);
    color: #111;
    transform: translateY(-2px);
}

body.dark-mode .btn-scroll {
    background-color: rgba(60, 60, 60, 0.8);
    color: #ddd;
    border-color: #333;
}

body.dark-mode .btn-scroll:hover {
    background-color: #555;
    color: white;
}

@media (max-width: 576px) {
    .scroll-btn-group {
        right: 10px;
        bottom: 80px;
    }

    .btn-scroll {
        width: 28px;
        height: 28px;
    }
}

/* mobile */
@media (max-width: 768px) {

    /* navbar & header */
    .reader-navbar {
        padding: 10px;
    }

    .comic-title-text {
        font-size: 0.95rem;
        justify-content: center;
    }

    .chapter-info-text {
        font-size: 0.75rem;
    }

    .btn-nav-icon {
        width: 35px;
        height: 35px;
        font-size: 0.85rem;
    }

    /* gambar komik */
    .comic-image {
        border-width: none;
        border-radius: 0;
        margin-bottom: 0;
    }

    /* section reaksi */
    .reaction-container {
        margin: 30px auto 40px auto;
        padding: 0 10px;
    }

    .reaction-btn-group {
        gap: 10px;
    }

    .reaction-icon {
        width: 45px !important;
        height: 45px !important;
    }

    .reaction-btn {
        padding: 5px;
    }

    /* section komen */
    .comment-section-wrapper {
        padding: 0 10px;
    }

    .comment-card {
        padding: 15px;
        border-width: 2px;
    }
    
    .comment-card h4 {
        font-size: 1.1rem;
    }

    .sort-link {
        font-size: 0.75rem;
        margin-left: 10px;
    }

    .comment-user {
        font-size: 0.7rem !important;
    }

    .comment-date {
        font-size: 0.55rem !important;
    }

    .comment-text {
        font-size: 0.75rem !important;
    }

    .role-badge, .gamification-badge {
        font-size: 0.45rem !important;
        padding: 1px 3px !important;
    }

    .btn-reply, .btn-show-replies {
        font-size: 0.65rem !important;
    }

    /* balasan komen */
    .reply-box {
        margin-left: 15px;
        padding-left: 10px;
        border-left-width: 2px;
    }

    .comment-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    /* editor toolbar */
    .editor-toolbar {
        flex-wrap: wrap;
        gap: 4px;
        padding: 6px;
    }

    .btn-format {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

/* layar hp kecil */
@media (max-width: 400px) {
    .reaction-icon {
        width: 35px !important;
        height: 35px !important;
    }

    .comment-card {
        padding: 12px;
    }

    .d-flex.gap-3 {
        gap: 0.5rem !important;
    }
}