/* ใช้ Style พื้นฐานเดียวกับหน้า Index */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f9f9f9;
    color: #0f0f0f;
    padding-bottom: 30px;
}

.explorer-header {
    background: #e1e1e1;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
}

.view-novel-card .explorer-content {
    padding: 0;
}

/* ส่วนแสดงภาพ (Video Placeholder) */
.video-area {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

.play-btn {
    position: absolute;
    font-size: 5rem;
    color: #fff;
    text-decoration: none;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* รายละเอียดใน Content */
.details-padding {
    padding: 10px;
}

.novel-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 8px;
    line-height: 1.4;
}

.stats-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

.more-actions {
    margin-left: auto;
    position: relative;
}

.more-btn {
    background: none;
    border: none;
    color: #606060;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.more-btn:hover {
    background: #f0f0f0;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 180px;
    padding: 8px 0;
    border-radius: 8px;
    background-color: var(--bg-card, white) !important;
    color: var(--text-main, #333) !important;
    border: 1px solid var(--border-color, #ddd) !important;
    z-index: 999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.more-actions.active .dropdown-menu {
    display: block;
}

.dropdown-menu .divider {
    background-color: var(--border-color, #eee) !important;
    height: 1px;
    margin: 4px 0;
    border: none;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item .material-symbols-outlined {
    font-size: 1.2rem;
    color: #606060;
}

.dropdown-item.delete {
    color: #cc0000;
}

.dropdown-item.delete .material-symbols-outlined {
    color: #cc0000;
}

.divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

.stat-badge-like {
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #555;
}

.stat-badge {
    background: #f0f0f0;
    padding: 5px 5px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #555;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 4px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
}

.author-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #ddd;
    object-fit: cover;
}

.author-name {
    font-weight: bold;
    font-size: 1rem;
    flex-grow: 1;
    padding: 6px 6px;
}

/* ส่วนของคำอธิบาย  */
.description-container {
    position: relative;
    overflow: hidden;
}

.description {
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 6em;
    color: #444;
    white-space: pre-line;
    overflow: hidden;
    padding: 0 !important;
    margin: 0;
}

/* ปุ่ม "แสดงเพิ่ม" แบบไม่มีจุดไข่ปลา */
/* แก้ไขในไฟล์ CSS เดิมของคุณ */

.read-more-btn {
    display: none;
    position: absolute;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, transparent, var(--bg-card) 50%) !important;
    padding: 0 2px 0 20px;
    background: #000;
    color: #007bff;
    font-size: 0.85rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    line-height: 1.5;
}

/* เมื่อขยายแล้ว */
.description.expanded+.read-more-btn {
    position: static;
    display: inline-block;
    background: none !important;
    color: #007bff;
    padding: 0;
    margin-left: 2px;
    margin-bottom: 10px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    color: #007bff;
    font-size: 0.85rem;
    font-weight: bold;
    text-decoration: none;
}

/* สไตล์ปุ่มเล่นบน YouTube (พื้นฐาน) */
.yt-play-button {
    position: absolute;
    background-color: #ff0000;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 40px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    z-index: 10;
}

/* สไตล์เมื่อสถานะถูกลบ (สีเทา) */
.yt-play-button.deleted {
    background-color: #888888; /* เปลี่ยนเป็นสีเทา */
    cursor: default;
    pointer-events: none; /* ทำให้กดไม่ได้ */
    box-shadow: none;      /* เอาเงาออกเพื่อให้ดูแบนลง (สื่อถึงการปิดใช้งาน) */
}

.yt-play-button:active:not(.deleted) {
    transform: scale(0.8);
    background-color: #cc0000;
}

.yt-play-button .material-symbols-outlined {
    font-size: 1rem;
}

.video-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.8);
}

/* --- ส่วน Placeholder เมื่อไม่มีรูปปก --- */
.no-cover-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffebeb 0%, #f0f2f5 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #cc0000;
    gap: 4px;
}

.no-cover-fallback .material-symbols-outlined {
    font-size: 2.5rem;
    /* ลดจาก 5rem */
    opacity: 0.2;
}

.no-cover-text {
    font-weight: bold;
    font-size: 0.7rem;
    opacity: 0.3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- ส่วน Uploader Profile (สไตล์ Google จิ๋ว) --- */
.uploader-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    margin: 5px 5px;
}

.up-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.up-info {
    display: flex;
    flex-direction: column;
}

.up-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #202124;
    line-height: 1.2;
}

/* สไตล์ใหม่สำหรับ จำนวนถูกใจ + โพสต์ */
.up-status {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #5f6368;
    font-size: 0.65rem;
    margin-top: 1px;
}

.up-status .material-symbols-outlined {
    font-size: 0.70rem;
    color: #1a73e8;
    font-variation-settings: 'FILL' 1;
}

.up-count {
    font-weight: bold;
}

.up-divider {
    color: #dadce0;
    margin: 0 1px;
}

.up-role-label {
    color: #5f6368;
}

/* เอฟเฟกต์เมื่อเอาเมาส์วางปุ่มโหวต */
.stat-badge.vote-btn:hover {
    background: #e8e8e8;
    transform: translateY(-1px);
}

.stat-badge.vote-btn:active {
    transform: scale(0.95);
}

/* สถานะเมื่อกดแล้ว (Active States) */
.stat-badge-like.liked {
    background: #e7f4e4;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.stat-badge-like.liked span {
    font-variation-settings: 'FILL' 1;
}

.stat-badge.liked #like-icon {
    font-variation-settings: 'FILL' 1;
}

.stat-badge-like.disliked {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.stat-badge-like.disliked span {
    font-variation-settings: 'FILL' 1;
}

.stat-badge.disliked #dislike-icon {
    font-variation-settings: 'FILL' 1;
}

/* คอนเทนเนอร์หลัก */
.status-options-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* ตัวกรอบของแต่ละตัวเลือก */
.status-item-card {
    display: flex;
    align-items: center;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* เอฟเฟกต์เมื่อเอาเมาส์ไปวาง */
.status-item-card:hover {
    border-color: #007bff;
    background-color: #fcfcfc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* เมื่อรายการนั้นถูกเลือก (ใช้ :has ตรวจสอบ input ข้างใน) */
.status-item-card:has(input:checked) {
    border-color: #007bff;
    border-width: 2px;
    background-color: #f0f7ff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

/* ปรับแต่งจุด Radio */
.status-item-card input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0 15px 0 0;
    accent-color: #007bff;
    cursor: pointer;
}

/* ข้อความข้างในกรอบ */
.status-label-text {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}


/* จัดการกลุ่มปุ่มกด */
.modal-content div[style*="display:flex"] {
    margin-top: 24px !important;
    padding-top: 15px;
    border-top: 1px solid #eee;
}


/* ปุ่มยกเลิก (สีเทา) */
.btn-cancel {
    background-color: #f1f3f4;
    color: #5f6368;
}

.btn-cancel:hover {
    background-color: #e8eaed;
    color: #3c4043;
}

.btn-confirm {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    background: #ff0000;
    color: #fff;
    cursor: pointer;
}

.btn-cancel{
    flex:1; 
    padding:8px; 
    border:1px solid #ccc; 
    border-radius:4px; 
    background:#eee; 
    cursor:pointer;
}

.bookmark-btn.bookmarked {
    color: #ff9800;
    background-color: rgba(255, 152, 0, 0.1);
    border-color: #ff9800;
}

/* ตกแต่งปุ่ม Bookmark พื้นฐาน */
.bookmark-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.reaction-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin: 2px 0;
}

.vote-btn {
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 8px;
    transition: all 0.2s;
    user-select: none;
}

.dropdown-item {
    color: var(--text-main) !important;
    padding: 8px 12px;
    display: block;
    text-decoration: none;
}

.dropdown-item:hover {
    background-color: var(--hover-color) !important;
}

.dropdown-item.delete {
    color: #ff5252 !important;
}

/* ส่วนหัวของ Accordion */
.ep-header {
    background: var(--bg-secondary, #f8f9fa);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.8rem;
    color: #333;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

/* เอฟเฟกต์ตอน Hover */
.ep-header:hover {
    background-color: #f0f2f5;
}

/* สไตล์ของ Icon (ลูกศร) */
.ep-icon {
    font-size: 1.2rem !important;
    transition: transform 0.3s ease;
    color: #666;
}

/* เมื่อ Accordion เปิดอยู่ (Active) ให้สีหัวข้อเปลี่ยน */
.ep-list.active+.ep-header,
.ep-accordion:has(.ep-list.active) .ep-header {
    background-color: #e7f3ff;
}

/* ปรับแต่ง ep-accordion เพิ่มเติมให้ดูมีมิติ */
.ep-accordion {
    margin-bottom: 8px;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.ep-accordion:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ซ่อนรายการตอนเป็นค่าเริ่มต้น */
/* --- ส่วนของ Accordion (หัวใจหลักที่ทำให้เปิด-ปิดได้) --- */
.ep-list {
    display: none;
    flex-direction: column;
    padding: 8px;
    gap: 6px;
    background: var(--bg-primary, #fff);
}

/* เมื่อมี class active ให้แสดงผล */
.ep-list.active {
    display: flex !important;
}

.ep-header {
    background: var(--bg-secondary, #f8f9fa);
    padding: 6px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    font-size: 0.8rem;
    transition: background-color 0.2s;
    user-select: none;
}

.ep-header:hover {
    background-color: #f0f2f5;
}

/* --- ส่วนการตัดคำ ep.title ให้เป็น ... --- */
.ep-wrap {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    transition: all 0.2s ease;
}

.ep-wrap:hover {
    border-color: #007bff;
}

.ep-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    background: #ffffff;
    width: 100%;
    box-sizing: border-box;
}

.ep-item:hover {
    background: #fcfdfe;
}

/* 2. ส่วนห่อหุ้มชื่อและสถานะ: ต้องอนุญาตให้หดตัว (min-width: 0) */
.ep-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    width: 0;
}

/* เลขตอน (strong) */
.ep-info strong {
    font-size: 0.8rem;
    color: #888;
    font-weight: 600;
    min-width: 45px;
}

/* ชื่อตอน (title) */
.ep-title {
    font-size: 0.7rem;
    color: #333;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 3. ปรับสถานะ (Meta Badge) ให้ดูเป็นป้าย */
.ep-meta {
    flex-shrink: 0;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f0f2f5;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ปรับแต่งไอคอนเล่น */
.btn-play-ep {
    flex-shrink: 0;
    margin-left: 12px;
    color: #007bff;
    font-size: 1.5rem !important;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-play-ep:hover {
    opacity: 1;
    transform: scale(1.1);
}

.upload-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: #007bff;
    color: #fff;
    padding: 4px 10px;
    border-radius: 40px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.75rem;
    z-index: 10;
}

.upload-play-button:active {
    transform: translate(-50%, -50%) scale(0.98);
    background-color: #0056b3;
    transition: transform 0.1s ease;
}

.btn-play-ep {
    color: #007bff;
    cursor: pointer;
    font-size: 1.4rem !important;
    flex-shrink: 0;
}

/* --- Desktop Layout: Video on Top, Details Below --- */
@media (min-width: 1024px) {
    .explorer-card {
        max-width: 1000px;
        width: auto;
        margin: 40px auto !important;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }

    /* 3. ปรับปรุงส่วน Video Area (ลดความสูงลง) */
    .video-area {
        width: 100%;
        height: 500px;
        background: #000;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .video-area img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* 4. จัดการส่วนรายละเอียด (ด้านล่าง) */
    .details-padding {
        padding: 0px 20px;
    }

    .novel-title {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }

    /* 5. ปรับแต่งแถบสถิติให้ดูเป็นระเบียบ */
    .stats-bar {
        justify-content: flex-start;
        gap: 10px;
        padding: 4px 0;
        border-bottom: 1px solid #eee;
        margin-bottom: 10px;
    }

    /* 6. ปรับแต่งส่วนโปรไฟล์ผู้โพสต์ด้านล่าง */
    .uploader-profile {
        margin: 20px 10px 10px;
        padding: 15px;
        background: var(--card-bg, #f9f9f9);
        border-radius: 12px;
    }

    .view-novel-card .explorer-content {
        display: flex;
        flex-direction: column;
        overflow: visible !important;
    }

    .dropdown-menu {
        z-index: 9999 !important;
    }

    .novel-comment-card {
        margin-bottom: 150px !important;
    }

}

/* --- Dark mode สำหรับ uploader-profile --- */
[data-theme="dark"] .up-name {
    color: var(--text-main);
}

[data-theme="dark"] .up-status {
    color: var(--text-muted);
}

/* --- Dark mode สำหรับ comment section --- */
[data-theme="dark"] .review-item .review-header span,
[data-theme="dark"] .review-item .review-text {
    color: var(--text-main) !important;
}

[data-theme="dark"] .review-item .review-actions {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .review-item .btn-comment-like,
[data-theme="dark"] .review-item .btn-comment-dislike {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .reply-item {
    border-left-color: #444 !important;
}
/* === Episode Progress Bar === */
.ep-progress {
    height: 4px;
    background: #e9ecef;
}

.ep-progress .progress-bar {
    height: 4px;
    background: #007bff;
    transition: width 0.3s ease;
}

/* === Alert Subscribed (notification button orange) === */
.alert-subscribed,
.alert-subscribed .material-symbols-outlined {
    color: #ff6600 !important;
}
