/* Reset cơ bản (GIỮ NGUYÊN) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #e8f3f9;
}

/* Biến container thành một khối Flex dọc, khóa chết chiều cao bằng đúng màn hình (100vh) */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: #fff;
    height: 100vh; /* Đổi từ min-height thành height */
    display: flex;
    flex-direction: column;
    padding-bottom: 60px; /* Chừa đúng 60px cho thanh điều hướng dưới */
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    overflow: hidden; /* Khóa cuộn toàn trang web, cắt bỏ mọi thứ tràn ra ngoài */
}

/* Ngăn không cho các phần tử phía trên bị bóp méo khi màn hình nhỏ */
.top-header, .hero-banner, .action-buttons {
    flex-shrink: 0;
}

img {
    max-width: 100%;
    display: block;
}

/* =========================================
   PHẦN CSS MỚI CHO HEADER VÀ TIN TỨC
   ========================================= */

/* Container thanh Header - Dàn ngang 3 phần tử */
.header-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between; 
    height: 70px; 
    padding: 0 10px;
    position: relative;
    
    /* Bỏ ảnh nền cũ đi */
    /* background-image: url('image_f47a63.png'); 
       background-size: cover;
       background-position: center;
       background-repeat: no-repeat; */
       
    /* Thay bằng mã màu bạn muốn (Ví dụ: màu trắng #ffffff) */
    background-color: #e8f3f9; 
}

/* Nút 3 gạch ngang */
.menu-toggle {
    background: none;
    border: none;
    color: #34aadc; 
    font-size: 26px; 
    cursor: pointer;
    padding: 5px;
    z-index: 2; 
}

/* Căn giữa Logo */
.header-logo {
    flex: 1; 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.header-logo img {
    height: 45px; 
    width: auto;
    object-fit: contain;
}

/* Chữ ww88.hot bên phải */
.header-domain {
    color: #34aadc; 
    font-size: 14px;
    font-weight: bold;
    z-index: 2;
}

/* Ticker Tin Tức (Đã cập nhật lại màu sắc) */
.news-ticker {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
}

.news-ticker i {
    color: #34aadc; 
    font-size: 14px;
}

.news-ticker marquee {
    margin-left: 10px;
    color: #555;
    font-size: 13px;
}

/* Action Buttons (Flexbox) */
.action-buttons {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: #fff;
}
.action-buttons button {
    flex: 1;
    margin: 0 5px;
    padding: 8px 0;
    background-color: #4da6ff; /* Màu xanh nước biển */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
}
.action-buttons button i {
    font-size: 18px;
    margin-bottom: 5px;
}

/* Layout chính sẽ tự động phình to chiếm toàn bộ khoảng trống còn lại bên dưới Banner/Nút bấm */
.main-layout {
    display: flex;
    flex: 1; /* Thuộc tính quan trọng nhất: Tự động điền đầy không gian dọc */
    overflow: hidden; /* Giữ các thanh cuộn nằm bên trong */
    border-top: 1px solid #ddd;
}

/* Sidebar bên trái */
.sidebar {
    width: 25%;
    background-color: #eaf3fd;
    display: flex;
    flex-direction: column;
    height: 100%; /* Cập nhật lại: Chỉ cao bằng đúng vùng main-layout */
    overflow-y: auto;
}
.sidebar::-webkit-scrollbar {
    display: none;
}

/* Ẩn thanh cuộn (scrollbar) của sidebar cho giống app */
.sidebar::-webkit-scrollbar {
    display: none;
}

/* Các nút danh mục trò chơi */
.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 5px;
    margin: 5px 8px; /* Tạo khoảng cách xung quanh để bo góc nút active đẹp hơn */
    border-radius: 8px; /* Bo góc nhẹ */
    text-align: center;
    font-size: 11px;
    color: #555;
    font-weight: bold;
    cursor: pointer;
    border-bottom: none; /* Bỏ viền gạch dưới cũ */
}

/* Căn chỉnh Logo thay cho thẻ Icon cũ */
.category-item img {
    width: 38px; /* Chỉnh độ to nhỏ của logo tại đây */
    height: 38px;
    object-fit: contain;
    margin-bottom: 5px;
}

/* Nút Đang Được Chọn (Active) - Thiết kế giống khối xanh nổi lên */
.category-item.active {
    background-color: #43a2e3; /* Màu xanh chủ đạo */
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2); /* Tạo hiệu ứng đổ bóng nổi 3D */
}
/* Grid bên phải */
.game-grid {
    width: 75%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 8px;
    padding: 10px;
    padding-bottom: 20px; /* Thêm một chút đệm dưới cùng để thẻ game không dính sát đáy */
    background-color: #fff;
    align-content: start;
    height: 100%; /* Cập nhật lại: Chỉ cao bằng đúng vùng main-layout */
    overflow-y: auto;
}
.game-grid::-webkit-scrollbar {
    display: none;
}

/* Ẩn thanh cuộn (scrollbar) cho giống app điện thoại */
.game-grid::-webkit-scrollbar {
    display: none;
}

.game-card {
    text-align: center;
    cursor: pointer;
}

.game-card img {
    width: 100%;
    border-radius: 12px; /* Bo góc mềm mại giống ảnh mẫu */
    margin-bottom: 5px;
    object-fit: cover;
    aspect-ratio: 1 / 1; /* Cắt ảnh thành hình vuông đều nhau bất kể kích thước gốc */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Đổ bóng nhẹ cho ảnh nổi lên */
}

.game-card p {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 2px;
}

/* Thanh điều hướng dưới cùng (Fixed) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px; /* Phải bằng với max-width của app-container */
    display: flex;
    justify-content: space-around;
    background-color: #4da6ff;
    padding: 10px 0;
}
.nav-item {
    text-decoration: none;
    color: white;
    text-align: center;
    font-size: 11px;
}
.nav-item i {
    font-size: 20px;
    margin-bottom: 3px;
}
/* Thêm trạng thái active cho thanh điều hướng dưới cùng */
.nav-item.active {
    color: #fff; /* Màu trắng sáng */
    font-weight: bold;
    transform: scale(1.1); /* Phóng to nhẹ một chút để tạo điểm nhấn */
    transition: all 0.2s ease-in-out;
}

/* Thêm transition cho mượt mà */
.nav-item {
    transition: all 0.2s ease-in-out;
    color: #e0e0e0; /* Màu hơi mờ đi khi không được chọn */
}
/* =========================================
   CSS CHO BANNER SLIDER
   ========================================= */
.hero-banner {
    width: 100%;
    overflow: hidden; /* Cắt bỏ phần ảnh tràn ra ngoài màn hình */
    position: relative;
    background-color: #fff;
}

.slider-track {
    display: flex;
    width: 100%;
    transition: transform 0.5s ease-in-out; /* Hiệu ứng trượt ngang mượt mà trong 0.5 giây */
}

.slider-track img {
    width: 100%; /* Ép mỗi ảnh hiển thị vừa đúng 100% chiều rộng điện thoại */
    flex-shrink: 0; /* Chống việc flexbox bóp méo chiều ngang của ảnh */
    object-fit: cover;
}
/* =========================================
   CSS CHO FORM ĐĂNG NHẬP / ĐĂNG KÝ
   ========================================= */
.modal-overlay {
    display: none; /* Ẩn form mặc định, chỉ hiện khi gọi bằng JS */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 400px;
    border-radius: 10px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-content::-webkit-scrollbar { display: none; } /* Ẩn thanh cuộn */

.close-btn {
    position: absolute;
    top: 15px; right: 15px;
    font-size: 22px;
    color: #666;
    cursor: pointer;
    z-index: 10;
}

.modal-logo {
    text-align: center;
    padding: 30px 0 10px;
}
.modal-logo img { height: 80px; margin: 0 auto; }

/* Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 2px solid #43a2e3;
    margin: 0 20px;
}
.tab-btn {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    position: relative;
}
.tab-btn.active { color: #43a2e3; }
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #43a2e3;
}

/* Khung chứa Form */
.auth-forms-container {
    background-color: #eaf3fd;
    padding: 20px;
}
.auth-form { display: none; }
.auth-form.active { display: block; }

/* Các ô Input của form Đăng Nhập */
.input-group {
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    margin-bottom: 12px;
}
.input-group i:first-child { color: #666; width: 25px; }
.input-group input {
    flex: 1; border: none; outline: none; font-size: 14px;
}
.forgot-link { font-size: 12px; color: #666; margin-right: 10px; cursor: pointer; }
.toggle-pw { cursor: pointer; color: #666; }

/* Các ô Input của form Đăng Ký */
.form-group-reg { margin-bottom: 12px; }
.form-group-reg label {
    display: block; font-size: 13px; color: #43a2e3; font-weight: bold; margin-bottom: 5px;
}
.form-group-reg label i { font-size: 10px; margin-right: 5px; }
.form-group-reg input, .input-with-icon {
    width: 100%; border: none; border-radius: 8px; padding: 10px 15px; font-size: 14px; outline: none; background: #fff;
}
.input-with-icon { display: flex; padding: 0; align-items: center; }
.input-with-icon input { padding: 10px 15px; border-radius: 8px 0 0 8px; }
.input-with-icon i { padding: 0 15px; cursor: pointer; color: #666; }
.form-group-reg .hint { font-size: 11px; color: #888; margin-top: 5px; }

/* Checkbox Đăng Ký */
.checkbox-group { font-size: 12px; display: flex; align-items: center; margin-bottom: 15px; }
.checkbox-group input { margin-right: 8px; }
.checkbox-group a { color: #ff8c00; text-decoration: none; }

/* Nút Submit */
.submit-btn {
    width: 100%; padding: 12px;
    border: none; border-radius: 8px;
    color: #fff; font-weight: bold; font-size: 16px;
    cursor: pointer; background-color: #43a2e3;
    margin-bottom: 15px;
}
.register-btn { background-color: #88c5e6; } /* Màu nhạt hơn cho Đăng ký */

/* Nút Chơi thử / CSKH */
.extra-actions { display: flex; justify-content: space-between; gap: 10px; }
.outline-btn {
    flex: 1; padding: 10px;
    border: 1px solid #43a2e3; border-radius: 8px;
    background: transparent; color: #43a2e3; font-size: 12px; cursor: pointer;
}