/* Story Module Styles - Cleaned & Optimized */
/*
Theme Name: ztruyen
Version: 2.5.6
*/

.single-post h1.fw-black {
    color: var(--bs-gray-100);
}

/* --- BOOTSTRAP RATIO CUSTOM FIX --- */
.ratio-2x3 {
    --bs-aspect-ratio: 150%; /* (3 / 2) * 100% = 150% */
}

/* --- SINGLE STORY COVER --- */
.single-story-cover-wrapper {
    position: relative;
    border-radius: var(--td-radius);
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 4px solid #fff;
    background: #fff;
    margin: 0 auto;
}

/* Mặc định Mobile: Tỷ lệ 2:3 */
.single-story-cover-wrapper {
    aspect-ratio: 2/3;
    width: 100%;
}

/* DESKTOP (Width >= 992px): FIX cứng 300x400px theo yêu cầu */
@media (min-width: 992px) {
    .single-story-cover-wrapper {
        width: 300px;
        height: 400px;
        aspect-ratio: auto;
    }
}

/* --- BOOK COVER FALLBACK --- */
.book-cover-fallback {
    width: 100%;
    height: 100%;
    background-color: #faebd7; /* Màu be */
    border: 1px solid #e0d0b8;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    overflow: hidden;
    transition: transform 0.3s ease;
}
.ratio > .book-cover-fallback {
    position: absolute !important;
    top: 0;
    left: 0;
}

.book-cover-fallback::after {
    content: ''; position: absolute; top: 8px; left: 8px; right: 8px; bottom: 8px; border: 2px solid #fff; border-radius: 8px; pointer-events: none;
}

.book-cover-fallback span {
    font-family: 'Merriweather', serif;
    font-weight: 800;
    color: #5d4037;
    font-size: 1.25rem;
    line-height: 1.4;
    text-transform: uppercase;
    display: -webkit-box; -webkit-line-clamp: 5; line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
    z-index: 1;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
    text-decoration: none !important;
}

.book-cover-fallback-small {
    padding: 6px !important;
}
.book-cover-fallback-small::after {
    top: 4px !important;
    left: 4px !important;
    right: 4px !important;
    bottom: 4px !important;
    border-width: 1.5px !important;
    border-radius: 4px !important;
}
.book-cover-fallback-small span {
    font-size: 9px !important;
    line-height: 1.2 !important;
    -webkit-line-clamp: 4 !important;
    line-clamp: 4 !important;
    font-weight: 700 !important;
}

.group:hover .book-cover-fallback { transform: scale(1.05); }

/* Utilities specific to story rendering */
.blur-lg { filter: blur(20px); }
.scale-110 { transform: scale(1.1); }
.text-shadow { text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

/* Chapter List */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}
.chap-item {
    transition: all 0.2s;
    font-size: 0.95rem;
}

/* Reading Settings */
.bg-sepia { background-color: #f4ecd8 !important; color: #5b4636 !important; }
.reading-container { transition: background-color 0.3s, color 0.3s; }

/* Sticky Bar Auto Hide */
.reading-bar {
    transition: transform 0.3s;
}
.reading-bar.hidden {
    transform: translateY(-100%);
}

/* --- STORY TABS & ANNOUNCEMENTS STYLES --- */
.story-tabs-navigation-wrapper {
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
body.dark-mode .story-tabs-navigation-wrapper {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.story-tabs-navigation-wrapper .nav-tabs {
    gap: 20px; /* Thêm khoảng cách giữa các tab */
}

.story-tabs-navigation-wrapper .nav-tabs .nav-link {
    color: #6b7280; /* Muted gray for inactive tabs */
    border-bottom: 3px solid transparent !important;
    padding: 10px 8px !important; /* Thêm padding thay vì 0 */
    font-size: 15px;
}
body.dark-mode .story-tabs-navigation-wrapper .nav-tabs .nav-link {
    color: #9ca3af;
}

.story-tabs-navigation-wrapper .nav-tabs .nav-link.active {
    color: var(--td-primary, #8b5cf6) !important;
    border-bottom: 3px solid var(--td-primary, #8b5cf6) !important;
    font-weight: 700 !important;
}

.story-tabs-navigation-wrapper .nav-tabs .nav-link:hover {
    color: var(--td-primary, #8b5cf6);
}

/* Responsive trên mobile/tablet */
@media (max-width: 768px) {
    .story-tabs-navigation-wrapper .nav-tabs {
        gap: 8px;
    }
    .story-tabs-navigation-wrapper .nav-tabs .nav-link {
        font-size: 13px !important;
        padding: 8px 4px !important;
    }
}

/* Announcement Cards */
.ann-card {
    transition: all 0.3s ease;
    border-color: rgba(0,0,0,0.08) !important;
    background-color: #ffffff;
    color: #1f2937;
    position: relative;
    z-index: 1;
    overflow: visible;
    border-radius: 16px !important;
}

body.dark-mode .ann-card {
    border-color: rgba(255,255,255,0.08) !important;
    background-color: #18181b; /* zinc-900 */
    color: #e4e4e7;
}

/* Pinned State Gold highlights & Floating Badge */
.ann-card-pinned {
    position: relative;
    margin-top: 24px;
    border: 1.5px solid #d97706 !important;
    background-color: rgba(217, 119, 6, 0.02);
}
body.dark-mode .ann-card-pinned {
    border: 1.5px solid #f59e0b !important;
    background-color: rgba(245, 158, 11, 0.02);
}

.ann-floating-pinned {
    position: absolute;
    top: -12px;
    left: 16px;
    background-color: #ffffff;
    border: 1px solid #d97706;
    color: #d97706;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 5;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
body.dark-mode .ann-floating-pinned {
    background-color: #18181b;
    border-color: #f59e0b;
    color: #f59e0b;
}

.ann-card-pinned .ann-title {
    color: #d97706 !important;
}
body.dark-mode .ann-card-pinned .ann-title {
    color: #f59e0b !important;
}

.ann-card-normal .ann-title {
    color: var(--td-primary, #8b5cf6) !important;
}

.ann-title {
    font-size: 16px !important;
    font-weight: 700 !important;
}

/* Footer Meta uploader/date font-size */
.ann-footer-meta {
    font-size: 11px !important;
}
.ann-card-pinned .ann-footer-meta {
    color: #d97706 !important;
    font-weight: 500;
}
body.dark-mode .ann-card-pinned .ann-footer-meta {
    color: #f59e0b !important;
}
.ann-card-normal .ann-footer-meta {
    color: #6b7280 !important;
}
body.dark-mode .ann-card-normal .ann-footer-meta {
    color: #a1a1aa !important;
}

/* Badges styling */
.ann-badge-pinned {
    border-color: rgba(245, 158, 11, 0.4) !important;
    color: #d97706;
    background-color: rgba(245, 158, 11, 0.05);
    font-weight: 600;
}
body.dark-mode .ann-badge-pinned {
    color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.1);
}

.ann-badge-important {
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #ef4444;
    font-weight: 600;
    border-radius: 8px;
}
body.dark-mode .ann-badge-important {
    background-color: rgba(239, 68, 68, 0.15);
}

.ann-badge-new {
    background-color: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    color: #10b981;
    font-weight: 600;
    border-radius: 8px;
}
body.dark-mode .ann-badge-new {
    background-color: rgba(16, 185, 129, 0.15);
}

/* Reactions Buttons */
.ann-reactions .btn-reaction-btn {
    border: 1px solid rgba(0,0,0,0.12) !important;
    background-color: #f3f4f6;
    color: #4b5563;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
body.dark-mode .ann-reactions .btn-reaction-btn {
    border: 1px solid rgba(255,255,255,0.08) !important;
    background-color: #27272a; /* zinc-800 */
    color: #a1a1aa;
}

.ann-reactions .btn-reaction-btn:hover {
    background-color: #e5e7eb;
    color: #111827;
}
body.dark-mode .ann-reactions .btn-reaction-btn:hover {
    background-color: #3f3f46;
    color: #f4f4f5;
}

.ann-reactions .btn-reaction-btn.active {
    background-color: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4) !important;
    color: var(--td-primary, #8b5cf6);
}
body.dark-mode .ann-reactions .btn-reaction-btn.active {
    background-color: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5) !important;
    color: #a78bfa;
}

/* Form switch custom override to look modern */
.form-check-input:checked {
    background-color: var(--td-primary, #8b5cf6);
    border-color: var(--td-primary, #8b5cf6);
}

/* Reset thụt lề dòng (text-indent) cho nội dung thông báo */
.ann-content, .ann-content p {
    text-indent: 0 !important;
}


