/*
 * FINAL MODERN THEME - REFINED MINIMALISM (ARCHITECTURAL)
 * Design by: Gemini
 * Date: 2025-09-26 (Refactored)
 * Based on user feedback for more structure and detail.
 *
 * --- "MONOCHROMATIC ELEGANCE" COLOR PALETTE ---
 * Background: #ffffff (Pure White)
 * Primary Text: #1c1c1c (Near Black)
 * Secondary Text: #767676 (Medium Gray)
 * Subtle Borders/Lines: #eaeaea (Light Gray)
 * Hover/Focus Border: #cccccc (Slightly Darker Gray)
 */

/* === 1. GLOBAL RESET & TYPOGRAPHIC SETUP === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::selection {
    background: #1c1c1c;
    color: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: #ffffff;
    color: #1c1c1c;
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: #1c1c1c;
    transition: color 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

a:hover {
    color: #1c1c1c;
    opacity: 0.65;
}

/* === 2. LAYOUT & CONTAINER === */
.container {
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* === 3. HEADER & NAVIGATION (REFINED) === */
.header {
    background-color: #ffffff;
    padding: 16px 0;
    border-bottom: 1px solid #eaeaea;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav {
    flex-grow: 1;
    margin: 0 40px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    list-style: none;
    margin: 0; padding: 0;
    border-left: 1px solid #eaeaea;
    border-top: 1px solid #eaeaea;
}

.grid-item {
    position: relative;
    border-right: 1px solid #eaeaea;
    border-bottom: 1px solid #eaeaea;
}

.grid-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    font-size: 15px;
    font-weight: 600;
    color: #767676;
    text-align: center;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.grid-item a:hover {
    background-color: #f9f9f9;
    color: #1c1c1c;
    opacity: 1;
}

.grid-item.active a {
    color: #1c1c1c;
}

.grid-item:first-child a {
    color: #1c1c1c;
}
.grid-item:first-child.active a, .grid-item:first-child:hover a {
    background-color: #f5f5f5;
}

.language-switcher a {
    display: block;
    padding: 8px 16px;
    border: 1px solid #eaeaea;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: #767676;
    white-space: nowrap;
    transition: border-color 0.2s ease-in-out, color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}
.language-switcher a:hover {
    border-color: #1c1c1c;
    color: #1c1c1c;
    background-color: #f9f9f9;
    opacity: 1;
}

/* --- Submenu (from fixes) --- */
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: -1px;
    background-color: #ffffff;
    min-width: calc(100% + 2px);
    z-index: 1010;
    border: 1px solid #eaeaea;
    border-top: none;
    list-style: none;
    padding: 8px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
}

.grid-item:hover > .submenu {
    display: block;
}

.submenu li a {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #767676;
    border-radius: 4px;
    text-align: left;
    white-space: nowrap;
}

.submenu li a:hover {
    background-color: #f9f9f9;
    color: #1c1c1c;
    opacity: 1;
}


/* === 4. HERO SECTION (REFINED) === */
.hero-section {
    text-align: center;
    padding: 80px 20px;
    margin: 0;
}
.hero-title {
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}

.hero-desc {
    font-size: 18px;
    color: #767676;
    margin-bottom: 40px;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
}

.hero-search { max-width: 550px; margin: 0 auto; }
.hero-search form { display: flex; border-bottom: 1.5px solid #eaeaea; transition: border-color 0.2s ease; }
.hero-search form:focus-within { border-color: #1c1c1c; }
.hero-search .search-input { flex: 1; border: none; padding: 12px 0; outline: none; font-size: 16px; background: transparent; color: #1c1c1c; text-align: center; }
.hero-search .search-input::placeholder { color: #b0b0b0; }
.hero-search .search-button { border: none; background: transparent; color: #1c1c1c; font-weight: 500; padding: 12px 16px; cursor: pointer; font-size: 16px; letter-spacing: 0.5px; }

/* === 5. VIDEO SECTIONS & CARDS (REFINED) === */
.video-section {
    margin: 80px 0;
    padding: 0; border: none; background: none;
}
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 40px; padding-bottom: 24px; border-bottom: 1px solid #eaeaea;
}
.section-header h2, .category-title, .search-title, .video-detail-title, .video-play-title {
    font-size: 32px; font-weight: 600; letter-spacing: -0.5px;
}
.more-link { font-size: 15px; font-weight: 500; color: #767676; }

.video-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
    gap: 48px 24px !important;
}

.video-card {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 8px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
.video-card:hover {
    border-color: #eaeaea;
    background-color: #fcfcfc;
}
.video-card a:hover {
    opacity: 1.0;
}

.video-card-image {
    position: relative; padding-top: 56.25%;
    background-color: #f5f5f5;
    margin-bottom: 16px;
    border-radius: 2px;
    overflow: hidden;
}
.video-card-image img { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; object-fit: cover !important; }
.video-card-label { display: none; }
.video-card-info { padding: 0; }
.video-title { font-size: 18px; font-weight: 500; line-height: 1.5; color: #1c1c1c; }

/* === 6. PAGINATION === */
.pagination { display: flex; justify-content: center; margin: 60px 0 20px; }
.el-pager { display: flex; gap: 24px; list-style: none; padding: 0; margin: 0; }
.el-pager .number, .el-pager .pager-prev, .el-pager .pager-next { background: none; border: none; padding: 4px; color: #767676; font-weight: 500; }
.el-pager .number:hover, .el-pager .pager-prev:hover, .el-pager .pager-next:hover { color: #1c1c1c; }
.el-pager a { color: inherit; }
.el-pager .active { color: #1c1c1c; font-weight: 600; }
.el-pager .active span { text-decoration: underline; text-underline-offset: 4px; }
.el-pager .is-disabled { opacity: .4; cursor: not-allowed; }

/* === 7. DETAIL & PLAY PAGES === */
.video-detail-section, .video-play-section { margin: 60px 0; }
.video-detail-header, .video-play-header { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px solid #eaeaea; }
.video-detail-content, .video-play-content { display: grid; grid-template-columns: 2fr 1fr; gap: 60px; align-items: flex-start; }

.video-detail-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #333;
    border-radius: 8px;
    overflow: hidden;
}
.video-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-player {
    position: relative;
    padding-top: 56.25%;
    background-color: #1c1c1c;
    height: 0;
    border-radius: 8px;
    overflow: hidden;
}
.video-player #dplayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-info-sidebar { position: sticky; top: 120px; font-size: 15px; line-height: 1.8; color: #767676; }
.info-row { display: flex; padding-bottom: 16px; margin-bottom: 16px; }
.info-row:last-child { margin-bottom: 0; }
.info-label { font-weight: 500; color: #1c1c1c; min-width: 80px; flex-shrink: 0; }
.info-content a { text-decoration: underline; text-underline-offset: 3px; }
.info-card { margin-top: 40px; }
.info-card h2 { font-size: 16px; font-weight: 600; color: #1c1c1c; margin-bottom: 16px; letter-spacing: 0.5px; text-transform: uppercase; }
.class-list, .tag-list, .tag-cloud { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.class-list a, .tag-list a, .tag-item { font-size: 15px; color: #767676; text-decoration: underline; text-underline-offset: 3px; }

.play-button, .play-line {
    display: inline-block; padding: 14px 28px; background-color: #1c1c1c; border-radius: 4px;
    font-size: 16px; font-weight: 500; color: #fff; text-align: center;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.play-button:hover, .play-line:hover { background-color: #000000; transform: scale(1.03); }
.play-line { margin-right: 12px; margin-bottom: 12px; background: #ffffff; color: #1c1c1c; border: 1px solid #1c1c1c; }
.play-line:hover { background-color: #1c1c1c; color: #ffffff; }

/* === 8. FOOTER === */
.footer { padding: 40px 0; text-align: center; color: #767676; font-size: 14px; border-top: 1px solid #eaeaea; margin-top: 80px; }
.footer p { margin-bottom: 8px; }
.footer a { color: #767676; text-decoration: underline; text-underline-offset: 3px; }

/* === 9. MISCELLANEOUS === */
.debug-info { display: none; }


/* === 10. HOMEPAGE LAYOUT & SIDEBAR (Consolidated) === */
.main-content-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0 48px;
    align-items: flex-start;
}

.combo-tag-sidebar {
    margin-top: 100px;
}

.combo-tag-sidebar .section-header {
    border-bottom: none;
    margin-bottom: 30px;
    padding-bottom: 0;
}

.combo-tag-sidebar .section-header h2 {
    text-align: center;
    width: 100%;
    color: #767676;
    font-weight: 500;
    font-size: 28px;
}

.combo-tag-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px 0;
}

.combo-tag-item {
    display: block;
    padding: 12px 15px;
    font-size: 15px;
    font-weight: 600;
    color: #1c1c1c;
    background-color: #f9f9f9;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    text-align: center;
    line-height: 1.5;
    /* REFINED: Explicit transitions for better performance */
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.combo-tag-item:hover {
    border-color: #1c1c1c;
    background-color: #1c1c1c;
    color: #ffffff;
    opacity: 1;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 5px 12px rgba(0,0,0,0.08);
}

.heart-emoji {
    color: #e54848;
    font-style: normal;
}

.main-video-content .video-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 40px 20px !important;
}

.main-video-content .video-title {
    font-size: 16px;
}


/* === 11. RESPONSIVE DESIGN === */
@media (max-width: 992px) {
    .video-detail-content, .video-play-content { grid-template-columns: 1fr; }
    .video-info-sidebar { position: static; }
    .category-grid { grid-template-columns: repeat(3, 1fr); }

    /* ADDED: Responsive behavior for the main grid */
    .main-content-grid {
        grid-template-columns: 1fr; /* Stack the columns */
        gap: 60px 0;
    }
    .combo-tag-sidebar {
        margin-top: 0; /* Remove top margin on smaller screens */
    }
}

@media (max-width: 768px) {
    body { font-size: 15px; }
    .container { padding: 0 15px; }
    .header .container { flex-direction: column; gap: 24px; }
    .nav { margin: 0; width: 100%; }
    .category-grid { grid-template-columns: repeat(3, 1fr); }

    .hero-title { font-size: 28px; }
    .hero-desc { font-size: 16px; }

    .video-section { margin: 60px 0; }
    .section-header h2, .category-title, .search-title, .video-detail-title, .video-play-title { font-size: 24px; }
    
    .video-grid {
        grid-template-columns: 1fr !important;
        gap: 48px !important;
    }

    /* Keep main content grid 3 columns if screen is wide enough, else it inherits from above */
    .main-video-content .video-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .video-detail-image {
        aspect-ratio: 16/9;
    }
}

/*
================================================================
--- V6 最终解决方案：针对Flexbox布局的强力修正 ---
================================================================
*/
#search-title,
.category-title {
    /* 1. Flexbox修正：允许标题在Flex容器中占据必要的空间并换行 */
    flex-grow: 1;
    min-width: 0; /* 这是一个关键技巧，用于解决Flex项目内长文本无法换行的问题 */

    /* 2. 保留之前的关键样式，并用!important确保最高优先级 */
    font-size: 24px !important;
    line-height: 1.4 !important;
    height: auto !important;
    white-space: normal !important;
}