/* 基础设置 */
:root {
    --primary-color: #41ac52;
    --primary-color-hover: #328541;
    --secondary-color: #f7f7f7;
    --text-color: #333;
    --text-secondary: #666;
    --text-light: #999;
    --border-color: #ddd;
    --star-color: #ffac2d;
    --bg-color: #fff;
    --accent-light: #41ac52;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: #f4f4f4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    color: #3377aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-color);
}

/* 头部样式 */
header {
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    margin-bottom: 20px;
}

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

.logo a {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.logo .subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-left: 10px;
}

nav ul {
    display: flex;
    list-style: none;
}

nav li {
    margin-left: 20px;
}

nav a {
    color: var(--text-secondary);
    font-weight: 500;
}

nav a.active, nav a:hover {
    color: var(--primary-color);
}

/* 主体内容 */
main {
    flex: 1;
    padding: 20px 0 40px;
}

/* 电影卡片 - 网格视图 */
.movie-container {
    margin-top: 20px;
}

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
}

.movie-card {
    background: white;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.rank-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-color);
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.list-view .rank-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 11px;
    padding: 3px 8px;
}

.poster {
    height: 0;
    padding-bottom: 140%; /* 宽高比为7:10 */
    position: relative;
    overflow: hidden;
}

.poster img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.movie-card:hover .poster img {
    transform: scale(1.05);
}

.movie-info {
    padding: 15px;
}

.title {
    font-size: 16px;
    margin-bottom: 5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sub-title {
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rating {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.rating-score {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
    margin-right: 5px;
    line-height: 1;
}

.rating-star {
    display: flex;
    margin-right: 5px;
    align-items: center;
}

.star {
    display: inline-block;
    margin-right: 2px;
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.star.full {
    color: #FFAC2D;
}

.star.empty {
    color: #ECECEC;
}

/* 半星效果 */
.star-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 2px;
    width: 16px;
    height: 16px;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
}

.star-half-empty {
    position: absolute;
    top: 0;
    left: 0;
    color: #ECECEC;
    font-size: 16px;
    z-index: 1;
    line-height: 1;
}

.star-half-full {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    overflow: hidden;
    color: #FFAC2D;
    font-size: 16px;
    z-index: 2;
    line-height: 1;
}

/* 百分比星星评分样式 */
.star-container {
    position: relative;
    display: inline-block;
    margin-right: 2px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    vertical-align: middle;
}

.star-base {
    position: absolute;
    top: 0;
    left: 0;
    color: #ECECEC;
    font-size: 16px;
    z-index: 1;
    line-height: 1;
}

.star-fill {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: #FFAC2D;
    font-size: 16px;
    z-index: 2;
    line-height: 1;
    white-space: nowrap;
    width: var(--percent, 0%); /* 使用CSS变量控制宽度 */
}

.rating-count {
    font-size: 12px;
    color: var(--text-light);
}

.cast {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quote {
    font-size: 13px;
    color: var(--text-light);
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 电影卡片 - 列表视图 */
.list-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.list-view .movie-card {
    display: flex;
    height: 180px;
}

.list-view .poster {
    width: 120px;
    height: 100%;
    padding-bottom: 0;
    flex-shrink: 0;
}

.list-view .movie-info {
    flex: 1;
    padding: 15px;
    position: relative;
}

.list-view .title {
    font-size: 18px;
}

.list-view .star {
    width: 14px;
    height: 14px;
    font-size: 14px;
    margin-right: 1px;
    line-height: 1;
}

.list-view .star-wrapper {
    width: 14px;
    height: 14px;
    margin-right: 1px;
    line-height: 1;
}

.list-view .star-half-empty,
.list-view .star-half-full {
    font-size: 14px;
    line-height: 1;
}

.list-view .quote {
    display: none; /* 隐藏列表视图中的一句话简介 */
}

/* 视图切换按钮 */
.filters {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
}

.view-options {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 4px;
    padding: 5px 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-option {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    margin-left: 10px;
    padding: 5px 8px;
    border-radius: 3px;
}

.view-option svg {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    fill: currentColor;
}

.view-option.active {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: 500;
}

/* 详情页样式 */
.movie-detail {
    max-width: 1000px;
    margin: 30px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.breadcrumbs {
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-header {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.poster-container {
    width: 200px;
    position: relative;
}

.poster-img {
    width: 100%;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.rank-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-weight: bold;
}

.movie-detail .movie-info {
    flex: 1;
    padding: 0;
}

.movie-detail .title {
    font-size: 28px;
    margin-bottom: 10px;
    white-space: normal;
}

.movie-detail .sub-title {
    font-size: 16px;
    margin-bottom: 15px;
}

.rating-large {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.rating-large .rating-score {
    font-size: 36px;
    color: var(--primary-color);
    margin-right: 10px;
    line-height: 1;
}

.rating-large .rating-star {
    margin-right: 10px;
    display: flex;
    align-items: center;
}

.rating-large .star {
    width: 20px;
    height: 20px;
    margin-right: 3px;
    font-size: 20px;
}

.rating-large .star-wrapper {
    width: 20px;
    height: 20px;
    line-height: 1;
    margin-right: 3px;
}

.rating-large .star-half-empty,
.rating-large .star-half-full {
    font-size: 20px;
    top: -1px;
}

.rating-large .rating-count {
    font-size: 14px;
}

.info-items {
    margin-bottom: 20px;
}

.info-item {
    margin-bottom: 10px;
}

.info-label {
    color: var(--text-light);
    margin-right: 5px;
}

.movie-type, .movie-region {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 5px;
    margin-bottom: 5px;
    border-radius: 10px;
    font-size: 12px;
}

.movie-type {
    background-color: #41ac52;
    color: #fff;
}

.movie-region {
    background-color: #e8f0fe;
    color: #1a73e8;
    margin-right: 8px;
}

.quote-large {
    font-size: 16px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.quote-mark {
    color: var(--primary-color);
    font-size: 20px;
    font-weight: bold;
}

/* 详情内容区域 */
.detail-content {
    margin-top: 40px;
}

.section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 20px;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 4px solid var(--primary-color);
}

.section-content {
    font-size: 15px;
    line-height: 1.8;
}

.description {
    margin-bottom: 20px;
}

.quote-hint {
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 20px;
}

.scraping-hint {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    border-left: 4px solid #4285f4;
}

.scraping-hint code {
    background: #e9f2fe;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}

.scraping-hint ul {
    margin: 15px 0;
    padding-left: 20px;
}

/* 页脚样式 */
footer {
    background-color: #fff;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 4px;
    max-width: 600px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.modal-content p, .modal-content ul {
    margin-bottom: 15px;
}

.modal-content h3 {
    margin: 20px 0 10px;
    font-size: 18px;
}

.modal-content code {
    background: #f4f4f4;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}

/* 错误页面样式 */
.error-page {
    text-align: center;
    padding: 50px 20px;
}

.error-content {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 4px;
    box-shadow: var(--card-shadow);
}

.error-page h1 {
    font-size: 32px;
    color: #e74c3c;
    margin-bottom: 20px;
}

.error-message {
    margin-bottom: 30px;
    color: var(--text-secondary);
}

.error-message .hint {
    margin-top: 20px;
    font-weight: 500;
    color: var(--primary-color);
}

.error-message pre {
    text-align: left;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin-top: 15px;
}

.error-message code {
    font-family: monospace;
    color: #333;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: var(--primary-color-hover);
    color: white;
}

/* 响应式样式 */
@media (max-width: 768px) {
    .grid-view {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .poster-container {
        width: 160px;
        margin-bottom: 20px;
    }
    
    .movie-detail .title {
        font-size: 24px;
    }
    
    .list-view .movie-card {
        height: auto;
        flex-direction: column;
    }
    
    .list-view .poster {
        width: 100%;
        padding-bottom: 140%;
    }
}
