/* assets/css/style.css */

/* --- BIẾN TOÀN CỤC --- */
:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #ffffff;
    --accent-color: #e9b12e; /* Màu vàng chủ đạo */
    
    /* Kích thước thẻ bài trên vòng quay */
    --spin-card-w: 140px;
    --spin-card-h: 140px;
    --gap: 8px;
}

/* --- CẤU TRÚC CƠ BẢN --- */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 50px;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
button { cursor: pointer; font-family: inherit; }

/* --- MÀU SẮC ĐỘ HIẾM (RARITY) --- */
.rarity-gold   { border-color: #e4ae39 !important; background: radial-gradient(circle, rgba(228,174,57,0.2) 0%, rgba(30,30,30,1) 70%); }
.rarity-red    { border-color: #eb4b4b !important; background: radial-gradient(circle, rgba(235,75,75,0.2) 0%, rgba(30,30,30,1) 70%); }
.rarity-pink   { border-color: #d32ce6 !important; background: radial-gradient(circle, rgba(211,44,230,0.2) 0%, rgba(30,30,30,1) 70%); }
.rarity-purple { border-color: #8847ff !important; background: radial-gradient(circle, rgba(136,71,255,0.2) 0%, rgba(30,30,30,1) 70%); }
.rarity-blue   { border-color: #4b69ff !important; background: radial-gradient(circle, rgba(75,105,255,0.2) 0%, rgba(30,30,30,1) 70%); }

/* Màu nền cho thanh tỉ lệ */
.bg-gold { background: #e4ae39; }
.bg-red { background: #eb4b4b; }
.bg-pink { background: #d32ce6; }
.bg-purple { background: #8847ff; }
.bg-blue { background: #4b69ff; }

/* --- PHẦN 1: VÒNG QUAY (SPINNER) --- */
.case-wrapper {
    width: 100%;
    background: var(--card-bg);
    padding: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.case-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 160px;
    background: #000;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    overflow: hidden;
}

/* Đảm bảo đoạn này đúng trong style.css */
.center-line {
    position: absolute;
    left: 50%; /* Căn trái 50% */
    top: 0;
    bottom: 0;
    width: 4px; /* Độ dày kim */
    background-color: var(--accent-color);
    transform: translateX(-50%); /* Dịch ngược lại 50% độ dày của chính nó để vào giữa tâm */
    z-index: 10;
    box-shadow: 0 0 10px var(--accent-color);
}
/* Mũi tên tam giác */
.center-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%); /* Căn giữa mũi tên */
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 15px solid var(--accent-color);
}


/* Thêm vào style.css hoặc <style> trong index.php */

/* Sửa lại class này */
.items-strip {
    display: flex;
    height: 100%;
    align-items: center;
    /* Xóa padding-left: 50% đi, ta sẽ căn giữa bằng JS */
    padding-left: 0; 
    will-change: transform;
    position: relative; /* Để tính offsetLeft chuẩn */
}

/* --- SỬA LẠI PHẦN THẺ BÀI (SPIN CARD) --- */
.spin-card {
    width: var(--spin-card-w); 
    height: var(--spin-card-h);
    flex-shrink: 0; 
    box-sizing: border-box; /* Quan trọng: Tính viền vào kích thước thẻ để không bị vỡ khung */
    margin-right: var(--gap);
    background-color: #252525;
    
    /* CẤU HÌNH VIỀN (BORDER) */
    border: 1px solid #444;       /* Viền mỏng xung quanh */
    border-bottom-width: 5px;     /* Viền dưới dày hơn (Style CS:GO) */
    border-style: solid;          /* Bắt buộc phải có dòng này */
    
    position: relative; 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    transition: transform 0.2s; /* Hiệu ứng nhẹ */
}

/* Khi thẻ bài được highlight (trúng thưởng) */
.spin-card.winner-anim {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    z-index: 10;
}

.spin-card img { 
    width: 80%; 
    height: auto; 
    object-fit: contain; 
    margin-bottom: 10px; 
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); /* Đổ bóng cho súng đẹp hơn */
}

.spin-card .name { 
    font-size: 12px; 
    color: #ddd; 
    text-align: center; 
    padding: 0 5px; 
    overflow: hidden; 
    white-space: nowrap; 
    text-overflow: ellipsis; 
    width: 90%; 
}
/* --- PHẦN 2: ĐIỀU KHIỂN (CONTROLS) --- */
.controls { text-align: center; margin-top: 15px; width: 100%; }
.result-text { height: 24px; font-size: 16px; font-weight: bold; margin-bottom: 10px; color: var(--accent-color); }

#spinBtn {
    padding: 12px 40px; font-size: 18px;
    background: linear-gradient(45deg, #e9b12e, #c78d0f);
    color: #000; border: none; font-weight: 900; letter-spacing: 1px;
    border-radius: 4px; box-shadow: 0 5px 15px rgba(233, 177, 46, 0.3);
    transition: 0.2s; text-transform: uppercase;
}
#spinBtn:hover { transform: scale(1.05); box-shadow: 0 5px 20px rgba(233, 177, 46, 0.5); }
#spinBtn:disabled { background: #444; color: #888; cursor: not-allowed; transform: none; box-shadow: none; }

.spin-info { margin-bottom: 10px; color: #aaa; font-size: 14px; }
.spin-info span { color: #fff; font-weight: bold; }

/* --- PHẦN 3: BẢNG TỈ LỆ & DANH SÁCH --- */
.rate-container, .chart-container {
    width: 95%; max-width: 800px; margin: 20px auto 0 auto;
    background: var(--card-bg); border-radius: 8px; padding: 15px;
    border: 1px solid #333; box-sizing: border-box;
}

/* Thanh tỉ lệ */
.rate-title { font-size: 14px; color: #888; text-transform: uppercase; margin-bottom: 10px; font-weight: bold; display: flex; align-items: center; }
.rate-bar-wrapper { display: flex; height: 6px; width: 100%; border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.rate-segment { height: 100%; }
.rate-list { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; }
.rate-item { display: flex; align-items: center; color: #ccc; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* Danh sách vật phẩm (Grid) */
.chart-header { border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 15px; font-size: 16px; color: #fff; font-weight: bold; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }

.grid-item {
    background: #252525; border: 1px solid #333; border-radius: 4px; padding: 10px;
    text-align: center; position: relative; transition: 0.2s;
}
.grid-item:hover { transform: translateY(-2px); border-color: #555; }
.grid-item img { width: 100%; max-width: 70px; height: auto; margin-bottom: 5px; }
.grid-item .name { font-size: 11px; color: #ccc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- TRẠNG THÁI HẾT HÀNG (STOCK OUT) --- */
.grid-item.stock-out {
    opacity: 0.4;
    filter: grayscale(100%);
    pointer-events: none; /* Không cho click/hover */
    border-color: #333 !important;
}
.grid-item.stock-out::after {
    content: 'OUT OF STOCK';
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-15deg);
    color: #ff4444; border: 2px solid #ff4444; padding: 2px 5px;
    font-size: 10px; font-weight: bold; border-radius: 4px;
    background: rgba(0,0,0,0.8); white-space: nowrap;
}

/* Tag số lượng */
.stock-tag {
    font-size: 9px; margin-top: 4px; padding: 1px 5px; border-radius: 3px;
    background: rgba(255, 255, 255, 0.1); display: inline-block; color: #aaa;
}
.stock-infinite { color: #00ffcc; background: rgba(0, 255, 204, 0.1); }

/* --- RESPONSIVE MOBILE (Dán vào cuối file style.css) --- */
/* --- RESPONSIVE MOBILE (Cập nhật lại đoạn này ở cuối file style.css) --- */
@media (max-width: 600px) {
    /* 1. Cấu hình kích thước thẻ quay nhỏ lại */
    :root {
        --spin-card-w: 95px; /* Tăng nhẹ chiều rộng để chữ đỡ bị cắt */
        --spin-card-h: 95px;
    }

    /* 2. Xử lý nội dung bên trong thẻ quay (QUAN TRỌNG) */
    .spin-card {
        padding-bottom: 4px; /* Giảm padding đáy */
    }

    .spin-card img {
        width: auto;       /* Để auto để giữ tỉ lệ ảnh */
        height: auto;
        max-width: 70%;    /* Không cho ảnh quá to bề ngang */
        max-height: 45px;  /* Giới hạn chiều cao ảnh tối đa (để dành chỗ cho chữ) */
        margin-bottom: 4px; /* Giảm khoảng cách giữa ảnh và chữ */
    }

    .spin-card .name {
        font-size: 9px;    /* Chữ nhỏ lại */
        line-height: 1.2;  /* Khoảng cách dòng khít lại */
        width: 98%;        /* Cho phép chữ tràn ra sát viền */
        padding: 0;
    }

    /* 3. Các phần khác giữ nguyên như cũ */
    .case-container { height: 115px; }
    
    .chart-container, .rate-container {
        width: 96%;
        padding: 10px;
        margin: 10px auto;
    }

    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
    }

    .grid-item { padding: 5px; }
    
    .grid-item img {
        max-width: 45px;
        margin-bottom: 3px;
    }

    .grid-item .name { font-size: 10px; }
    .stock-tag { font-size: 8px; }
    
    #spinBtn {
        font-size: 16px;
        padding: 12px 20px;
        width: 90%;
    }
}

/* ===== HEADER STYLES ===== */
.main-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-bottom: 2px solid #e9b12e;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Brand */
.header-brand .brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: 0.3s;
}

.header-brand .brand-link:hover {
    transform: scale(1.05);
}

.brand-icon {
    font-size: 32px;
}

.brand-name {
    font-size: 24px;
    font-weight: bold;
    color: #e9b12e;
    text-shadow: 0 0 10px rgba(233, 177, 46, 0.5);
}

/* Navigation */
.header-nav {
    display: flex;
    gap: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-link:hover {
    background: rgba(233, 177, 46, 0.1);
    border-color: #e9b12e;
    transform: translateY(-2px);
}

.nav-link.active {
    background: linear-gradient(135deg, #e9b12e 0%, #d4a028 100%);
    color: #000;
    border-color: #e9b12e;
}

.nav-icon {
    font-size: 18px;
}

.nav-text {
    font-size: 14px;
}

/* Currency Display - 2 CURRENCIES ONLY */
.header-currency {
    display: flex;
    gap: 15px;
    align-items: center;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid;
    border-radius: 25px;
    transition: all 0.3s;
    cursor: pointer;
}

.currency-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Gems Currency */
.gems-currency {
    border-color: #3b82f6;
}

.gems-currency:hover {
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

/* Dust Currency */
.dust-currency {
    border-color: #e9b12e;
}

.dust-currency:hover {
    background: rgba(233, 177, 46, 0.1);
    box-shadow: 0 5px 15px rgba(233, 177, 46, 0.3);
}

.currency-icon {
    font-size: 20px;
}

.currency-amount {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    min-width: 50px;
    text-align: right;
}

/* Currency Update Animation */
.currency-item.updated {
    animation: currencyPulse 0.5s ease;
}

@keyframes currencyPulse {
    0%, 100% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.1); 
        filter: brightness(1.5);
    }
}

/* User Menu */
.header-user {
    position: relative;
}

.user-dropdown {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 25px;
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
}

.user-button:hover {
    background: rgba(233, 177, 46, 0.1);
    border-color: #e9b12e;
}

.user-avatar {
    font-size: 20px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 10px;
    transition: 0.3s;
}

.user-button:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #1a1a1a;
    border: 2px solid #e9b12e;
    border-radius: 10px;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    animation: dropdownSlide 0.3s ease;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    transition: 0.3s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(233, 177, 46, 0.1);
}

.dropdown-item.logout {
    color: #ef4444;
}

.dropdown-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.item-icon {
    font-size: 18px;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: #e9b12e;
    border-radius: 2px;
    transition: 0.3s;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu */
.mobile-menu {
    background: #1a1a1a;
    border-top: 1px solid #333;
    padding: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu-currency {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.mobile-menu-currency .currency-item {
    flex-direction: column;
    text-align: center;
    padding: 15px;
}

.currency-label {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    transition: 0.3s;
}

.mobile-nav-link:hover {
    background: rgba(233, 177, 46, 0.1);
    border-color: #e9b12e;
}

.mobile-nav-link.logout {
    color: #ef4444;
    border-color: #ef4444;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .header-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 12px 15px;
    }
    
    .brand-name {
        display: none;
    }
    
    .header-currency {
        gap: 8px;
    }
    
    .currency-item {
        padding: 8px 12px;
    }
    
    .currency-amount {
        font-size: 14px;
        min-width: 40px;
    }
    
    .user-name {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-currency {
        flex-direction: column;
        gap: 5px;
    }
    
    .currency-item {
        width: 100%;
        justify-content: center;
    }
}
