:root {
    --bg: #0a0a0a;
    --card: #141414;
    --primary: #8c52ff;
    --text: #ffffff;
    --muted: #888;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
}

.main-header {
    background: rgba(0, 0, 0, 0.9);
    height: 60px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #222;
}

.header-container {
    width: 95%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    color: var(--primary);
    font-size: 24px;
    cursor: pointer;
    margin: 0;
}

/* Header Auth Buttons */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-auth-btn {
    padding: 6px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.header-login-btn {
    background: transparent;
    color: #fff;
    border: 1px solid #555;
}

.header-login-btn:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.07);
}

.header-signup-btn {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
}

.header-signup-btn:hover {
    background: #7a42ea;
    border-color: #7a42ea;
}


.search-bar {
    background: #1a1a1a;
    display: flex;
    border-radius: 20px;
    padding: 5px 15px;
    flex: 0.5;
}

.search-bar input {
    background: none;
    border: none;
    color: #fff;
    width: 100%;
    outline: none;
}

.search-bar button {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
}

/* Responsive Grid 7 cột */
.story-grid-7 {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
    padding: 20px 0;
}

@media (max-width: 768px) {
    .story-grid-7 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Header optimizations - High specificity */
    header.main-header .search-bar {
        display: none !important;
    }

    header.main-header .auth-buttons {
        display: none !important;
    }

    header.main-header .nav-left {
        gap: 8px;
    }

    header.main-header .logo {
        font-size: 19px;
    }

    header.main-header .nav-right {
        gap: 8px;
    }
}

@media (max-width: 600px) {
    .story-grid-7 {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-header {
        padding: 0 10px;
    }
}

.story-card {
    background: var(--card);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.3s;
}

.story-card:hover {
    transform: scale(1.05);
}

.story-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
}

.story-card h4 {
    font-size: 13px;
    padding: 10px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    background: #222;
    border: none;
    color: #fff;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
}

.pagination button.active {
    background: var(--primary);
}

.detail-banner {
    height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.detail-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg), transparent);
}

/* Sidebar ẩn bên trái */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    /* Ẩn đi */
    width: 280px;
    height: 100%;
    background: #111;
    transition: 0.3s;
    z-index: 999;
    padding-top: 80px;
}

.sidebar.active {
    left: 0;
    /* Hiện ra khi có class active */
}

/* Hero Slider Container */
#hero-slider {
    width: 100%;
    height: 70vh;
    /* Sử dụng vh để luôn chiếm 50% chiều cao trình duyệt */
    position: relative;
    overflow: hidden;
    background: #000;
}

/* Tạo hiệu ứng mờ ảo phía sau ảnh bìa để lấp đầy khoảng trống */
.hero-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(25px) brightness(0.3);
    z-index: 0;
}

.hero-slide.active {
    opacity: 1;
    z-index: 1;
}

/* Gradient Overlay - Làm mờ bên trái để hiển thị text rõ hơn */
.hero-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, #050505 10%, rgba(5, 5, 5, 0.7) 40%, transparent 60%),
        linear-gradient(to top, #050505 0%, transparent 40%);
    z-index: 1;
}

/* Ảnh chính lấy nét nằm ở bên phải gờ lên trên lớp blur */
.hero-bg-sharp {
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    width: 45%;
    height: 80%;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    box-shadow: -10px 10px 30px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

/* Container chứa cả Nút và Dots - Luôn nằm sát đáy banner */
.hero-controls-row {
    position: absolute;
    bottom: 3%;
    left: 5%;
    display: flex;
    align-items: center;
    gap: 2.5rem;
    z-index: 100;
}

.btn-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hero-dots-container {
    display: flex;
    align-items: center;
    /* Căn dots nhỏ thẳng hàng với tâm nút tròn to */
    gap: 10px;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dot.active {
    width: 35px;
    /* Chiều dài gạch tím */
    background: #8c52ff;
    border-radius: 10px;
}

/* Fix lỗi chồng chữ và nhấp nháy */
.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    /* Ẩn hoàn toàn khi không active */
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
    background-size: cover;
    background-position: center right;
    /* Căn lề phải để tránh trùm lên chữ */
    background-repeat: no-repeat;
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 50rem;

    /* Xóa các thuộc tính position cũ nếu nó gây xung đột */
    margin: 0;
}

.hero-content h1 {
    font-size: 3.5rem;
    /* Sử dụng rem thay vì px cho tiêu đề */
    margin: 0.5rem 0;
    font-weight: 800;
}

.hero-tags {
    margin-bottom: 1rem;
}

.tag {
    background: var(--primary);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.tag.info {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

/* Nút Play bắt mắt */
.btn-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    border-radius: 2rem;
    font-weight: bold;
    text-decoration: none;
    transition: 0.3s;
    border: none;
    cursor: pointer;
    font-size: 18px;
}

.btn-play:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

#app {
    display: flex;
    flex-direction: column;
    /* Các thành phần con xếp chồng lên nhau */
    min-height: 100vh;
}

.container {
    position: relative;
    z-index: 5;
    background: var(--bg);
    /* Đảm bảo nền không bị trong suốt đè lên banner */
    margin-top: 0;
    /* Loại bỏ margin âm nếu có */
    padding: 2rem 2.5%;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Layout nội dung banner - căn xuống góc dưới trái */
.hero-content {
    position: absolute;
    /* Đặt tuyệt đối trong slide */
    bottom: 16%;
    /* Cách chân một chút để không bị nút đè */
    left: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0 2rem 0 5%;
    max-width: 55%;
    /* Giới hạn chiều rộng để không lấn sang ảnh */
}

/* Hàng 1: Meta Tags (Thể loại, Năm, Lượt xem) */
.meta-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #ccc;
}

.badge-blue {
    background: #3d5afe;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: bold;
    color: #fff;
}

/* Hàng 2: Tên truyện */
.hero-title {
    font-size: 2.2rem;
    /* Reduced from 3rem */
    margin: 0;
    font-weight: 900;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    line-height: 1.1;
}

/* Hàng 3: Tóm tắt */
.hero-description {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* Hàng 4: Tác giả */
.hero-authors {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.author-tag {
    background: rgba(140, 82, 255, 0.25);
    border: 1px solid var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    color: #d1b9ff;
    font-size: 0.85rem;
}

/* 4. Action Buttons (Tròn) */
.hero-actions-row {
    display: flex;
    align-items: center;
    /* Căn giữa tất cả các phần tử con theo trục dọc */
    gap: 2rem;
    /* Khoảng cách giữa cụm nút và cụm dots */
    margin-top: 1.5rem;
}

.circle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: 0.3s;
}

.circle-btn.play {
    background: #8c52ff;
    color: #fff;
}

.circle-btn.save {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid #444;
}

.circle-btn:hover {
    transform: scale(1.1);
}

/* 5. Phân trang Dots (Dấu chấm) */
.hero-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: 0.3s;
}

.dot.active {
    width: 30px;
    /* Dấu chấm đang chọn sẽ dài ra */
    background: #8c52ff;
    border-radius: 10px;
}

.admin-tools {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-edit {
    background: #ffa502;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-delete {
    background: #ff4757;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #141414;
}

.admin-table th,
.admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.badge-success {
    color: #2ecc71;
    font-weight: bold;
}

.badge-warning {
    color: #f1c40f;
    font-weight: bold;
}

.btn-approve {
    background: #2ecc71;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 5px;
}

.btn-edit-small {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 5px;
}

.btn-delete-small {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* style.css */

.story-text-format {
    /* GIỮ NGUYÊN ĐỊNH DẠNG XUỐNG DÒNG */
    white-space: pre-wrap;

    /* Tối ưu cho việc đọc truyện dài */
    line-height: 1.8;
    font-size: 1.2rem;
    color: #e0e0e0;
    max-width: 800px;
    /* Giới hạn độ rộng để mắt không bị mỏi */
    margin: 40px auto;
    padding: 0 20px;
    text-align: left;
    word-wrap: break-word;
    /* Tránh tràn chữ khi zoom */
}

.reading-header {
    text-align: center;
    padding: 50px 0;
    background: linear-gradient(to bottom, #1a1a1a, #0a0a0a);
}

.chapter-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 50px 0;
}

/* Style dành riêng cho Form quản trị */
.admin-form-container {
    max-width: 1000px;
    margin: 40px auto;
    background: #141414;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #222;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.admin-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 12px 15px;
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    margin-bottom: 20px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    border-color: var(--primary);
    outline: none;
    background: #252525;
}

.admin-form .grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

/* Tùy chỉnh riêng cho Textarea nội dung truyện */
.admin-form textarea[name="content"] {
    min-height: 450px;
    line-height: 1.6;
    font-size: 1rem;
    resize: vertical;
    /* Cho phép kéo dài chiều cao */
}

.admin-form input[type="file"] {
    background: #111;
    padding: 10px;
    border: 1px dashed #444;
    width: 100%;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.btn-cancel {
    background: #333;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.btn-cancel:hover {
    background: #444;
}

/* style.css - Bổ sung cuối file */
.fb-style-cover-wrapper {
    position: relative;
    width: 200px;
    /* Độ rộng ảnh bìa */
    height: 300px;
    /* Chiều cao ảnh bìa */
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid #333;
    transition: all 0.3s;
}

.fb-style-cover-wrapper:hover {
    border-color: var(--primary);
}

.fb-style-cover-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ảnh phủ kín không bị méo */
}

.fb-style-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.fb-style-cover-wrapper:hover .fb-style-overlay {
    opacity: 1;
}

.fb-style-overlay i {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* style.css - Bổ sung cuối file */

.images-management-zone {
    position: relative;
    width: 100%;
    height: 350px;
    /* Chiều cao vùng quản lý ảnh */
    margin-bottom: 50px;
}

/* Style cho ảnh nền (Backdrop) */
.backdrop-update-wrapper {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px dashed #444;
}

.backdrop-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.backdrop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: 0.3s;
}

.backdrop-update-wrapper:hover .backdrop-overlay {
    opacity: 1;
}

/* Style cho ảnh bìa (Cover) - Nằm đè lên */
.cover-update-wrapper {
    position: absolute;
    bottom: -30px;
    /* Nhô ra ngoài ảnh nền */
    left: 50px;
    width: 150px;
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 4px solid #141414;
    /* Màu nền form */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
    font-size: 2rem;
}

.cover-update-wrapper:hover .cover-overlay {
    opacity: 1;
}

.story-full-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
}

/* --- LEFT SIDEBAR --- */
.left-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100vh;
    background: #111;
    /* Dark theme */
    color: #eee;
    z-index: 10000;
    overflow-y: auto;
    transition: left 0.3s ease;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.8);
    font-family: 'Inter', sans-serif;
}

.left-sidebar.active {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Headings */
.sidebar-heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: #888;
    padding: 10px 20px;
    margin: 20px 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: transparent;
}

.left-sidebar h3:first-child {
    margin-top: 0;
}

/* Authentication Buttons */
.sidebar-auth {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid #222;
}

.btn-sidebar-outline {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.btn-sidebar-outline:hover {
    background: rgba(140, 82, 255, 0.1);
}

.btn-sidebar-filled {
    flex: 1;
    padding: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.btn-sidebar-filled:hover {
    background: #7a42ea;
}

/* List Items */
.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-list li a {
    display: block;
    padding: 12px 20px;
    color: #ccc;
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-list li a:hover {
    background: #1a1a1a;
    color: #fff;
    border-left: 3px solid var(--primary);
}

/* --- PROFILE DROPDOWN --- */
.profile-dropdown {
    position: absolute;
    min-width: 240px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
    z-index: 99999;
    overflow: hidden;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: #111;
}

.profile-avatar-big {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-name {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.profile-role {
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.profile-email {
    font-size: 0.78rem;
    color: #888;
    margin-top: 3px;
    word-break: break-all;
}

.profile-dropdown-divider {
    height: 1px;
    background: #2a2a2a;
    margin: 0;
}

.profile-dropdown-menu {
    padding: 8px 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 20px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
    font-family: 'Inter', sans-serif;
}

.profile-menu-item:hover {
    background: #252525;
    color: #fff;
}

.profile-menu-item.profile-logout {
    color: #ff6b6b;
}

.profile-menu-item.profile-logout:hover {
    background: rgba(255, 75, 75, 0.1);
    color: #ff4d4d;
}

.user-icon {
    font-size: 1.5rem;
    color: #ccc;
    transition: color 0.2s;
}

.user-icon:hover {
    color: var(--primary);
}

/* ========================================= */
/* --- NEW HOME PAGE SECTIONS STYLES --- */
/* ========================================= */

/* 1. TRENDING NOW LIST */
.trending-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trending-item {
    display: flex;
    align-items: center;
    background: var(--card);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    border-left: 4px solid transparent;
    gap: 15px;
}

.trending-item:hover {
    background: #1a1a1a;
    border-color: var(--primary);
    transform: translateX(5px);
}

.trending-rank {
    font-size: 1.5rem;
    font-weight: 800;
    color: #555;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.trending-item:nth-child(1) .trending-rank,
.trending-item:nth-child(2) .trending-rank,
.trending-item:nth-child(3) .trending-rank {
    color: var(--primary);
}

.trending-img {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.trending-info {
    flex: 1;
    min-width: 0;
}

.trending-info h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #fff;
}

.trending-meta {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: #888;
}

/* 2. RECOMMENDED CAROUSEL */
.recommended-carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.recommended-carousel::-webkit-scrollbar {
    display: none;
}

.recommended-card {
    min-width: 180px;
    max-width: 180px;
    flex-shrink: 0;
    position: relative;
    background: transparent;
}

.recommended-card img {
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: 0.3s;
}

.recommended-card:hover img {
    transform: scale(1.03);
}

.recommended-card h4 {
    margin: 10px 0 0 0;
    font-size: 1rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rec-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 35px;
    /* above the title */
    background: rgba(140, 82, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
    border-radius: 8px;
    font-size: 2.5rem;
    color: #fff;
    pointer-events: none;
}

.recommended-card:hover .rec-overlay {
    opacity: 1;
}

/* 3. COMPLETED SERIES BADGE */
.completed-story-card {
    position: relative;
}

.badge-full {
    position: absolute;
    top: -5px;
    left: -5px;
    background: #ffca28;
    color: #000;
    padding: 4px 10px;
    transform: rotate(-10deg);
}

/* New Detail Header Styles */
.detail-header {
    position: relative;
    background-size: cover;
    background-position: center;
    min-height: 500px;
    display: flex;
    align-items: flex-end;
    padding: 60px 8%;
    overflow: hidden;
}

.header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, #000 0%, rgba(0, 0, 0, 0.7) 40%, transparent 100%),
        linear-gradient(to top, #000 0%, transparent 40%);
    z-index: 1;
}

.header-content-flex {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 40px;
    align-items: flex-end;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.header-cover-side {
    flex-shrink: 0;
}

.detail-main-cover {
    width: 420px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.header-info-side {
    flex: 1;
    padding-bottom: 10px;
}

.hero-meta-info {
    font-size: 1.1rem;
    color: #bbb;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.meta-divider {
    opacity: 0.3;
}

/* Default Detail Page Layout (Side-by-side for Desktop/Tablet) */
.detail-page .content-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.main-content-area {
    flex: 1;
    min-width: 0;
}

.recommend-sidebar {
    width: 320px;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .detail-main-cover {
        width: 350px;
    }
}

/* Mobile Detail Page & Hero Fixes */
@media (max-width: 768px) {

    /* Hero Slider Responsive Fixes */
    #hero-slider {
        height: auto !important;
        min-height: 400px !important;
    }

    .hero-slide {
        flex-direction: column !important;
        height: auto !important;
        padding: 20px !important;
        display: flex !important;
    }

    .hero-bg-sharp {
        position: relative !important;
        width: 100% !important;
        height: 220px !important;
        min-height: 220px !important;
        order: -1 !important;
        background-size: cover !important;
        background-position: center !important;
        border-radius: 12px !important;
        margin-bottom: 20px !important;
    }

    .hero-content {
        width: 100% !important;
        padding: 0 !important;
        text-align: center !important;
    }

    /* Detail Page Header Mobile */
    .detail-header {
        padding: 40px 20px !important;
        min-height: auto !important;
        align-items: center !important;
    }

    .header-content-flex {
        flex-direction: column !important;
        align-items: center !important;
        gap: 20px !important;
        text-align: center !important;
    }

    .detail-main-cover {
        width: 300px !important;
        aspect-ratio: 4 / 3 !important;
        height: auto !important;
    }

    .header-info-side {
        padding-bottom: 0 !important;
    }

    .hero-meta-info {
        justify-content: center !important;
    }

    /* Fixing generic spacing */
    .container {
        padding: 0 15px !important;
    }

    .section-header h2 {
        font-size: 1.2rem !important;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Phone-specific Detail Page Stacking */
@media (max-width: 600px) {
    .explore-header h1 {
        font-size: 1.6rem !important;
        line-height: 1.2;
    }

    #catFilter {
        width: 100%;
    }

    .detail-page .content-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 30px !important;
    }

    .main-content-area {
        order: 1 !important;
        /* Story content on top */
    }

    .recommend-sidebar {
        order: 2 !important;
        /* Recommended sidebar at bottom */
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Fix for very small screens */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem !important;
    }

    .badge-blue {
        font-size: 10px;
        padding: 2px 8px;
    }

    .detail-main-cover {
        width: 240px !important;
    }
}