@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;800&display=swap');

* { box-sizing: border-box; font-family: 'Nunito', sans-serif; }

body {
    margin: 0; height: 100vh;
    background: linear-gradient(-45deg, #ff9a9e, #fecfef, #a18cd1, #fbc2eb);
    background-size: 400% 400%; animation: gradientBG 15s ease infinite;
    display: flex; justify-content: center; align-items: center; position: relative;
}

@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.glass-panel {
    background: rgba(255, 255, 255, 0.4); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 25px; box-shadow: 0 15px 35px rgba(0,0,0,0.1); overflow: hidden;
}

/* AUTH SCREEN */
.auth-container { width: 100%; max-width: 380px; padding: 30px; text-align: center; }
.auth-container h2 { color: #5e35b1; margin-top: 0; font-weight: 800; }
.auth-container input, .auth-container select { width: 100%; padding: 12px; margin: 8px 0; border-radius: 12px; border: none; background: rgba(255,255,255,0.8); outline: none; font-weight: bold;}
.auth-container button { width: 100%; padding: 12px; border: none; border-radius: 12px; background: linear-gradient(90deg, #ff758c, #ff7eb3); color: white; font-weight: bold; cursor: pointer; transition: 0.2s; margin-top: 10px;}
.auth-container button:hover { transform: scale(1.05); }
.switch-auth { margin-top: 15px; font-size: 14px; color: #444; cursor: pointer; text-decoration: underline; }

/* CHAT SCREEN */
.chat-container { width: 100%; max-width: 420px; height: 100vh; max-height: 800px; display: none; flex-direction: column; position: relative; }
.header { background: rgba(255, 255, 255, 0.3); padding: 15px; font-weight: bold; text-align: center; color: #5e35b1; position: relative; border-bottom: 1px solid rgba(255,255,255,0.5); display: flex; flex-direction: column; align-items: center; justify-content: center;}

.status-bars { display: flex; gap: 10px; margin-top: 5px; font-size: 12px; }
.cat-bar { background: rgba(255,255,255,0.7); padding: 4px 10px; border-radius: 12px; color: #d35400;}
.streak-bar { background: #e0f7fa; color: #006064; padding: 4px 10px; border-radius: 12px;}

.logout-btn { position: absolute; right: 15px; top: 14px; background: transparent; color: #ff4757; border: none; cursor: pointer; font-size: 16px; }

.chat { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; }
.message { max-width: 80%; padding: 12px 16px; margin: 8px 0; border-radius: 18px; font-size: 15px; word-wrap: break-word; animation: popIn .3s; }
.user { background: linear-gradient(90deg, #7b61ff, #9b82ff); color: white; margin-left: auto; border-bottom-right-radius: 4px; }
.ai { background: rgba(255,255,255,0.9); color: #333; margin-right: auto; border-bottom-left-radius: 4px; }
.error-msg { background: #ffebee; border: 1px solid #ffcdd2; color: #c62828; font-size: 13px; }

.input-box { display: flex; padding: 12px; background: rgba(255,255,255,0.3); }
.input-box input { flex: 1; padding: 12px; border-radius: 15px; border: none; background: rgba(255,255,255,0.8); outline: none; }
.input-box button { margin-left: 10px; padding: 0 20px; border: none; border-radius: 15px; background: #7b61ff; color: white; font-weight: bold; cursor: pointer; }
.input-box input:disabled, .input-box button:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
    filter: grayscale(100%); /* Nút sẽ chuyển sang màu xám khi bị khóa */
}

@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* NÚT NỔI */
.float-support { position: absolute; bottom: 80px; right: 15px; background: #4caf50; color: white; width: 45px; height: 45px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2); font-size: 20px; text-decoration: none; transition: 0.3s; z-index: 10;}
.float-donate { position: absolute; bottom: 135px; right: 15px; background: linear-gradient(90deg, #f6d365, #fda085); color: #d35400; width: 45px; height: 45px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2); font-size: 20px; transition: 0.3s; font-weight: bold; z-index: 10;}
.float-checkin { position: absolute; bottom: 190px; right: 15px; background: #ff4757; color: white; width: 45px; height: 45px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2); font-size: 20px; transition: 0.3s; font-weight: bold; z-index: 10;}
.float-support:hover, .float-donate:hover, .float-checkin:hover { transform: scale(1.1); }

/* ADMIN SCREEN */
.admin-container { width: 900px; height: 600px; display: none; flex-direction: column; padding: 20px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid rgba(255,255,255,0.5); padding-bottom: 15px; margin-bottom: 15px; color: #5e35b1; }
.table-wrapper { flex: 1; overflow-y: auto; background: rgba(255,255,255,0.5); border-radius: 15px; padding: 10px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
th, td { padding: 10px; border-bottom: 1px solid rgba(0,0,0,0.1); }
th { background: #7b61ff; color: white; position: sticky; top: 0; }
.btn-admin { padding: 6px 12px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; font-size: 12px; margin-right: 5px;}
.btn-add { background: #4caf50; } .btn-del { background: #f44336; }

/* POPUP CHUNG */
.popup-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000; }
.popup-content { background: white; padding: 25px; border-radius: 20px; width: 340px; text-align: center; }

/* UI ĐIỂM DANH */
.checkin-row { display: flex; justify-content: center; gap: 8px; margin: 20px 0; }
.checkin-box { width: 40px; height: 50px; border-radius: 8px; background: #f0f0f0; display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 12px; font-weight: bold; color: #888; border: 2px solid transparent; transition: 0.3s; }
.checkin-box.active { background: #ffebee; border-color: #ff4757; color: #ff4757; transform: scale(1.1); }
.checkin-box.claimed { background: #4caf50; color: white; }
/*uploadbill*/
.loading-shimmer {
    opacity: 0.6;
    pointer-events: none;
    background: linear-gradient(90deg, #7b61ff, #9b82ff, #7b61ff);
    background-size: 200% 100%;
    animation: loadingAnim 1.5s infinite;
}
@keyframes loadingAnim { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
/* LÀM ĐẸP THANH CUỘN CHO TOÀN BỘ APP */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent; 
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5); 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.8); 
}
/* CHỮ KÝ BẢN QUYỀN CỦA STUDIO */
.viet-aura-credit {
    margin-top: 25px;
    font-size: 12px;
    color: #555;
    text-align: center;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.viet-aura-credit strong {
    color: #5e35b1; /* Màu tím tone-sur-tone với tiêu đề */
    font-weight: 800;
}
/* Hiệu ứng 3 chấm đang gõ */
.typing-dots { display: inline-block; font-weight: bold; font-size: 18px; color: #ff758c; }
.typing-dots span { animation: typingBlink 1.4s infinite both; margin: 0 1px; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBlink {
    0% { opacity: 0.2; transform: translateY(0); }
    20% { opacity: 1; transform: translateY(-2px); }
    100% { opacity: 0.2; transform: translateY(0); }
}
/* Ép tin nhắn AI phải nhận dấu xuống dòng (Enter) */
.message.ai, .message.user {
    white-space: pre-wrap; 
    word-wrap: break-word;
}
/* =========================================
   HIỆU ỨNG 3D - GIẤY KHAI SINH AI
   ========================================= */
.cert-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px);
    z-index: 99999; display: none; align-items: center; justify-content: center;
    perspective: 1000px; /* Tạo chiều sâu không gian 3D */
}

.cert-scene {
    width: 300px; height: 450px; perspective: 1000px;
}

.cert-card {
    width: 100%; height: 100%; position: relative;
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Lật nảy nảy giống thật */
    transform-style: preserve-3d; /* Giữ môi trường 3D */
    cursor: pointer;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    border-radius: 20px;
}

/* Xoay 180 độ khi bị click */
.cert-card.is-flipped { transform: rotateY(180deg); }

.cert-face {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden; /* Ẩn mặt sau khi lật */
    border-radius: 20px; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* Mặt trước thẻ */
.cert-front {
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
    color: white; border: 2px solid rgba(255,255,255,0.5);
}

.cert-front::after { /* Tạo hiệu ứng lấp lánh chéo */
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(30deg); animation: shine 3s infinite;
}

/* Mặt sau thẻ (Nội dung) */
.cert-back {
    background: #fff; color: #333;
    transform: rotateY(180deg); /* Quay lưng lại mặc định */
    border: 5px solid #ff758c; padding: 25px; box-sizing: border-box;
    background-image: radial-gradient(#ff7eb3 1px, transparent 1px);
    background-size: 20px 20px;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(30deg); }
    100% { transform: translateX(100%) rotate(30deg); }
}