/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #121212; /* Nền tối cho web phim */
    color: #ffffff;
}

header {
    background-color: #1f1f1f;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e50914;
}

header .logo {
    font-size: 24px;
    font-weight: bold;
    color: #ff0000; /* Màu đỏ chủ đạo */
    text-decoration: none;
}

nav a {
    color: #ffffff;
    text-decoration: none;
    margin-left: 20px;
    font-size: 16px;
    transition: color 0.3s;
}

nav a:hover, nav a.active {
    color: #e50914;
}

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

/* Style cho danh sách phim */
.movie-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.movie-card {
    background-color: #222;
    border-radius: 8px;
    overflow: hidden;
    width: calc(25% - 15px);
    transition: transform 0.3s;
    cursor: pointer;
}

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

.movie-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.movie-card h3 {
    font-size: 16px;
    padding: 10px 10px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-card p {
    font-size: 14px;
    color: #aaa;
    padding: 0 10px 10px;
}

/* Các trang nội dung khác */
.content-box {
    background-color: #1f1f1f;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}






/* Thiết lập cơ bản cho trang */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; /* Thêm font hệ thống iOS */
}

body {
    /* Sử dụng hình nền hoặc màu nền có chi tiết để thấy rõ hiệu ứng kính mờ */
    background: url('images/12.png') no-repeat center center fixed;
    background-size: cover;
    color: #fff;
    min-height: 100vh;
}

/* Định hình thanh navbar với hiệu ứng Liquid Glass */
.navbar {
    position: fixed;
    bottom: 20px; /* Cách mép dưới một khoảng để thấy rõ độ bo tròn */
    left: 50%;
    transform: translateX(-50%); /* Căn giữa thanh menu */
    width: 90%; /* Hoặc một kích thước cố định như max-width: 500px; */
    max-width: 600px;
    height: 70px;
    
    /* HIỆU ỨNG GLASSMORPHISM (LIQUID GLASS) */
    background: rgba(25, 25, 25, 0.1); /* Màu đen trong suốt */
    backdrop-filter: blur(8px); /* Làm mờ hậu cảnh - MẤU CHỐT */
    -webkit-backdrop-filter: blur(8px); /* Hỗ trợ Safari */
    
    border-radius: 40px; /* Bo tròn mạnh giống iOS */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Viền mỏng, sáng mờ */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); /* Bóng đổ mềm mại */
    
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Định hình danh sách liên kết */
.navbar ul {
    position: relative;
    display: flex !important;
    justify-content: space-between !important; /* Chia đều khoảng cách cực chuẩn */
    align-items: center !important;
    padding: 0 15px !important; /* Tạo khoảng trống 2 đầu cho cân đối */
    margin: 0 !important;
    list-style: none !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
}

/* Định hình các mục menu */
.navbar ul li {
    flex: 1 !important; /* Ép mỗi icon chiếm 1 phần diện tích bằng nhau */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 2 !important;
}

/* Phong cách cho chữ/icon */
.navbar ul li a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6); /* Chữ màu trắng mờ */
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 10px 15px;
    display: block;
}

/* Phong cách khi mục được active */
.navbar ul li a.active {
    color: #ffffff; /* Chữ trắng sáng khi active */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3); /* Thêm chút sáng cho chữ */
}

/* --- HIỆU ỨNG INDICATOR KIỂU CHẤM TRÒN (Giống iOS hơn) --- */
/* Thay vì vạch dài, mình đổi sang chấm tròn nhỏ tinh tế hơn */
.indicator {
    position: absolute !important;z-index: 1 !important;transition: 0.5s !important;
    bottom: 8px; /* Đặt gần dưới đáy menu */
    width: 6px;
    height: 6px;
    background: #ffffff; /* Chấm màu trắng */
    border-radius: 50%; /* Làm tròn */
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1); /* Hiệu ứng nảy nhẹ */
    opacity: 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8); /* Phát sáng nhẹ */
}

/* Căn chỉnh vị trí indicator cho 5 mục */
/* Cần điều chỉnh % 'left' sao cho chấm tròn nằm ngay dưới chữ của mục tương ứng */
.navbar ul li:nth-child(1) a.active ~ .indicator { opacity: 1; left: 0%; } /* Home */
.navbar ul li:nth-child(2) a.active ~ .indicator { opacity: 1; left: 20%; } /* Tìm kiếm */
.navbar ul li:nth-child(3) a.active ~ .indicator { opacity: 1; left: 40%; transform: translateX(-40%); } /* Hồ sơ (ở giữa) */
.navbar ul li:nth-child(4) a.active ~ .indicator { opacity: 1; left: 60%; } /* Lịch sử */
.navbar ul li:nth-child(5) a.active ~ .indicator { opacity: 1; left: 80%; transform: translateX(-100%); } /* Theo dõi */

/* Cải thiện vị trí chính xác hơn bằng cách dùng transform (nếu cần tinh chỉnh) */
/* Ví dụ:
.navbar ul li:nth-child(1) a.active ~ .indicator { opacity: 1; left: calc(10% + 15px); } 
*/

/* =========================================
   CSS CHÂN TRANG (FOOTER)
   ========================================= */
.site-footer {
    background-color: #1a1a1a; /* Màu nền xám đậm giống ảnh */
    color: #aaaaaa;
    text-align: center;
    /* Cần padding-bottom lớn (khoảng 100px) để không bị thanh menu Liquid Glass che mất */
    padding: 30px 20px 100px 20px; 
    font-size: 14px;
    border-top: 1px solid #333;
    margin-top: 50px; /* Cách nội dung phía trên một khoảng */
}

.site-footer a {
    color: #00d2d3; /* Màu xanh cyan chủ đạo */
    text-decoration: none;
    transition: color 0.3s;
}

.site-footer a:hover {
    color: #ffffff;
    text-shadow: 0 0 5px #00d2d3;
}

.footer-top-links {
    margin-bottom: 15px;
    font-size: 15px;
}

.footer-logo {
    margin: 20px 0;
}

/* Style cho chữ Logo (Nếu bạn có ảnh logo thì dùng thẻ <img> thay thế) */
.footer-logo h2 {
    font-family: 'Arial Black', Impact, sans-serif;
    font-size: 36px;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(0, 210, 211, 0.6);
    letter-spacing: 2px;
    margin: 0;
}

.footer-copyright {
    margin-bottom: 15px;
    color: #dddddd;
}

.footer-tags {
    max-width: 900px;
    margin: 0 auto 15px auto;
    line-height: 1.6;
    color: #888888;
}

.footer-contact {
    margin-bottom: 20px;
    font-size: 15px;
    color: #cccccc;
}

/* Các link SEO phụ ở dưới cùng */
.footer-seo-links {
    max-width: 1000px;
    margin: 0 auto;
    font-size: 12px;
    line-height: 1.8;
}

.footer-seo-links a {
    color: #666666; /* Màu xám tối để không quá nổi bật */
}

.footer-seo-links a:hover {
    color: #00d2d3;
}




/* =========================================
   CĂN GIỮA TÊN PHIM CHO CẢ LAPTOP & ĐIỆN THOẠI
   ========================================= */
.movie-card h3 {
    text-align: center !important; 
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    /* Có thể thêm padding nhẹ để chữ không chạm sát 2 bên mép thẻ */
    padding-left: 5px !important;
    padding-right: 5px !important;
}











/* =========================================
   CSS TỐI ƯU CHO ĐIỆN THOẠI (MOBILE RESPONSIVE)
   ========================================= */
/* =========================================
   TỐI ƯU HÓA GIAO DIỆN DI ĐỘNG TỔNG HỢP (MOBILE)
   Chỉ kích hoạt khi màn hình nhỏ hơn 768px
   ========================================= */
@media screen and (max-width: 768px) {
    
    /* --- 1. HEADER & FOOTER --- */
    header { padding: 15px; }
    .logo { font-size: 20px !important; }
    
    .site-footer { padding: 20px 15px 80px 15px; }
    .footer-logo h2 { font-size: 24px; }
    .footer-seo-links { font-size: 11px; }

    /* --- 2. THANH MENU LƠ LỬNG --- */
    .navbar {
        height: 60px;
        bottom: 15px;
        width: 95%;
        border-radius: 30px;
    }
    .navbar ul li a { font-size: 14px; }

    /* --- 3. LƯỚI PHIM (TRANG CHỦ / LỊCH SỬ / TÌM KIẾM) --- */
    .movie-grid, .danh-sach-phim, .grid-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; /* Chia 2 cột đều nhau */
        gap: 8px !important;
        padding: 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .movie-card {
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* Ép ảnh bìa chuẩn tỷ lệ Poster, tự động thích ứng với mọi size điện thoại */
    .movie-card img {
        width: 100% !important;
        height: auto !important; /* Bỏ height cứng */
        aspect-ratio: 2 / 3 !important; /* Luôn giữ tỷ lệ chuẩn 2:3 */
        object-fit: cover !important;
    }

    /* Thu nhỏ và căn giữa chữ tiêu đề phim */
    .movie-card h3 {
        font-size: 13px !important;
        padding: 8px 5px !important;
        min-height: 40px; /* Dùng min-height thay vì height để chữ dài không bị cắt */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
    }

    /* --- 4. FORM ĐĂNG NHẬP --- */
    .auth-wrapper {
        margin: 20px auto 80px auto;
        padding: 20px;
        width: 95%;
        box-sizing: border-box;
    }

    /* --- 5. TRANG THÔNG TIN (Chống rớt dòng, ép ảnh sang trái) --- */
    #khu-vuc-thong-tin > div:first-child {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* Kiên quyết không rớt dòng */
        gap: 10px !important;
        padding: 5px !important;
    }
    
    #khu-vuc-thong-tin > div:first-child > div:nth-child(1) {
        width: 100px !important; /* Ép ảnh nhỏ lại nhường chỗ cho chữ */
        flex-shrink: 0 !important;
    }
    
    #khu-vuc-thong-tin > div:first-child > div:nth-child(2) {
        width: calc(100% - 110px) !important;
    }

    #khu-vuc-thong-tin strong {
        width: 70px !important; 
        font-size: 12px !important;
    }
    
    #khu-vuc-thong-tin span, #khu-vuc-thong-tin a {
        font-size: 12px !important;
    }








    
    /* =========================================
   FIX LỖI TÊN PHIM BỊ CẮT CHỮ TRÊN ĐIỆN THOẠI
   ========================================= */
.movie-card h3, .movie-card .ten-phim {
    font-size: 13px !important;
    line-height: 1.4 !important; /* Khoảng cách giữa 2 dòng chữ */
    padding: 8px 5px !important;
    margin: 0 !important;
    text-align: center !important;
    
    /* Ép chữ tự động rớt xuống tối đa 2 dòng, quá 2 dòng sẽ hiện dấu ... */
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    white-space: normal !important; /* Bắt buộc cho phép rớt dòng */
    min-height: 44px !important; /* Đảm bảo card phim cao bằng nhau dù tên dài hay ngắn */
}

/* =========================================
   FIX ĐỒNG BỘ CHỮ "TẬP" Ở TRANG THEO DÕI
   ========================================= */
.movie-card {
    position: relative !important; /* Khung chuẩn để chứa nhãn dán */
}

/* Ép nhãn dán "Tập..." hiển thị thanh đen mờ vắt ngang mép trên cùng */
.movie-card .tap, 
.movie-card .episode, 
.movie-card .tap-phim,
.movie-card > span:first-child { 
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background: rgba(0, 0, 0, 0.75) !important; /* Phủ nền đen mờ 75% */
    color: #00d2d3 !important; /* Chữ màu Cyan xịn xò */
    text-align: center !important;
    padding: 5px 0 !important;
    font-size: 12px !important;
    font-weight: bold !important;
    z-index: 2 !important;
    box-sizing: border-box !important;
}

/* Giữ nút X màu đỏ ở trang Theo Dõi nằm đè lên trên thanh đen */
.movie-card .btn-xoa-theo-doi,
.movie-card .remove-btn {
    z-index: 10 !important; 
}
/* =========================================
   /* =========================================
       FIX BẢNG THÔNG TIN PHIM (Chuẩn theo ID thực tế: #movie-detail-container)
       ========================================= */

    /* 1. Gọi đích danh Cột Ảnh: Bóp nhỏ từ 140px xuống 100px để nhường chỗ cho chữ */
    #movie-detail-container > div[style*="display: flex"] > div:first-child {
        width: 100px !important;
        min-width: 100px !important;
        flex-shrink: 0 !important;
    }

    /* 2. Gọi đích danh Cột Thông Tin: Ép cấm tràn khung (min-width: 0) */
    #movie-detail-container > div[style*="display: flex"] > div:nth-child(2) {
        flex: 1 !important;
        min-width: 0 !important; 
    }

    /* 3. Phép thuật Grid: Biến tất cả các dòng (Tập, Thể loại...) thành 2 cột */
    #movie-detail-container > div[style*="display: flex"] > div:nth-child(2) > div {
        display: grid !important;
        /* Cột nhãn 75px, Cột giá trị giãn tự động và bắt buộc rớt dòng */
        grid-template-columns: 75px minmax(0, 1fr) !important; 
        gap: 8px !important;
        align-items: start !important;
    }

    /* 4. CHỈNH DÒNG XEM PHIM: Nút trên - Nút dưới (Tối ưu cho điện thoại) */
    #movie-detail-container > div[style*="display: flex"] > div:nth-child(2) > div[style*="flex-wrap: wrap"] {
        display: grid !important;
        grid-template-columns: 75px minmax(0, 1fr) !important; /* Cột 1: 75px, Cột 2: Phần còn lại */
        gap: 8px !important;
        align-items: center !important;
    }

    /* Nhãn "Xem Phim" (ở cột 1) được lệnh kéo dài 2 dòng để đứng cân bằng cạnh 2 nút */
    #movie-detail-container > div[style*="display: flex"] > div:nth-child(2) > div[style*="flex-wrap: wrap"] > :first-child {
        grid-row: span 2 !important; /* Thần chú kéo dài 2 dòng */
        grid-column: 1 !important;
        margin: 0 !important;
    }

    /* Ép 2 nút (Xem Từ Đầu, Xem Mới Nhất) dạt hết sang cột 2 và nằm đè lên nhau */
    #movie-detail-container > div[style*="display: flex"] > div:nth-child(2) > div[style*="flex-wrap: wrap"] > a,
    #movie-detail-container > div[style*="display: flex"] > div:nth-child(2) > div[style*="flex-wrap: wrap"] > button {
        grid-column: 2 !important; /* Bắt buộc cả 2 nút phải nhảy sang cột bên phải */
        width: 100% !important;    /* Kéo dài nút tràn hết cột để cực kỳ dễ bấm */
        box-sizing: border-box !important;
        text-align: center !important;
        padding: 8px 10px !important; /* Làm nút mập mạp lên một chút */
        margin: 0 !important;
        font-size: 12px !important;
    }

    /* 5. Ép chữ (3D - Tiên Hiệp, Đang cập nhật...) phải rớt dòng */
    #movie-detail-container > div[style*="display: flex"] > div:nth-child(2) > div > * {
        word-wrap: break-word !important; 
        font-size: 13px !important;
        line-height: 1.4 !important;
        margin: 0 !important;
    }

}






/* --- CSS CHO KHUNG CHỌN TẬP --- */
.episode-list {
    display: grid;
    /* Tự động chia cột: mỗi nút rộng tối thiểu 80px */
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.episode-btn {
    background-color: #1e1e1e;
    color: #ccc;
    padding: 10px 5px;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid #333;
    font-size: 14px;
    transition: all 0.2s ease;
}

.episode-btn:hover {
    background-color: #2a2a2a;
    border-color: #00d2d3;
    color: #00d2d3;
}

/* Màu của tập đang xem */
.episode-btn.active {
    background-color: #00d2d3;
    color: #000;
    font-weight: bold;
    border-color: #00d2d3;
    pointer-events: none; /* Không cho bấm lại tập đang xem */
}







/* =========================================
   CSS CHO BIỂU TƯỢNG THANH MENU
   ========================================= */
.navbar ul li a i {
    font-size: 22px; /* Chỉnh độ to nhỏ của icon tại đây */
    transition: 0.3s;
    /* Căn giữa icon hoàn hảo */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Đảm bảo khi icon được chọn (active) hoặc di chuột (hover) sẽ đổi màu */
.navbar ul li a:hover i,
.navbar ul li a.active i {
    color: hsl(0, 100%, 50%); /* Hoặc màu nào tùy thuộc vào thiết kế Liquid Glass của bạn */
    transform: scale(1.1); /* Hiệu ứng phóng to nhẹ khi bấm vào */
}

/* =========================================
   CSS CHO NÚT THEO DÕI TRANG THEO DÕI


   /* =========================================
   CSS KHU VỰC BÌNH LUẬN
   ========================================= */
.comment-box {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}
.comment-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #444;
}
.comment-input-area {
    flex: 1;
}
#noi-dung-binh-luan {
    width: 100%;
    background-color: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 15px;
    border-radius: 6px;
    min-height: 80px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}
#noi-dung-binh-luan:focus {
    outline: none;
    border-color: #00d2d3;
}
.btn-post-comment {
    background-color: #00b894; /* Màu xanh ngọc giống ảnh */
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.btn-post-comment:hover { background-color: #00d2d3; }

/* Các bình luận của người dùng */
.user-comment {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}
.user-comment .comment-info {
    margin-bottom: 5px;
}
.user-comment .comment-name {
    color: #00d2d3;
    font-weight: bold;
    font-size: 14px;
    margin-right: 10px;
}
.user-comment .comment-time {
    color: #888;
    font-size: 12px;
}
.user-comment .comment-text {
    color: #ddd;
    font-size: 14px;
    line-height: 1.5;
}