/* Portal 模板样式 - 深色背景 + 白色卡片三栏布局 */

:root {
    --portal-bg-dark: #ffffff;
    --portal-bg-darker: #ffffff;
    --portal-card-bg: #ffffff;
    --portal-text-primary: #1a1a1a;
    --portal-text-secondary: #666666;
    --portal-text-light: #999999;
    --portal-border: #e5e5e5;
    --portal-accent: #3b82f6;
    --portal-accent-hover: #2563eb;
    --portal-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --portal-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --portal-radius: 12px;
    --portal-sidebar-width: 240px;
    --portal-sidebar-right-width: 300px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.portal-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--portal-bg-dark);
    color: var(--portal-text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

.portal-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部搜索栏 */
.portal-top-header {
    background: var(--portal-card-bg);
    padding: 16px 24px;
    box-shadow: var(--portal-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.portal-top-search {
    max-width: 800px;
    margin: 0 auto;
}

.portal-search-form {
    width: 100%;
}

.portal-search-wrapper {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 8px 16px;
    gap: 12px;
}

.portal-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--portal-text-primary);
}

.portal-search-input::placeholder {
    color: var(--portal-text-light);
}

.portal-search-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--portal-accent);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-search-btn:hover {
    color: var(--portal-accent-hover);
}

/* 主布局容器 */
.portal-layout {
    display: flex;
    flex: 1;
    gap: 24px;
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* 左侧导航栏 */
.portal-sidebar {
    width: var(--portal-sidebar-width);
    flex-shrink: 0;
}

.portal-sidebar-card {
    background: var(--portal-card-bg);
    border-radius: var(--portal-radius);
    padding: 20px;
    box-shadow: var(--portal-shadow-lg);
    position: sticky;
    top: 100px;
}

.portal-sidebar-search {
    margin-bottom: 20px;
}

.portal-sidebar-search-form {
    width: 100%;
}

.portal-sidebar-search-wrapper {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 8px 12px;
    gap: 8px;
}

.portal-sidebar-search-wrapper svg {
    color: var(--portal-text-light);
    flex-shrink: 0;
}

.portal-sidebar-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--portal-text-primary);
}

.portal-sidebar-search-input::placeholder {
    color: var(--portal-text-light);
}

.portal-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.portal-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--portal-text-primary);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.portal-nav-item:hover {
    background: #f5f5f5;
}

.portal-nav-item.is-active {
    background: #e8f2ff;
    color: var(--portal-accent);
}

.portal-nav-item.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--portal-accent);
    border-radius: 0 2px 2px 0;
}

.portal-nav-item svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.portal-nav-item span {
    font-size: 15px;
}

/* 主内容区 */
.portal-main {
    flex: 1;
    min-width: 0;
}

.portal-content {
    display: flex;
    gap: 24px;
}

.portal-main-card {
    flex: 1;
    background: var(--portal-card-bg);
    border-radius: var(--portal-radius);
    padding: 24px;
    box-shadow: var(--portal-shadow-lg);
}

/* 轮播横幅 */
.portal-hero {
    position: relative;
    margin-bottom: 32px;
    border-radius: var(--portal-radius);
    overflow: hidden;
}

.portal-hero-slider {
    position: relative;
    width: 100%;
    height: 400px;
}

.portal-hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s;
}

.portal-hero-slide.is-active {
    opacity: 1;
}

.portal-hero-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.portal-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.portal-hero-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.7));
}

.portal-hero-content {
    position: relative;
    z-index: 2;
    padding: 40px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: white;
}

.portal-hero-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 12px;
    color: white;
}

.portal-hero-description {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    max-width: 600px;
}

.portal-hero-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.portal-hero-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.portal-hero-indicator.is-active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

/* 区块标题 */
.portal-section {
    margin-bottom: 32px;
}

.portal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.portal-section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.portal-section-link {
    color: var(--portal-text-primary);
    text-decoration: none;
}

.portal-section-link:hover {
    color: var(--portal-accent);
}

/* 视频网格 */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.portal-card {
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.portal-card:hover {
    transform: translateY(-4px);
}

.portal-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.portal-card-poster {
    position: relative;
    width: 100%;
    padding-top: 140%;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
}

.portal-card-poster img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.portal-card:hover .portal-card-overlay {
    opacity: 1;
}

.portal-card-play-icon {
    color: white;
}

.portal-card-body {
    padding: 12px 0 0;
}

.portal-card-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    color: var(--portal-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

/* 详情页 */
.portal-detail-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 24px;
}

.portal-detail-episode {
    font-size: 18px;
    font-weight: 400;
    color: var(--portal-text-secondary);
    margin-left: 12px;
}

.portal-player-section {
    margin-bottom: 32px;
}

.portal-player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: var(--portal-radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.portal-player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 广告层样式 - 确保正确定位 */
.portal-player-wrapper .player-ad-layer {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    z-index: 10 !important;
    overflow: hidden !important;
}

.portal-player-wrapper .player-ad-content {
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

.portal-player-wrapper .player-ad-content :where(img, iframe, video) {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

.portal-episode-section {
    margin-top: 24px;
}

.portal-episode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.portal-episode-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.portal-episode-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: var(--portal-text-secondary);
    transition: all 0.2s;
}

.portal-episode-sort:hover {
    border-color: var(--portal-accent);
    color: var(--portal-accent);
}

.portal-episode-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-episode-group {
    margin-bottom: 16px;
}

.portal-episode-group-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--portal-text-secondary);
}

.portal-episode-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.portal-episode-item {
    padding: 8px 16px;
    border: 1px solid var(--portal-border);
    border-radius: 6px;
    background: white;
    color: var(--portal-text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.portal-episode-item:hover {
    border-color: var(--portal-accent);
    color: var(--portal-accent);
}

.portal-episode-item.is-active {
    background: var(--portal-accent);
    border-color: var(--portal-accent);
    color: white;
}

.portal-episode-btn {
    border: 1px solid var(--portal-border);
    background: white;
    cursor: pointer;
}

.portal-detail-info {
    margin-bottom: 24px;
}

.portal-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.portal-detail-tag {
    padding: 4px 12px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 14px;
    color: var(--portal-text-secondary);
}

.portal-detail-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.portal-detail-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--portal-text-secondary);
}

.portal-detail-description {
    margin-top: 24px;
}

.portal-detail-description-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px;
}

.portal-detail-description-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--portal-text-secondary);
    margin: 0;
}

/* 右侧边栏 */
.portal-sidebar-right {
    width: var(--portal-sidebar-right-width);
    flex-shrink: 0;
}

.portal-sidebar-section {
    margin-bottom: 32px;
}

.portal-sidebar-section:last-child {
    margin-bottom: 0;
}

.portal-sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f5f5f5;
}

.portal-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-sidebar-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.portal-sidebar-item:hover {
    background: #f5f5f5;
}

.portal-sidebar-item-poster {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
}

.portal-sidebar-item-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-sidebar-item-info {
    flex: 1;
    min-width: 0;
}

.portal-sidebar-item-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    color: var(--portal-text-primary);
}

.portal-sidebar-item-tag {
    font-size: 12px;
    color: var(--portal-text-light);
}

.portal-sidebar-news-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.portal-sidebar-news-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.portal-sidebar-news-item:hover {
    background: #f5f5f5;
}

.portal-sidebar-news-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ff4444;
    border-radius: 50%;
    color: white;
}

.portal-sidebar-news-content {
    flex: 1;
    min-width: 0;
}

.portal-sidebar-news-source {
    font-size: 12px;
    color: var(--portal-text-light);
    display: block;
    margin-bottom: 4px;
}

.portal-sidebar-news-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    color: var(--portal-text-primary);
    line-height: 1.4;
}

/* 列表页 */
.portal-page-header {
    margin-bottom: 24px;
}

.portal-page-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
}

.portal-page-subtitle {
    font-size: 14px;
    color: var(--portal-text-secondary);
    margin: 0;
}

.portal-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--portal-text-light);
}

.portal-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--portal-border);
}

.portal-pagination-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--portal-border);
    border-radius: 6px;
    background: white;
    color: var(--portal-text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.portal-pagination-btn:hover {
    border-color: var(--portal-accent);
    color: var(--portal-accent);
}

.portal-pagination-info {
    font-size: 14px;
    color: var(--portal-text-secondary);
}

/* 页脚 */
.portal-footer {
    background: var(--portal-bg-darker);
    padding: 24px;
    margin-top: 48px;
}

.portal-footer-content {
    max-width: 1600px;
    margin: 0 auto;
    text-align: center;
}

.portal-footer-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .portal-sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .portal-layout {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }

    .portal-sidebar {
        width: 100%;
        position: relative;
    }

    .portal-sidebar-card {
        position: relative;
        top: 0;
    }

    .portal-content {
        flex-direction: column;
    }

    .portal-sidebar-right {
        width: 100%;
        display: block;
    }

    .portal-hero-slider {
        height: 250px;
    }

    .portal-hero-title {
        font-size: 20px;
    }

    .portal-hero-description {
        font-size: 14px;
    }

    .portal-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .portal-main-card {
        padding: 16px;
    }
}
