/* 基础重置和变量定义 */
:root {
    --primary-bg: #141414;
    --secondary-bg: #1f1f1f;
    --tertiary-bg: #333333;
    --accent-color: #e50914;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --card-bg: #333333;
    --hover-bg: #444444;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部导航栏 */
.navbar {
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    padding: 15px 4%;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    transition: background-color var(--transition-speed);
}

.navbar.scrolled {
    background-color: var(--primary-bg);
    border-bottom: 1px solid #333;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo h1 {
    color: var(--accent-color);
    font-size: 28px;
    font-weight: bold;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    padding: 5px 10px;
    width: 500px;
    max-width: 50%;
    position: relative;
}

#searchInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px;
    font-size: 16px;
    outline: none;
}

#searchInput::placeholder {
    color: var(--text-secondary);
}

#searchBtn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: color var(--transition-speed);
}

#searchBtn:hover {
    color: var(--text-primary);
}

.user-actions select {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--tertiary-bg);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 14px;
}

/* 主内容区 */
.main-content {
    display: flex;
    flex: 1;
    margin-top: 68px;
    overflow: hidden;
}

/* 电影列表区域 */
.movies-section {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.section-header h2 {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: bold;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.movie-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    cursor: pointer;
    position: relative;
}

.movie-card:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.movie-poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
}

.movie-info {
    padding: 12px;
}

.movie-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.movie-source {
    font-size: 11px;
    color: var(--accent-color);
    margin-top: 5px;
}

.placeholder-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.placeholder-message p {
    font-size: 18px;
}

/* 详情区域 */
.details-section {
    flex: 1;
    background-color: var(--secondary-bg);
    padding: 20px;
    overflow-y: auto;
    border-left: 1px solid #333;
    min-width: 400px;
}

.detail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

.detail-placeholder i {
    font-size: 64px;
    margin-bottom: 20px;
}

.detail-placeholder p {
    font-size: 18px;
}

.movie-detail-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-header {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.detail-poster {
    max-width: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.detail-info {
    flex: 1;
}

.detail-title {
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: bold;
}

.detail-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-description {
    margin: 15px 0;
    line-height: 1.6;
}

.episode-section h3 {
    font-size: 20px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.episode-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.episode-btn {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: background-color var(--transition-speed);
    text-align: center;
    font-size: 14px;
}

.episode-btn:hover {
    background-color: var(--hover-bg);
}

.video-section {
    margin-top: 20px;
}

.video-section h3 {
    font-size: 20px;
    margin-bottom: 15px;
}

#videoPlayer {
    width: 100%;
    height: 400px;
    background-color: #000;
    border-radius: 8px;
}

/* 搜索覆盖层样式 */
.search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    z-index: 10;
}

.search-overlay.active {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 免责声明 */
.disclaimer {
    background-color: #000;
    color: #888;
    text-align: center;
    padding: 15px 4%;
    font-size: 12px;
    border-top: 1px solid #333;
    margin-top: auto;
}

.disclaimer p {
    margin: 0;
    line-height: 1.4;
}

/* 宽屏优化 (1440px及以上) */
@media screen and (min-width: 1440px) {
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 25px;
    }
    
    .movie-card {
        transition: all var(--transition-speed);
    }
    
    .movie-card:hover {
        transform: scale(1.08);
    }
    
    .detail-title {
        font-size: 36px;
    }
    
    .detail-poster {
        max-width: 250px;
    }
    
    #videoPlayer {
        height: 500px;
    }
    
    .episode-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* 中等屏幕 (768px - 1439px) */
@media screen and (min-width: 768px) and (max-width: 1439px) {
    .search-box {
        width: 400px;
        max-width: 40%;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .detail-title {
        font-size: 28px;
    }
    
    .detail-poster {
        max-width: 180px;
    }
    
    #videoPlayer {
        height: 350px;
    }
    
    .episode-list {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

/* 小屏幕平板 (768px - 992px) */
@media screen and (min-width: 768px) and (max-width: 992px) {
    .navbar-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        width: 100%;
        max-width: 100%;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .details-section {
        border-left: none;
        border-top: 1px solid #333;
        min-width: 100%;
    }
    
    #videoPlayer {
        height: 300px;
    }
    
    .detail-header {
        flex-direction: column;
    }
    
    .detail-poster {
        max-width: 150px;
        align-self: center;
    }
    
    .detail-title {
        font-size: 24px;
        text-align: center;
    }
}

/* 手机横屏 (576px - 767px) */
@media screen and (min-width: 576px) and (max-width: 767px) {
    .navbar-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        width: 100%;
        max-width: 100%;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .details-section {
        border-left: none;
        border-top: 1px solid #333;
        min-width: 100%;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .detail-header {
        flex-direction: column;
    }
    
    .detail-poster {
        max-width: 150px;
        align-self: center;
    }
    
    .detail-title {
        font-size: 24px;
        text-align: center;
    }
    
    .episode-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    #videoPlayer {
        height: 250px;
    }
}

/* 手机竖屏 (575px及以下) */
@media screen and (max-width: 575px) {
    .navbar {
        padding: 10px 3%;
    }
    
    .logo h1 {
        font-size: 24px;
    }
    
    .navbar-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        width: 100%;
        max-width: 100%;
        padding: 3px 8px;
    }
    
    #searchInput {
        padding: 6px;
        font-size: 14px;
    }
    
    .main-content {
        flex-direction: column;
        margin-top: 60px;
    }
    
    .details-section {
        border-left: none;
        border-top: 1px solid #333;
        min-width: 100%;
        padding: 15px;
    }
    
    .movies-section {
        padding: 15px;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .movie-info {
        padding: 8px;
    }
    
    .movie-title {
        font-size: 14px;
    }
    
    .movie-meta {
        font-size: 11px;
    }
    
    .movie-source {
        font-size: 10px;
    }
    
    .section-header h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .detail-header {
        flex-direction: column;
    }
    
    .detail-poster {
        max-width: 120px;
        align-self: center;
    }
    
    .detail-title {
        font-size: 20px;
        text-align: center;
    }
    
    .detail-meta {
        font-size: 12px;
        gap: 10px;
    }
    
    .detail-description {
        font-size: 14px;
        margin: 10px 0;
    }
    
    .episode-section h3,
    .video-section h3 {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .episode-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .episode-btn {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    #videoPlayer {
        height: 200px;
    }
    
    .disclaimer {
        padding: 10px 3%;
        font-size: 10px;
    }
}