/* =========================================================
 * DocTruyenHD Modern UI Refresh (Light + Dark, Responsive)
 * Note: Intentionally excludes #footer and Page 18 SEO blocks.
 * ========================================================= */

:root {
    --mauchudao: #ff4d6d;
    --mauchudao-hover: #e11d48;
    --mm-violet: #7c3aed;
    --mm-sky: #0ea5e9;
    --mm-grad: linear-gradient(135deg, #ff4d6d 0%, #7c3aed 100%);
    --mm-card-bg: #ffffff;
    --mm-card-border: #e6ecf5;
    --mm-card-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}

/* Canvas & Base */
body,
#wrapper,
#main {
    background-color: #f4f7fb;
}

/* Header & Navigation (Midnight-Indigo Glass) */
#header,
#header .header-main,
#header #masthead,
#header.stuck,
#header .header-bg-color {
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 55%, #172554 100%) !important;
}

#header .header-main {
    border-bottom: 1px solid rgba(56, 189, 248, 0.22);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.22);
}

#header #logo a {
    display: inline-flex;
    align-items: center;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.25));
    transition: transform .18s ease, filter .18s ease;
}

#header #logo a:hover {
    transform: translateY(-1px);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.4));
}

#header #mm-dark-toggle .mm-icon-sun { display: none !important; }
html.mm-dark #header #mm-dark-toggle .mm-icon-moon { display: none !important; }
html.mm-dark #header #mm-dark-toggle .mm-icon-sun { display: block !important; }

#header .header-nav {
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

#header .header-nav > li > a {
    color: #f1f5f9 !important;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 0.15px;
    white-space: nowrap;
    transition: color .18s ease;
}

#header .header-nav > li:not(.mm-nav-ai-cta) > a:hover,
#header .header-nav > li.current-menu-item:not(.mm-nav-ai-cta) > a,
#header .header-nav > li.current-menu-parent:not(.mm-nav-ai-cta) > a {
    color: #38bdf8 !important;
}

#header .header-nav > li:not(.mm-nav-ai-cta) > a:hover::before,
#header .header-nav > li.current-menu-item:not(.mm-nav-ai-cta) > a::before,
#header .header-nav > li.current-menu-parent:not(.mm-nav-ai-cta) > a::before {
    background-color: #38bdf8 !important;
    border-radius: 999px;
}

/* Interactive Story Nav Pill (Refined & Subtle) */
#header .header-nav > li.mm-nav-ai-cta > a {
    background: rgba(255, 77, 109, 0.16) !important;
    border: 1px solid rgba(255, 77, 109, 0.55);
    color: #ffd6de !important;
    border-radius: 999px !important;
    padding: 5px 12px !important;
    line-height: 1.2 !important;
    box-shadow: none;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

#header .header-nav > li.mm-nav-ai-cta > a::before {
    display: none !important;
}

#header .header-nav > li.mm-nav-ai-cta > a:hover,
#header .header-nav > li.mm-nav-ai-cta.current-menu-item > a {
    background: rgba(255, 77, 109, 0.28) !important;
    border-color: #ff4d6d;
    color: #ffffff !important;
    box-shadow: none;
}

.off-canvas .mm-nav-ai-cta > a,
.mobile-sidebar .mm-nav-ai-cta > a {
    background: rgba(255, 77, 109, 0.14) !important;
    border: 1px solid rgba(255, 77, 109, 0.45);
    color: #ff4d6d !important;
    border-radius: 10px;
    margin: 6px 12px;
    font-weight: 700;
}

/* Dropdown Sub-menu */
#header .sub-menu,
#header .nav-dropdown {
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18) !important;
    border: 1px solid #e2e8f0 !important;
}

#header .sub-menu > li > a {
    border-radius: 8px;
    margin: 2px 6px !important;
    transition: background .15s ease, color .15s ease;
}

#header .sub-menu > li > a:hover {
    background: #fff1f2 !important;
    color: var(--mauchudao) !important;
}

/* Header Search Input */
#header .header-search-form .search-field,
#header .simple-acf-search-form .field-search,
#header input[type="search"] {
    width: 195px !important;
    height: 36px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.14) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
    padding: 0 36px 0 14px !important;
    font-size: 13px !important;
    transition: background .18s ease, border-color .18s ease, width .18s ease;
}

#header .simple-acf-search-form button {
    color: #e2e8f0 !important;
    height: 36px;
}

#header .header-search-form .search-field::placeholder,
#header .simple-acf-search-form .field-search::placeholder,
#header input[type="search"]::placeholder {
    color: rgba(241, 245, 249, 0.78) !important;
}

#header .header-search-form .search-field:focus,
#header .simple-acf-search-form .field-search:focus,
#header input[type="search"]:focus {
    background: rgba(255, 255, 255, 0.22) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

@media (max-width: 1180px) and (min-width: 850px) {
    #header .simple-acf-search-form .field-search {
        width: 165px !important;
    }
    #header .header-nav > li > a {
        font-size: 12px;
    }
}

/* Homepage Interactive Story Spotlight (under Newest Story List) */
.story-newest-list + .mm-ai-spotlight {
    margin-top: 16px;
}

.mm-ai-spotlight {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    border-radius: 16px;
    background: linear-gradient(120deg, #1e1b4b 0%, #312e81 52%, #581c87 100%);
    color: #ffffff;
    box-shadow: 0 10px 28px rgba(49, 46, 129, 0.22);
    border: 1px solid rgba(167, 139, 250, 0.28);
}

.mm-ai-spotlight::before {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 77, 109, 0.38) 0%, rgba(124, 58, 237, 0) 70%);
    pointer-events: none;
}

.mm-ai-spot-main {
    position: relative;
    z-index: 1;
    min-width: 0;
    flex: 1;
}

.mm-ai-spot-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.mm-ai-spot-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    color: #fde047;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.mm-ai-spot-count {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.18);
    color: #bae6fd;
    font-size: 11px;
    font-weight: 700;
}

.mm-ai-spot-title {
    margin: 0 0 4px !important;
    font-size: 19px;
    font-weight: 800;
    color: #ffffff !important;
    line-height: 1.3;
}

.mm-ai-spot-desc {
    margin: 0;
    font-size: 13px;
    color: #e0e7ff;
    line-height: 1.45;
}

.mm-ai-spot-actions {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.mm-ai-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff4d6d 0%, #f97316 100%);
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none !important;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(255, 77, 109, 0.4);
    transition: transform .18s ease, box-shadow .18s ease;
}

.mm-ai-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(249, 115, 22, 0.45);
    color: #ffffff !important;
}

/* Section Headings */
.title-home .section-title-normal {
    border-bottom: 1px solid #e2e8f0 !important;
    padding-bottom: 6px;
    margin-bottom: 18px !important;
}

.title-home .section-title-main {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #0f172a !important;
    font-weight: 800 !important;
    letter-spacing: 0.3px;
    padding-left: 12px;
}

.title-home .section-title-main::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    border-radius: 999px;
    background: var(--mm-grad);
}

/* Story Cards (Hot + Genre Grids + Swiper) */
.movie_popular .movie-item.item-7 .movie-poster,
.popular-story-swiper .movie-item.item-7 .movie-poster {
    border-radius: 12px !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14) !important;
    transition: transform .22s ease, box-shadow .22s ease !important;
}

.movie_popular .movie-item.item-7:hover .movie-poster,
.popular-story-swiper .movie-item.item-7:hover .movie-poster {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22) !important;
}

.movie_popular .movie-item.item-7 .movie-poster img,
.popular-story-swiper .movie-item.item-7 .movie-poster img {
    transition: transform .3s ease;
}

.movie_popular .movie-item.item-7:hover .movie-poster img,
.popular-story-swiper .movie-item.item-7:hover .movie-poster img {
    transform: scale(1.04);
}

.movie_popular .movie-item.item-7 .movie-episode-last a,
.popular-story-swiper .movie-item.item-7 .movie-episode-last a {
    background: linear-gradient(135deg, #ff4d6d 0%, #e11d48 100%) !important;
    border-radius: 999px !important;
    padding: 3px 9px !important;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.35) !important;
}

.movie-poster .badge-full-story {
    background: #10b981 !important;
    border-radius: 999px !important;
    padding: 3px 8px !important;
}

.popular-story-swiper .pss-btn {
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.24);
}

/* Saved / Reading Block */
.saved-story-block {
    background: var(--mm-card-bg);
    border: 1px solid var(--mm-card-border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--mm-card-shadow);
}

.saved-story-block .saved-tabs-head {
    border-bottom: 1px solid #e2e8f0 !important;
}

.saved-story-block .saved-tab-btn {
    border-radius: 999px !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.saved-story-block .saved-tab-btn.active {
    background: var(--mm-grad) !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

.saved-story-card .card-cover {
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16) !important;
}

/* Newest Updated Story Table */
.story-newest-list {
    background: var(--mm-card-bg) !important;
    border: 1px solid var(--mm-card-border) !important;
    border-radius: 14px !important;
    box-shadow: var(--mm-card-shadow) !important;
    padding: 0 14px;
}

.story-list-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    margin: 0 -14px;
    padding: 11px 14px !important;
}

.story-list-row {
    border-bottom-color: #f1f5f9 !important;
    transition: background .14s ease;
}

.story-list-row:not(.story-list-header):hover {
    background: #fff1f2 !important;
}

.story-list-row .srow-title-link:hover {
    color: var(--mauchudao) !important;
    text-decoration: none !important;
}

.story-list-row .srow-badge {
    border-radius: 999px !important;
    padding: 1px 8px !important;
}

.story-list-row .srow-badge-new {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border-color: #a7f3d0 !important;
}

.story-list-row .srow-chapter a {
    color: #0284c7 !important;
    font-weight: 600;
}

/* Top Ranking Widget */
.block-ranking {
    background: var(--mm-card-bg) !important;
    border: 1px solid var(--mm-card-border) !important;
    border-radius: 14px !important;
    box-shadow: var(--mm-card-shadow) !important;
}

.block-ranking-head::after {
    background: var(--mm-grad) !important;
    height: 3px !important;
    border-radius: 999px;
}

.rank-tabs {
    background: #f1f5f9;
    padding: 4px;
    border-radius: 999px;
    border-bottom: 0 !important;
    gap: 4px !important;
}

.rank-tab {
    border-radius: 999px !important;
    padding: 7px 10px !important;
    font-size: 12px !important;
}

.rank-tab.active {
    background: var(--mm-grad) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(255, 77, 109, 0.3);
}

.rank-num-1 { background: linear-gradient(135deg, #ff4d6d, #f97316) !important; }
.rank-num-2 { background: linear-gradient(135deg, #10b981, #06b6d4) !important; }
.rank-num-3 { background: linear-gradient(135deg, #3b82f6, #7c3aed) !important; }

.rank-thumb {
    border-radius: 8px !important;
}

/* Reader / Button Hover Refinements */
.btn-read-story,
.chapter-nav-bar .nav-btn {
    border-radius: 999px !important;
}

.btn-read-story:hover,
.chapter-nav-bar .nav-btn:hover {
    background: var(--mauchudao-hover) !important;
}

/* Floating Back-to-Top Button */
.mm-back-top {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 990;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--mm-grad);
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
    padding: 0;
    margin: 0;
}

.mm-back-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mm-back-top:hover {
    transform: translateY(-2px);
}

/* Dark Mode Alignment (preserving #footer) */
html.mm-dark,
html.mm-dark body,
html.mm-dark #wrapper,
html.mm-dark #main {
    background: #0b1120 !important;
}

html.mm-dark .saved-story-block,
html.mm-dark .story-newest-list,
html.mm-dark .block-ranking {
    background: #111827 !important;
    border-color: #1f2937 !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35) !important;
}

html.mm-dark .story-list-header {
    background: #1e293b !important;
    border-bottom-color: #334155 !important;
    color: #e2e8f0 !important;
}

html.mm-dark .story-list-row {
    border-bottom-color: #1f2937 !important;
}

html.mm-dark .story-list-row:not(.story-list-header):hover {
    background: #1e293b !important;
}

html.mm-dark .story-list-row .srow-chapter a {
    color: #38bdf8 !important;
}

html.mm-dark .story-list-row .srow-badge-new {
    background: rgba(16, 185, 129, 0.16) !important;
    color: #34d399 !important;
    border-color: rgba(52, 211, 153, 0.4) !important;
}

html.mm-dark .rank-tabs {
    background: #1e293b !important;
}

html.mm-dark .rank-tab:not(.active) {
    color: #94a3b8 !important;
}

html.mm-dark .title-home .section-title-normal {
    border-bottom-color: #1f2937 !important;
}

html.mm-dark .title-home .section-title-main {
    color: #f8fafc !important;
}

html.mm-dark #header .sub-menu,
html.mm-dark #header .nav-dropdown {
    background: #111827 !important;
    border-color: #1f2937 !important;
}

html.mm-dark #header .sub-menu > li > a {
    color: #e2e8f0 !important;
}

html.mm-dark #header .sub-menu > li > a:hover {
    background: #1e293b !important;
    color: #38bdf8 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .mm-ai-spotlight {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 16px;
        gap: 12px;
    }
    .mm-ai-spot-title {
        font-size: 16px;
    }
    .mm-ai-spot-actions,
    .mm-ai-cta-btn {
        width: 100%;
    }
    .mm-back-top {
        right: 14px;
        bottom: 16px;
        width: 38px;
        height: 38px;
    }
}
