/* 全局样式 - 核心：禁止横向滚动，解决拉条问题 */
html, body {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f7f4ef;
    color: #333;
    box-sizing: border-box;
    overflow-x: hidden; /* 彻底禁止横向滚动条 */
    max-width: 100vw;    /* 页面宽度不超过视口 */
}

/* 导航栏 */
nav {
    background: #8b1e1e;
    padding: 14px 24px;
}

nav a {
    color: #fff;
    text-decoration: none;
    margin-right: 16px;
    font-weight: bold;
}

nav a:hover {
    text-decoration: underline;
}

/* 主内容区 - 居中+限制宽度 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
    box-sizing: border-box;
}

h1, h2, h3 {
    color: #8b1e1e;
}

/* 卡片网格 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.card-body {
    padding: 16px;
}

.card-title {
    font-size: 20px;
    margin: 0 0 10px;
    color: #8b1e1e;
}

.card-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.card-text {
    font-size: 14px;
    line-height: 1.7;
    color: #444;
}

/* 按钮样式 */
.card a.button, .button {
    display: inline-block;
    padding: 8px 14px;
    background: #8b1e1e;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    margin-top: 12px;
}

.card a.button:hover, .button:hover {
    background: #a52a2a;
}

/* 详情页图片容器 */
.detail-image {
    flex: 0 0 auto;
    max-width: 260px;
    width: 100%;
    margin: 0 auto; /* 居中显示 */
}

.detail-image img {
    width: 100%;
    max-height: 340px;
    border-radius: 10px;
    border: 1px solid #ddd;
    object-fit: cover;
    display: block;
    box-sizing: border-box;
}

/* 图片容器 - 核心限制尺寸（强化 Chrome 适配） */
.media-image-container {
    max-width: 800px !important; /* 强制限宽，覆盖浏览器默认 */
    width: calc(100% - 40px) !important; /* 左右各留20px边距，避免贴边 */
    margin: 10px auto !important;
    padding: 0 !important;
    border: 0 !important;
    box-sizing: border-box;
}

/* 详情页图片样式（修复 Chrome 对 object-fit 的解析偏差） */
.media-image {
    max-width: 100% !important; /* 最高优先级限制宽度 */
    width: 100% !important;
    height: auto !important;
    max-height: 400px !important; /* 固定最大高度，替代纯 vh */
    max-height: 50vh !important;  /* 保留 vh 适配不同屏幕 */
    border-radius: 8px;
    display: block;
    object-fit: contain !important; /* 修复 Chrome 对 object-fit 的解析偏差 */
    transform: scale(1);
    transform-origin: center;
}

/* 视频容器 - 核心解决横向溢出（强化 Chrome 适配） */
.video-container {
    max-width: 800px !important; /* 强制限宽，和图片保持一致 */
    width: calc(100% - 40px) !important; /* 左右各留20px边距 */
    margin: 20px auto !important; /* 居中显示，上下留边 */
    padding: 0 !important;
    border: 0 !important;
    box-sizing: border-box;
}

/* 详情页视频样式（修复 Chrome 解析偏差） */
.media-video {
    max-width: 100% !important; /* 最高优先级限制宽度 */
    width: 100% !important;
    height: auto !important;
    max-height: 450px !important; /* 固定最大高度 */
    max-height: 60vh !important;
    border-radius: 8px;
    display: block;
    object-fit: contain !important; /* 等比例缩放，不撑满 */
    transform: scale(1);
    transform-origin: center;
}

/* 移动端适配（手机屏幕） */
@media (max-width: 768px) {
    main {
        padding: 16px !important; /* 减少内边距，适配手机 */
    }
    .media-image-container, .video-container {
        max-width: 100% !important; /* 移动端占满屏幕宽度，无留白 */
        width: calc(100% - 20px) !important; /* 移动端边距减半 */
    }
    .media-image {
        max-height: 350px !important;
        max-height: 40vh !important; /* 移动端图片更紧凑 */
    }
    .media-video {
        max-height: 400px !important;
        max-height: 45vh !important; /* 移动端视频更紧凑 */
    }
}

/* Chrome 全局样式重置（消除默认边距/内边距） */
body main {
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box !important;
}

/* 最新登录页样式（完全覆盖旧登录样式，优先级最高） */
.login-page {
    margin: 0;
    min-height: 100vh;
    background: url("/agri/static/images/login-bg.jpg") no-repeat center center;
    background-size: cover;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}

.login-overlay {
    min-height: 100vh;
    background: rgba(120, 0, 0, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-panel {
    width: 100%;
    max-width: 980px;
    padding: 40px 20px 60px;
    text-align: center;
    color: #fff;
}

/* 新增 Login Logo 样式 */
.login-logo {
    margin-bottom: 12px;
    text-align: center;
}

.login-logo img {
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
    opacity: 0.88;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.25));
}

.login-title {
    margin: 0 0 8px;
    font-size: 52px;
    color: #ffffff;
    line-height: 1.35;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    font-weight: 700;
}

.login-subtitle {
    margin: 0 0 38px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 20px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.custom-login-form {
    max-width: 900px;
    margin: 0 auto;
}

.login-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 24px;
}

.login-icon {
    width: 28px;
    text-align: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

.login-row label {
    width: 90px;
    text-align: left;
    color: #ffffff;
    font-size: 20px;
    font-weight: 500;
    white-space: nowrap;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.login-row input {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    padding: 12px 14px;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 20px;
    outline: none;
    border-radius: 6px 6px 0 0;
}

.login-row input::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

.login-row input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-bottom-color: #fff;
}

.captcha-row input {
    max-width: 180px;
}

.captcha-box {
    min-width: 110px;
    height: 46px;
    line-height: 46px;
    background: #fff;
    color: #1e2d5a;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 4px;
    border-radius: 4px;
    text-align: center;
    user-select: none;
}

.login-actions {
    margin-top: 28px;
    text-align: center;
}

.login-button {
    min-width: 180px;
    padding: 12px 22px;
    background: rgba(255, 140, 90, 0.92);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.login-button:hover {
    background: rgba(255, 120, 70, 0.96);
}

.login-links {
    margin-top: 24px;
    font-size: 18px;
    color: #fff;
}

.login-links a {
    color: #fff;
    text-decoration: none;
    margin: 0 8px;
}

.login-links a:hover {
    text-decoration: underline;
}

.login-footer-text {
    margin-top: 46px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.88);
}

.login-error {
    max-width: 520px;
    margin: 0 auto 20px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
}

@media (max-width: 768px) {
    .login-title {
        font-size: 32px;
    }

    .login-subtitle {
        font-size: 16px;
        margin-bottom: 28px;
    }

    .login-row {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .login-row label {
        width: 70px;
        font-size: 16px;
    }

    .login-row input {
        max-width: 100%;
        font-size: 16px;
    }

    .captcha-box {
        margin-top: 10px;
    }

    .login-button {
        width: 100%;
        max-width: 260px;
    }
}

/* 补充的验证码样式 */
.captcha-row {
    align-items: center;
}

.captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.captcha-wrapper img {
    height: 46px;
    border-radius: 4px;
    background: #fff;
    padding: 2px 6px;
}

.captcha-wrapper input {
    width: 180px;
    max-width: 180px;
}

.captcha {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 注册面板专属样式 */
.register-panel {
    max-width: 980px;
}

.register-panel .login-title {
    font-size: 48px;
}

.register-panel .login-subtitle {
    margin-bottom: 36px;
}

.register-panel .login-row input {
    max-width: 420px;
}

@media (max-width: 768px) {
    .register-panel .login-title {
        font-size: 30px;
    }
}

/* ==================== 新增：剧集网格样式 ==================== */
.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.episode-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s;
}

.episode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.15);
}

.episode-cover {
    height: 140px;
    background: linear-gradient(135deg, #8b1e1e, #c0392b);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.episode-info {
    padding: 12px;
}

.episode-info h3 {
    font-size: 16px;
    margin: 0 0 8px;
}

.episode-info a {
    text-decoration: none;
    color: #222;
}

.episode-info a:hover {
    color: #8b1e1e;
}

.episode-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

/* ==================== 新增：视频播放页专用样式 ==================== */
.player-page {
    margin-top: 20px;
}

.player-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.video-section {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.video-wrapper {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.main-video {
    width: 100%;
    display: block;
    max-height: 620px;
    background: #000;
}

.video-meta {
    margin-top: 18px;
}

.video-title {
    font-size: 30px;
    color: #8b1e1e;
    margin-bottom: 10px;
}

.video-series {
    font-size: 14px;
    color: #666;
    margin-bottom: 14px;
}

.video-summary {
    font-size: 15px;
    line-height: 1.9;
    color: #333;
}

.playlist-section {
    position: sticky;
    top: 20px;
}

.playlist-box {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.playlist-box h2 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #8b1e1e;
    font-size: 24px;
}

.playlist-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.playlist-item {
    display: flex;
    gap: 12px;
    text-decoration: none;
    color: #222;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 10px;
    transition: all 0.2s ease;
    background: #fff;
}

.playlist-item:hover {
    border-color: #8b1e1e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    transform: translateY(-2px);
}

.playlist-item.active {
    border-color: #8b1e1e;
    background: #fff7f5;
}

.playlist-thumb {
    width: 120px;
    height: 68px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #eee;
}

.playlist-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.playlist-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #8b1e1e, #c0392b);
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.playlist-info {
    flex: 1;
    min-width: 0;
}

.playlist-ep {
    font-size: 13px;
    color: #8b1e1e;
    margin-bottom: 6px;
    font-weight: bold;
}

.playlist-title {
    font-size: 15px;
    line-height: 1.6;
    color: #222;
    word-break: break-word;
}

@media (max-width: 900px) {
    .player-main {
        grid-template-columns: 1fr;
    }

    .playlist-section {
        position: static;
    }
}