:root {
    --bg-dark: #f0f2f5;      
    --bg-panel: #ffffff;     
    --primary-color: #c77dff; 
    --text-main: #333333;    
    --text-muted: #888888;   
    --border-color: #e4e4e4; 
    --input-bg: #f9f9f9;     
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: sans-serif; }
/* =========================================
   CẤU HÌNH NỀN GIAO DIỆN CHUNG (SÁNG MỜ)
   ========================================= */
body { 
    color: var(--text-main); 
    overflow-x: hidden; 
    min-height: 100vh;
    position: relative; 
    background-color: #f0f2f5; /* Đổi màu dự phòng sang xám/trắng nhạt */
}

/* Tạo lớp nền mờ trắng (Frosted Glass) */
body::before {
    content: "";
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    
    /* Phủ một lớp màu trắng (rgba) có độ trong suốt 70% đè lên tấm ảnh */
    background-image: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.7)), url('images/bg.jpg'); 
    
    background-size: cover; 
    background-position: center; 
    background-repeat: no-repeat;
    
    /* Chỉ giữ lại hiệu ứng làm mờ ảnh (blur), bỏ làm tối (brightness) */
    filter: blur(8px); 
    
    /* Phóng to ảnh nhẹ để giấu viền mờ */
    transform: scale(1.1); 
    
    z-index: -1; 
}
/* Navbar */
.navbar { position: sticky; top: 0; background: var(--bg-panel); display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.menu-btn, .avatar { background: none; border: none; color: var(--text-main); font-size: 24px; cursor: pointer; }
.avatar { background: #e4e6eb; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; transition: 0.3s;}
.avatar.logged-in { border: 2px solid var(--primary-color); box-shadow: 0 0 10px rgba(199, 125, 255, 0.4); }
.logo { font-weight: bold; font-size: 20px; letter-spacing: 1px; color: var(--text-main); }
.neon-text { color: var(--primary-color); font-weight: bold; }

/* Overlay */
.overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 101; backdrop-filter: blur(2px); }
.overlay.active { display: block; }

/* Sidebar */
.sidebar { position: fixed; top: 0; left: -300px; width: 280px; height: 100%; background: var(--bg-panel); z-index: 102; transition: 0.3s ease; padding: 20px; box-shadow: 2px 0 15px rgba(0,0,0,0.05); }
.sidebar.active { left: 0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.close-btn:hover { color: var(--text-main); }
.sidebar-menu { list-style: none; }
.sidebar-menu li { margin-bottom: 15px; }
.sidebar-menu a { color: var(--text-main); text-decoration: none; font-size: 16px; display: block; padding: 10px; border-radius: 5px; background: var(--input-bg); transition: 0.2s; border: 1px solid transparent; }
.sidebar-menu a:hover { border-color: var(--primary-color); color: var(--primary-color); background: #fdf5ff; }

/* Modal Chung */
.modal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 420px; background: var(--bg-panel); z-index: 103; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); border: 1px solid var(--border-color); }
.modal.active { display: block; }
.modal-header { display: flex; justify-content: space-between; padding: 20px 20px 0; }

/* Pop-up Thông tin user */
.modal-body { padding: 20px; }
.balance-box { display: flex; justify-content: space-between; background: var(--input-bg); padding: 15px; border-radius: 8px; margin: 15px 0; border: 1px solid var(--border-color); }
.balance-item { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.divider { border: 0; border-top: 1px solid var(--border-color); margin: 15px 0; }
.action-btn { width: 100%; padding: 10px; margin-top: 10px; background: var(--primary-color); border: none; color: white; font-weight: bold; border-radius: 5px; cursor: pointer; }
.logout-btn { background: #ff4d4f; margin-top: 20px; transition: background 0.3s; }
.logout-btn:hover { background: #d9363e; }

/* Layout Form Dọc (Auth) */
.auth-body { padding: 0 20px 30px; }
.form-group-vertical { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; }
.form-input-large { width: 100%; padding: 15px; background: var(--input-bg); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 6px; outline: none; font-size: 15px; transition: 0.3s; }
.form-input-large:focus { border-color: var(--primary-color); box-shadow: 0 0 5px rgba(199, 125, 255, 0.3); background: #ffffff; }
.action-btn-large { width: 100%; padding: 15px; background: var(--primary-color); border: none; color: white; font-weight: bold; font-size: 16px; border-radius: 6px; cursor: pointer; transition: 0.3s; text-transform: uppercase; }
.action-btn-large:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(199, 125, 255, 0.4); }
.auth-footer { margin-top: 30px; padding-top: 20px; text-align: center; font-size: 15px; color: var(--text-main); border-top: 1px solid var(--border-color); background: #fafafa; border-radius: 8px; padding-bottom: 20px; }
.toggle-link { color: var(--primary-color); cursor: pointer; font-weight: bold; margin-left: 5px; }
.toggle-link:hover { text-decoration: underline; }

/* Banner */
.banner-container { width: 100%; overflow: hidden; margin-top: 10px; }
.banner-slider { display: flex; transition: transform 0.5s ease; width: 300%; }
.banner { width: 100%; display: flex; align-items: center; justify-content: center; }
.banner img { width: 100%; height: auto; max-height: 250px; object-fit: cover; border-radius: 8px; }

/* Vòng Quay May Mắn */
.lucky-wheel-section { text-align: center; padding: 40px 20px; }
.section-title { margin-bottom: 10px; font-size: 24px; color: var(--primary-color); text-transform: uppercase; }
.spin-count-display { text-align: center; font-size: 16px; margin-bottom: 20px; color: var(--text-main); font-weight: bold; }
.spin-count-display strong { font-size: 22px; }

.wheel-container { position: relative; width: 300px; height: 300px; margin: 0 auto; }
.pointer { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-size: 35px; color: #ff4d4f; z-index: 10; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.wheel { width: 100%; height: 100%; border-radius: 50%; transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99); border: none; box-shadow: none; background: transparent; }
.spin-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 65px; height: 65px; border-radius: 50%; background: #ffaa00; color: #fff; font-weight: bold; border: 3px solid #fff; cursor: pointer; box-shadow: 0 0 15px rgba(0,0,0,0.5); z-index: 5; }

/* History Section */
.history-section { padding: 20px; max-width: 900px; margin: 0 auto; margin-bottom: 50px; }
.history-container { display: flex; gap: 20px; flex-wrap: wrap; }
.history-box { flex: 1; min-width: 300px; background: var(--bg-panel); border-radius: 10px; padding: 15px; border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.history-box h3 { margin-bottom: 15px; font-size: 18px; color: var(--text-main); text-align: center; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.history-list { height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 5px; }
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-track { background: var(--input-bg); border-radius: 5px; }
.history-list::-webkit-scrollbar-thumb { background: #dcdcdc; border-radius: 5px; }
.history-item { background: var(--input-bg); padding: 12px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; animation: slideIn 0.4s ease-out; border: 1px solid var(--border-color); }
.user-time { display: flex; flex-direction: column; gap: 4px; }
.user-time strong { color: var(--text-main); font-size: 15px; }
.time-text { color: var(--text-muted); font-size: 12px; }
.action-receive { color: #00b960; font-weight: bold; text-align: right; }
.action-withdraw { color: #ff4d4f; font-weight: bold; text-align: right; }
.source-text { font-size: 11px; color: var(--text-muted); font-weight: normal; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Các section ẩn/hiện */
.withdraw-section, .deposit-section { max-width:600px; margin:30px auto; padding:20px; }
.withdraw-box { background:white; border-radius:12px; padding:20px; border:1px solid var(--border-color); display:flex; flex-direction:column; gap:15px; }
.diamond-balance { text-align:center; font-size:18px; font-weight:bold; padding:15px; border-radius:8px; background:#f8f8f8; }

/* Thông báo xanh */
.notification { position:fixed; top:20px; right:20px; background:#00b960; color:#fff; padding:15px 20px; border-radius:10px; font-weight:bold; z-index:9999; opacity:0; transform:translateY(-20px); transition:.3s; }
.notification.show { opacity:1; transform:translateY(0); }
/* =========================================
   HIỆU ỨNG MƯỢT MÀ CHUNG
   ========================================= */
html {
    scroll-behavior: smooth; /* Cuộn trang mượt mà */
}

/* Hiệu ứng hiện ra từ từ cho các section khi click đổi menu */
section {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   MENU NGANG DƯỚI BANNER (Dạng Tab Gạch Dưới)
   ========================================= */
.horizontal-menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px auto 30px auto;
    max-width: 900px;
    padding: 0;
    border-bottom: 2px solid var(--border-color); /* Kẻ ngang dưới toàn bộ menu */
    position: relative; 
    z-index: 10;        
    overflow-x: auto;   /* Hỗ trợ vuốt ngang nếu màn hình quá bé */
    white-space: nowrap;
}

/* Ẩn thanh cuộn ngang trên mobile */
.horizontal-menu::-webkit-scrollbar {
    display: none;
}

/* CẤU HÌNH MẶC ĐỊNH CHO MÁY TÍNH (PC) */
.horizontal-menu a {
    text-decoration: none;
    flex: 1;
    text-align: center;
    padding: 12px 10px;
    font-weight: bold;
    font-size: 16px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent; /* Chờ hover/active */
    transition: all 0.2s ease;
    cursor: pointer;
}

/* Thanh dọc phân chia giữa các ô */
.horizontal-menu a:not(:last-child) {
    border-right: 1px solid var(--border-color); 
}

.horizontal-menu a:hover, 
.horizontal-menu a.active {
    color: var(--primary-color);
    background: transparent;
    border-bottom: 3px solid var(--primary-color); /* Gạch dưới màu tím */
}

/* =========================================================
   CẤU HÌNH DÀNH RIÊNG CHO ĐIỆN THOẠI (Màn hình dưới 768px)
   ========================================================= */
@media (max-width: 768px) {
    .horizontal-menu {
        margin: 10px auto 20px auto;
        padding: 0;
    }
    
    .horizontal-menu a {
        font-size: 11px; /* Thu nhỏ chữ để vừa khít 1 dòng dọc màn hình */
        padding: 10px 2px; /* Tối ưu khoảng cách đệm */
        letter-spacing: -0.3px;
        border-bottom-width: 2px;
    }

    /* Làm thanh dọc phân chia rõ ràng hơn một chút trên điện thoại */
    .horizontal-menu a:not(:last-child) {
        border-right: 1px solid rgba(0, 0, 0, 0.12); 
    }

    .horizontal-menu a:hover, 
    .horizontal-menu a.active {
        border-bottom-width: 2px;
    }
}