/* =========================================
   1. GLOBAL & VARIABLES
   ========================================= */
:root {
    --primary-red: #b71c1c;      /* Đỏ đô truyền thống */
    --accent-gold: #ffc107;      /* Vàng kim loại */
    --bg-cream: #fff8dc;         /* Màu kem/giấy cũ */
    --text-dark: #2c3e50;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-hover: 0 10px 15px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f4f6f9; /* Màu nền tổng thể sáng nhẹ */
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased; /* Làm mịn font trên Mac/iOS */
}

/* Font tiêu đề dùng Merriweather cho sang trọng */
h1, h2, h3, h4, h5, h6, .font-serif {
    font-family: 'Merriweather', serif;
}

/* Thanh cuộn tùy chỉnh (Webkit) */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #b71c1c; 
}

/* =========================================
   2. NAVBAR & HEADER
   ========================================= */
.navbar {
    background: linear-gradient(135deg, #b71c1c 0%, #8a1212 100%) !important;
}

.navbar-brand i {
    animation: float 3s ease-in-out infinite;
}

/* =========================================
   3. ANIMAL CARD (BÀN CƯỢC) - QUAN TRỌNG
   ========================================= */
.animal-card {
    background-color: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    user-select: none; /* Chặn bôi đen text khi bấm liên tục */
}

/* Hiệu ứng Hover */
.animal-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover);
    border-color: var(--accent-gold);
}

/* TRẠNG THÁI ĐƯỢC CHỌN (SELECTED) */
.animal-card.selected {
    background-color: #fff5f5;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.2); /* Hiệu ứng focus ring */
}

/* Badge mã số (Góc trên phải) */
.code-badge {
    font-size: 0.75rem;
    font-weight: bold;
    border-bottom-left-radius: 6px;
    background-color: #6c757d; /* Màu mặc định */
    transition: background-color 0.3s;
}

.animal-card.selected .code-badge {
    background-color: var(--primary-red) !important;
}

/* Tên con vật */
.animal-card h6 {
    color: var(--primary-red);
    margin-top: 15px; /* Chừa chỗ cho badge */
}

/* Overlay nhập tiền (Ẩn hiện) */
.bet-input-overlay {
    display: none;
    margin-top: 5px;
    animation: fadeInUp 0.3s ease-out;
}

.animal-card.selected .bet-input-overlay {
    display: block;
}

.bet-amount {
    border: 1px solid var(--primary-red);
    color: var(--primary-red);
    font-weight: bold;
    background: #fff;
}
.bet-amount:focus {
    box-shadow: none;
    background: #fff;
}

/* =========================================
   4. CHAT BOX & COMMENT
   ========================================= */
.chat-container {
    height: 550px; /* Chiều cao cố định trên Desktop */
    display: flex;
    flex-direction: column;
    border: none;
}

.chat-messages {
    background-color: #f8f9fa;
    background-image: radial-gradient(#dee2e6 1px, transparent 1px);
    background-size: 20px 20px; /* Họa tiết chấm bi mờ */
}

/* Bong bóng chat */
.chat-messages .bg-primary {
    background-color: #0d6efd !important; /* Màu tin nhắn của mình */
}

.chat-messages .bg-light {
    background-color: #ffffff !important; /* Màu tin nhắn người khác */
    border: 1px solid #dee2e6;
}

.chat-messages .bg-danger {
    background: linear-gradient(45deg, #b71c1c, #d32f2f); /* Màu Admin */
    box-shadow: 0 2px 5px rgba(183, 28, 28, 0.3);
}

/* Input chat area */
#chat-input {
    border-radius: 20px 0 0 20px;
    border: 1px solid #ced4da;
}
#chat-input:focus {
    box-shadow: none;
    border-color: var(--primary-red);
}

/* =========================================
   5. POEM BOX (CÂU THAI)
   ========================================= */
.poem-box {
    background: linear-gradient(to right, #fff8e1, #ffffff);
    border-left: 5px solid var(--accent-gold);
    border-radius: 4px;
    padding: 20px;
}

.poem-box p {
    font-family: 'Merriweather', serif;
    font-size: 1.2rem;
    line-height: 1.6;
    color: #333;
}

/* =========================================
   6. ANIMATIONS & KEYFRAMES
   ========================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
    100% { transform: translateY(0px); }
}

/* =========================================
   7. RESPONSIVE (MOBILE OPTIMIZATION)
   ========================================= */
@media (max-width: 768px) {
    /* Trên mobile, ô con vật nhỏ lại */
    .animal-card {
        padding: 5px !important;
    }
    .animal-card h6 {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }
    .animal-card small {
        font-size: 0.75rem;
    }
    .code-badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Input tiền nhỏ lại */
    .bet-amount {
        font-size: 0.8rem;
        padding: 2px;
        height: 25px;
    }

    /* Chat box ngắn lại để vừa màn hình */
    .chat-container {
        height: 400px;
        margin-bottom: 60px; /* Chừa chỗ cho nút đặt cược fixed */
    }

    /* Ẩn bớt text trên Navbar */
    .navbar-brand {
        font-size: 1.1rem;
    }
}