@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
  --theme-color: #FFD700;
  --bg-dark: #1a1a1a;
  --bg-darker: #000000;
  --text-light: #e6eef3;
  --gradient-btn: linear-gradient(90deg, #ca2626, #5f0f0f);
}

* { box-sizing: border-box; }

body {
  background: var(--bg-darker);
  color: var(--text-light);
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* ================= HEADER & PROFILE ================= */
header {
  background: var(--bg-dark);
  padding: 10px;
  box-shadow: 0 7px 10px rgba(0,0,0,0.3);
  position: relative; /* Quan trọng để giữ nút đăng nhập */
}

/* NÚT ĐĂNG NHẬP */
.auth-info {
  position: absolute;
  right: 20px;
  top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  z-index: 100;
}

.viewer-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#viewerPoints { margin: 0; font-size: 14px; color: #00ff99; }
#viewerName { color: #ccc; }

.auth-info button {
  background: var(--gradient-btn);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
}

.auth-info button:hover { opacity: 0.9; }
.auth-info button.hidden { display: none; }

/* PROFILE STREAMER */
.profile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  color: white;
  padding: 25px 20px;
}

.profile .avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid #fff;
  object-fit: cover;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.555);
}

.profile .info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.4;
}

.profile .info h1 {
  margin: 0;
  font-size: 2em;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
}

.profile .info p {
  margin: 4px 0 8px 0;
  color: #ccc;
  font-size: 1em;
}

.verified svg {
  width: 20px;
  height: 20px;
  fill: #1da1f2;
  margin-left: 6px;
  filter: drop-shadow(0 0 3px rgba(29,161,242,0.6));
}

/* Social Icons */
.social-links {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 5px;
}

.social-links a {
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, color 0.2s;
}

.social-links a:hover {
  transform: translateY(-3px);
  color: var(--theme-color);
}

.social-links svg { width: 24px; height: 24px; fill: currentColor; }

/* ================= LAYOUT ================= */
.main-layout {
  display: flex;
  max-width: 1100px;
  margin: 30px auto;
  gap: 20px;
  padding: 0 15px;
}

/* ================= DONATE PANEL ================= */
.donate-panel {
  flex: 1;
  background: var(--bg-dark);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.donate-panel input, 
.donate-panel textarea, 
.popup-content input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid #444;
  background: #0f0f0f;
  color: #fff;
  font-family: inherit;
  outline: none;
  transition: border 0.3s;
}

.donate-panel input:focus, .donate-panel textarea:focus { border-color: var(--theme-color); }
textarea { resize: none; height: 80px; }

.preset-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.preset {
  flex: 1;
  min-width: 80px;
  background: transparent;
  border: 1px solid #666;
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  color: #fff;
  transition: 0.2s;
}

.preset:hover { border-color: var(--theme-color); background: rgba(255, 255, 255, 0.05); }

.donate-btn {
  width: 100%;
  padding: 14px;
  background: var(--gradient-btn);
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  margin-top: 10px;
  transition: transform 0.1s;
}

.donate-btn:active { transform: scale(0.98); }
.donate-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Thanh tiến độ */
.progress {
  margin-top: 20px;
  background: #333;
  border-radius: 10px;
  height: 12px;
  overflow: hidden;
  position: relative;
}

.bar {
  height: 100%;
  background: var(--gradient-btn);
  width: 0%;
  transition: width 0.5s ease;
}

.progress span {
  font-size: 10px;
  color: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
  text-shadow: 0 0 2px #000;
  width: 100%;
  text-align: center;
}

/* Tổng quan khu vực vòng quay */
.wheel-section {
    background: #111;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #333;
    margin-top: 20px;
}

.wheel-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .wheel-grid { flex-direction: column; }
}

/* Cột nhập liệu (Trái) */
.wheel-input-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#wheelAmount {
    background: #222 !important;
    color: #ffcc00 !important; /* Màu vàng cho giá tiền */
    font-weight: bold;
    border: 1px solid #444;
}

/* Cột danh sách (Phải) - GIỐNG HÌNH */
.wheel-list-col {
    flex: 1;
    background: #181818; /* Nền tối hơn */
    border-radius: 8px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    height: 390px; /* Chiều cao cố định để cuộn */
    overflow: hidden;
}

.list-header {
    background: #222;
    padding: 12px 15px;
    border-bottom: 1px solid #333;
    font-weight: 700;
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Khu vực cuộn danh sách */
#spinList {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Khoảng cách giữa các ô */
}

/* Từng dòng phần thưởng (ITEM) */
.spin-item {
    display: flex;
    justify-content: space-between; /* Đẩy tên và % ra 2 bên */
    align-items: center;
    background: #2a2a2a; /* Màu nền xám của ô */
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
    transition: 0.2s;
}

.spin-item:hover {
    background: #333; /* Sáng hơn khi di chuột vào */
    border-color: #555;
}

/* Tên phần thưởng */
.spin-text {
    color: #eee;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Cắt chữ nếu dài quá */
    max-width: 70%;
}

/* Tỉ lệ % (Màu xanh neon) */
.spin-rate {
    color: #00ffcc; /* Màu xanh giống hình */
    font-weight: 800;
    font-size: 14px;
}

/* Tùy chỉnh thanh cuộn (Scrollbar) cho đẹp */
.custom-scroll::-webkit-scrollbar { width: 6px; }
.custom-scroll::-webkit-scrollbar-track { background: #1a1a1a; }
.custom-scroll::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #666; }

/* ================= SIDEBAR & LEADERBOARD ================= */
.side-panels { width: 320px; display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--bg-dark); border-radius: 12px; padding: 15px; }
.panel h3 { margin-top: 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 15px; }
.tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
}
.tab.active { background: var(--gradient-btn); }

/* Leaderboard Styles */
#leaderboard-list { display: flex; flex-direction: column; }
.lb-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.lb-item:last-child { border-bottom: none; }
.lb-rank {
  width: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.lb-rank svg { width: 20px; height: 20px; }
.lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.1);
}
.lb-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-amount { font-weight: 600; font-size: 14px; color: #fff; text-align: right; }

.top-1 .lb-name, .top-1 .lb-amount { color: #FFD700; }
.top-2 .lb-name, .top-2 .lb-amount { color: #C0C0C0; }
.top-3 .lb-name, .top-3 .lb-amount { color: #FFA500; }

/* Recent Styles */
#recent { display: flex; flex-direction: column; gap: 15px; }
.rc-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.rc-item:last-child { border-bottom: none; }
.rc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.2);
}
.rc-content { flex: 1; min-width: 0; }
.rc-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rc-name { font-weight: 700; color: #fff; font-size: 15px; }
.rc-date { font-size: 12px; color: #888; }
.rc-body { color: #ccc; line-height: 1.4; }
.rc-amount { color: #FFD700; font-weight: 600; }

/* Top Rank Highlight */
#leaderboard-list .lb-item:nth-child(1) { background: linear-gradient(90deg, #ffd90010, transparent); }
#leaderboard-list .lb-item:nth-child(2) { background: linear-gradient(90deg, #c0c0c010, transparent); }
#leaderboard-list .lb-item:nth-child(3) { background: linear-gradient(90deg, #cd7f3210, transparent); }

/* ================= POPUPS ================= */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}

.popup.active { display: flex !important; }
.popup.hidden { display: none !important; }

.popup-content {
  background: #252525;
  padding: 30px;
  border-radius: 16px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border: 1px solid #444;
}

.popup-content img { width: 200px; border-radius: 10px; margin: 15px 0; border: 2px solid #fff; }

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
}
.close-btn:hover { color: #fff; }

#toggleText a { color: #ca2626; text-decoration: none; font-weight: bold;}
#toggleText a:hover { text-decoration: underline; }

/* ================= RESPONSIVE MOBILE (BẢN FIX LỖI CHIỀU CAO) ================= */
@media (max-width: 768px) {
    /* 1. Layout chung */
    .main-layout { flex-direction: column; padding: 0 10px; }
    .side-panels { width: 100%; }
    
    /* 2. Header */
    .profile { 
        flex-direction: column-reverse; 
        text-align: center; 
        padding: 15px 10px; 
        gap: 15px; 
    }
    .profile-left { flex-direction: column; gap: 10px; }
    .avatar { width: 80px; height: 80px; }
    .streamer-info h1 { justify-content: center; font-size: 20px; }
    .social-links { justify-content: center; }
    
    /* 3. Auth & Nút nạp */
    .auth-container { 
        width: 100%; 
        flex-direction: column; 
        gap: 12px; 
        padding: 15px;
        background: #252525; 
        margin-bottom: 5px;
    }
    .user-info { text-align: center; display: flex; flex-direction: column; align-items: center; width: 100%; }
    .auth-buttons { width: 100%; justify-content: center; }
    .btn-auth { flex: 1; max-width: 140px; padding: 10px; }

    /* 4. Vòng quay */
    .wheel-grid { flex-direction: column; }
    
    /* [QUAN TRỌNG] Khắc phục lỗi hiển thị 2px */
    /* Áp dụng cho cả 2 tên class có thể bạn đang dùng */
    .wheel-col-right, 
    .wheel-list-col { 
        height: 450px !important;       /* Ép chiều cao cố định */
        min-height: 450px !important;   /* Đảm bảo không bị co lại */
        display: flex !important;       /* Đảm bảo flex hoạt động */
    }
    
    /* Ẩn bớt input giá trên mobile cho đỡ chật (tùy chọn) */
    #wheelAmount { margin-bottom: 5px; }

    /* 5. Chỉnh bé các thành phần phụ */
    .lb-avatar { width: 30px; height: 30px; margin: 0 5px; }
    .lb-name, .lb-amount { font-size: 13px; }
    .rc-avatar { width: 32px; height: 32px; }
    .rc-name { font-size: 13px; }
}
/* --- CSS CHO ẨN/HIỆN PASSWORD --- */
.password-wrapper {
    position: relative;
    width: 100%;
}
.password-wrapper input {
    padding-right: 40px; /* Chừa chỗ cho con mắt */
}
.toggle-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    color: #888;
    user-select: none; /* Không cho bôi đen */
}
.toggle-eye:hover {
    color: #fff;
}
#footer {
  text-align: center;
  padding: 15px;
  font-size: 14px;
  color: #666;
}