* { box-sizing: border-box; margin: 0; padding: 0; font-family: Arial, sans-serif; }
body { background-color: #141414; color: #fff; }

header { background-color: #000; padding: 20px 0; }
.header-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; }
.search-box input { padding: 10px; width: 300px; border-radius: 4px; border: none; outline: none; }
.search-box button { padding: 10px 20px; background-color: #e50914; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }
.search-box button:hover { background-color: #f40612; }

main { max-width: 1200px; margin: 30px auto; padding: 0 20px; }
h2 { margin-bottom: 20px; }

.movie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.movie-card { background-color: #222; border-radius: 8px; overflow: hidden; transition: transform 0.3s ease; cursor: pointer; }
.movie-card:hover { transform: scale(1.05); }

.movie-thumb { width: 100%; height: 300px; object-fit: cover; }
.movie-info { padding: 15px; }
.movie-title { font-size: 16px; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movie-meta { font-size: 13px; color: #aaa; display: flex; justify-content: space-between; }
.movie-quality { background-color: #e50914; color: white; padding: 2px 6px; border-radius: 4px; font-size: 11px; }
/* Giao diện Modal Chi Tiết Phim */
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.8);
}
.modal-content {
    background-color: #181818; margin: 5% auto; padding: 25px;
    border-radius: 8px; width: 85%; max-width: 800px; position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.close-btn {
    color: #aaa; position: absolute; right: 20px; top: 15px;
    font-size: 30px; font-weight: bold; cursor: pointer; transition: 0.2s;
}
.close-btn:hover { color: #fff; }

.detail-header { display: flex; gap: 25px; margin-top: 10px; flex-wrap: wrap; }
.detail-poster { width: 220px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.detail-info { flex: 1; min-width: 250px; }
.detail-info h2 { margin-bottom: 10px; color: #fff; font-size: 24px; }
.detail-info p { margin-bottom: 8px; line-height: 1.6; color: #ccc; font-size: 14px; }
.detail-info strong { color: #fff; }
.watch-btn { 
    padding: 12px 25px; background-color: #e50914; color: white; 
    border: none; border-radius: 4px; cursor: pointer; 
    font-weight: bold; font-size: 16px; margin-top: 15px; 
}
.watch-btn:hover { background-color: #f40612; }
/* Styling cho danh sách Video & Get Link */
.video-list {
    margin-top: 25px;
    background-color: #222;
    padding: 15px;
    border-radius: 8px;
}
.video-list h3 {
    font-size: 16px;
    color: #e50914;
    margin-bottom: 15px;
}
.video-list ul {
    list-style: none;
    padding: 0;
}
.video-item {
    background-color: #333;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}
.video-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.video-label {
    color: #fff;
    font-size: 13px;
    word-break: break-all;
    line-height: 1.4;
}
.get-link-btn {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap;
    transition: background-color 0.2s;
}
.get-link-btn:hover {
    background-color: #0056b3;
}
.stream-success {
    margin-top: 12px;
    padding: 10px;
    background-color: #1c331c;
    border-left: 4px solid #28a745;
    border-radius: 4px;
}
.play-link {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
}
.play-link:hover {
    text-decoration: underline;
    color: #81c784;
}

/* Container bọc ngoài ảnh và thông tin */
.detail-header {
    display: flex;
    gap: 20px;
    /* Cực kỳ quan trọng: Ép các thành phần dính lên trên cùng, không bị kéo giãn theo chiều dọc */
    align-items: flex-start; 
}

/* Khối Hình ảnh Poster */
.detail-poster {
    width: 250px; /* Kích thước chiều rộng cố định */
    min-width: 250px; /* Đảm bảo không bị thu nhỏ khi text quá dài */
    height: auto; /* Chiều cao tự động để giữ đúng tỷ lệ ảnh */
    border-radius: 8px; /* Bo góc cho đẹp (tùy chọn) */
    object-fit: cover; /* Hiển thị ảnh đầy đặn không bị méo */
    
    /* Cực kỳ quan trọng: Ngăn không cho Flexbox ép nhỏ hình ảnh này */
    flex-shrink: 0; 
}

/* Khối chứa Text thông tin và Source Video */
.detail-info {
    flex: 1; /* Chiếm toàn bộ không gian còn lại */
    min-width: 0; /* Ngăn chặn text dài phá vỡ cấu trúc flex */
}

/* Responsive: Xử lý giao diện trên điện thoại */
@media (max-width: 768px) {
    .detail-header {
        flex-direction: column; /* Xếp dọc từ trên xuống dưới */
        align-items: center; /* Căn giữa ảnh trên mobile */
    }
    
    .detail-poster {
        width: 200px; /* Thu nhỏ ảnh lại một chút trên điện thoại */
        min-width: 200px;
        margin-bottom: 15px; /* Tạo khoảng cách với chữ bên dưới */
    }
}