/* 卡片容器 - 每排3個 */
.card-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 每排固定3個 */
    gap: 20px;
    margin: 20px auto;
    max-width: 1200px;
    padding: 0 15px;
}

/* 影片卡片項目 */
.movie-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

/* 卡片連結 */
.movie-item a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 圖片容器 */
.movie-image {
    width: 100%;
    aspect-ratio: 16 / 9; /* 保持 16:9 比例 */
    overflow: hidden;
    background: #f0f0f0;
    position: relative;
}

.movie-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.movie-item:hover .movie-image img {
    transform: scale(1.05);
}

/* 無圖片時的文字 */
.no-image-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 14px;
    text-align: center;
}

/* 卡片內容 */
.movie-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* 標題 */
.movie-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 描述 */
.movie-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}

/* 觀看次數 */
.movie-views {
    font-size: 12px;
    color: #999;
    margin-top: auto;
}

/* 平板尺寸 - 每排2個 */
@media (max-width: 992px) {
    .card-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* 手機尺寸 - 每排1個 */
@media (max-width: 576px) {
    .card-container {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 10px;
    }
    
    .movie-title {
        font-size: 15px;
    }
    
    .movie-description {
        font-size: 13px;
    }
}

/* 確保容器不會使用 flex */
.container1 {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* 移除任何可能導致4列的Bootstrap類別影響 */
.card-container > * {
    min-width: 0; /* 防止內容溢出 */
}

/* ===== 深色模式支援 ===== */
[data-theme="dark"] .movie-item {
    background: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .movie-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .movie-image {
    background: #334155;
}

[data-theme="dark"] .movie-title {
    color: #f1f5f9;
}

[data-theme="dark"] .movie-description {
    color: #94a3b8;
}

[data-theme="dark"] .movie-views {
    color: #64748b;
}

[data-theme="dark"] .no-image-text {
    color: #64748b;
}

[data-theme="dark"] .container1 {
    background-color: transparent;
}

.card-title {
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
    cursor: pointer;
}

.card-caption {
    pointer-events: auto !important;
}

.card-figure {
    pointer-events: auto !important;
}
