/* ======================================================================
   🌸 AINA SAGA — WEBTOON READER (FINAL OPTIMIZED)
   ====================================================================== */
   /* Hide Pagelayer hero section on chapter pages */
/* HIDE ONLY PAGELAYER HEADER ON SINGLE CHAPTER */
.single-chapter header .pagelayer-row,
.single-chapter header .pagelayer-row-holder,
.single-chapter header .pagelayer-background-overlay,
.single-chapter header .pagelayer-row-shape,
.single-chapter header [class*="pagelayer-"] {
    display: none !important;
}

/* Background */
.chapter-section { 
  padding: 0;
  background:transparent;
  width: 100%;
}

/* Reader container */
.chapter-reader-wrapper {
    background: #ffffff;
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    padding: 40px 0;
    border-radius: 22px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

/* Container for all images */
.chapter-panels {
    width: 100%;
    max-width: 850px;          /* same as chapter-reader-wrapper */
    margin: 0 auto;            /* centers the content */
    padding: 0 20px;           /* light side padding for mobile */
    box-sizing: border-box;
}

/* Make all images centered and clean */
.chapter-panels img {
    display: block;
    width: 100%;
    max-width: 800px;          /* keeps image tidy */
    height: auto;
    margin: 0 auto 30px;       /* center + bottom spacing */
    border-radius: 14px;       /* modern rounded image corners */
}

/* ============================================================
   📌 TOPBAR — DESKTOP (DEFAULT)
   ============================================================ */
.reader-topbar {
    position: sticky;
    top: 0;
    z-index: 999;
    width: 100%;

    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);

    padding: 12px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid rgba(0,0,0,0.08);
}

/* Title centered */
.rtb-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    flex-grow: 1;
}

/* Title styling */
.rtb-title a {
    text-decoration: none !important;
    color: #222 !important;
}
.rtb-title a:hover {
    color: #7a3cff !important;
}

/* Nav buttons */
.rtb-nav {
    display: flex;
    gap: 10px;
}

.rtb-btn {
    background: #7a3cff;
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.rtb-btn:hover {
    background: #5a25d1;
}

/* ================================
       Chapter Dropdown Styling
   ================================ */

.chapter-selector {
    display: flex;
    justify-content: center;
    text-align: center;
}

.chapter-selector select {
    display: flex !important;
    justify-content: center !important;
    text-align: center !important;
    text-align-last: center !important; /* Chrome & Edge */
    -moz-text-align-last: center !important; /* Firefox */
    padding-left: 0 !important;
    padding-right: 0 !important;
    
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    border-radius: 14px;
    border: 2px solid #e6d9ff;
    background: #ffffff;
    color: #3a2d79;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;

    box-shadow: 0 4px 12px rgba(122,60,255,0.12);
    transition: all 0.25s ease;
}

/* Hover effect */
.chapter-selector select:hover {
    border-color: #7a3cff;
    box-shadow: 0 4px 12px rgba(122,60,255,0.25);
}

/* Dropdown arrow replacement */
.chapter-selector select {
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a3cff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 14px;
    padding-right: 45px;
}

/* Center the selected text */
.chapter-selector select {
    text-align: center !important;
    text-align-last: center !important; /* Chrome + Edge */
    -moz-text-align-last: center !important; /* Firefox */
}

/* Center text in dropdown list */
.chapter-selector select option {
    text-align: center !important;
}


/* ============================================================
   📱 MOBILE — Title top + BOTH navs side-by-side
   ============================================================ */
@media (max-width: 700px) {

    /* Stack topbar vertically */
    .reader-topbar {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 12px 10px;
        transition: opacity 0.35s ease, transform 0.35s ease;
    }

    /* Title first */
    .rtb-title {
        order: 1;
        width: 100%;
        text-align: center;
        font-size: 16px;
        line-height: 1.3;
        margin-bottom: 5px;
    }

    /* BOTH .rbt-nav groups appear on SAME ROW */
    .reader-topbar .rbt-nav {
        order: 2;
        display: inline-flex;
        flex-direction: row;
        justify-content: center;
        gap: 12px;
        width: auto;
    }

    /* Second nav (Next) spacing fix */
    .reader-topbar .rbt-nav:nth-of-type(2) {
        margin-left: 12px;
    }

    /* Button size for mobile */
    .rbt-nav .rtb-btn {
        font-size: 14px;
        padding: 8px 18px;
        border-radius: 10px;
    }

    /* Hidden state (scroll down) */
    .reader-topbar.hide-bar {
        opacity: 0;
        transform: translateY(-20px);
        pointer-events: none;
    }

    /* Visible state (scroll up) */
    .reader-topbar.show-bar {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* Center dropdown container under the title */
    .chapter-selector {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 6px;
    }

    /* Mobile dropdown sizing */
    .chapter-selector select {
        width: 150px !important;
        height: 38px !important;

        font-size: 15px !important;
        font-weight: 600 !important;

        border-radius: 12px !important;
        padding: 6px 0 !important;

        display: flex !important;
        justify-content: center !important;
        text-align: center !important;
        text-align-last: center !important;
        -moz-text-align-last: center !important;

        background: #ffffff;
        border: 2px solid #e5d9ff !important;

        box-shadow: 0 0 12px rgba(122,60,255,0.25);
    }

    /* Center dropdown options */
    .chapter-selector select option {
        text-align: center !important;
    }
}

/* ============================================================
   BEAUTIFIED COMMENT SECTION – AINA SAGA FINAL CLEAN VERSION
============================================================ */

/* Outer comment container */
.chapter-comments {
    width: 100%;
    max-width: 850px;
    margin: 50px auto 80px;
    padding: 40px 35px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.07);
}

/* Titles (Reply + Comments header) */
.chapter-comments h3,
.single-chapter #comments h3,
.single-chapter #respond h3 {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 25px;
    color: #1a1a1a;
}

/* Remove WP inner form/card backgrounds */
.single-chapter #comments,
.single-chapter #respond {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Comment list spacing */
.single-chapter ol.comment-list,
.single-chapter ul.comment-list {
    padding: 0;
    margin: 0 0 30px 0;
    list-style: none;
}

/* Each comment bubble */
.single-chapter .comment {
    background: #f7f1ff;
    padding: 20px 22px;
    border-radius: 18px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* Avatar */
.single-chapter .comment .avatar {
    border-radius: 50%;
    width: 55px;
    height: 55px;
    margin-right: 12px;
}

/* Focus state */
.single-chapter #respond input:focus,
.single-chapter #respond textarea:focus {
    border-color: #7a3cff;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(122,60,255,0.15);
    outline: none;
}

/* Comment textarea */
.single-chapter #respond textarea {
    min-height: 150px;
    resize: vertical;
}

/* Cookie consent alignment */
.single-chapter #respond .comment-form-cookies-consent {
    display: flex;
    align-items: center;
    gap: 10px;
}
.single-chapter #respond .comment-form-cookies-consent input {
    width: auto;
    margin: 0;
}

/* Submit button wrapper */
.single-chapter #respond .form-submit {
    margin-top: 10px;
}

/* Submit button stylish */
.single-chapter #respond input[type="submit"] {
    background: #7a3cff;
    color: #fff;
    border: none;
    padding: 14px 25px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-block;
    width: auto;
}
.single-chapter #respond input[type="submit"]:hover {
    background: #5a25d1;
}

/* Remove WP spacing */
#reply-title,
#commentform {
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================================
   FIX FORM FIELD ALIGNMENT — FORCE CLEAN LAYOUT
============================================================ */

/* Remove ALL theme spacing from form wrappers */
.single-chapter #respond p {
    margin: 0 0 16px 0 !important;
    padding: 0 !important;
}

/* Fix label/field pairing alignment */
.single-chapter #respond .comment-form-comment label,
.single-chapter #respond .comment-form-author label,
.single-chapter #respond .comment-form-email label,
.single-chapter #respond .comment-form-url label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #222;
}

/* Always keep textarea first, without double spacing */
.single-chapter #respond .comment-form-comment {
    margin-top: 10px !important;
}

/* Inputs and textarea unified tidy spacing */
.single-chapter #respond input[type="text"],
.single-chapter #respond input[type="email"],
.single-chapter #respond input[type="url"],
.single-chapter #respond textarea {
    margin-top: 6px !important;
    margin-bottom: 18px !important;
    display: block;
    width: 100%;
}

/* Remove leftover weird gaps */
.single-chapter #respond .form-submit {
    margin-top: 10px !important;
}

.single-chapter #respond input[type="submit"] {
    margin-top: 5px !important;
}
