/* ============================================================
   Casino Lobby Shortcode — Frontend Styles
   All rules scoped to .cls-lobby
============================================================ */

/* ============================================================
   CSS CUSTOM PROPERTIES (defaults — overridden by inline vars)
============================================================ */
.cls-lobby {
    --cls-primary:    #7a5c20;
    --cls-secondary:  #d4a017;
    --cls-bg-start:   #f5f0e8;
    --cls-bg-end:     #ede5d0;
    --cls-card-bg:    #d4c9b0;
    --cls-btn-color:  #7a5c20;
    --cls-btn-text:   #ffffff;
    --cls-sidebar-bg: #f5f0e8;
    --cls-active-bg:  #e4dcc8;
}

/* ============================================================
   LOBBY CONTAINER
============================================================ */
.cls-lobby {
    display: flex;
    align-items: stretch;   /* cả 2 cột cùng chiều cao */
    gap: 0;
    background: linear-gradient(160deg, var(--cls-bg-start), var(--cls-bg-end));
    min-height: 400px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    border-radius: 16px;
    overflow: hidden;       /* cắt border-radius */
    box-shadow: 0 4px 32px rgba(60,40,10,0.10);
    /* height được JS set = chiều cao tự nhiên của sidebar */
}

/* ============================================================
   SIDEBAR — Đứng im, không cuộn
============================================================ */
.cls-sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--cls-sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 16px 12px 16px;
    min-height: 400px;
    border-right: 1px solid rgba(122,92,32,0.10);
    /* Sidebar không cuộn — chiều cao tự nhiên làm chuẩn cho lobby */
    overflow: hidden;
    flex-shrink: 0;
}

/* Category List */
.cls-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.cls-cat-list li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cls-cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    margin-bottom: 2px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
    /* Khi là thẻ <a> */
    text-decoration: none;
    outline: none;
}

.cls-cat-item:visited {
    color: #555;
}

.cls-cat-item:hover {
    background: rgba(122,92,32,0.08);
    color: var(--cls-primary);
}

.cls-cat-item.active {
    background: var(--cls-active-bg);
    color: var(--cls-primary);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--cls-primary);
}

.cls-cat-icon {
    font-size: 18px;
    line-height: 1;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.cls-cat-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Register / Login Buttons */
.cls-sidebar-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid rgba(122,92,32,0.12);
    margin-top: 16px;
}

.cls-btn-register,
.cls-btn-login {
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

.cls-btn-register {
    background: transparent;
    border: 2px solid var(--cls-primary);
    color: var(--cls-primary);
}

.cls-btn-register:hover {
    background: var(--cls-primary);
    color: #fff;
    transform: translateY(-1px);
}

.cls-btn-login {
    background: linear-gradient(135deg, var(--cls-primary), var(--cls-secondary));
    border: 2px solid transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(122,92,32,0.25);
}

.cls-btn-login:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(122,92,32,0.35);
    color: #fff;
}

/* ============================================================
   MAIN CONTENT — Chỉ phần này cuộn, sidebar đứng im
============================================================ */
.cls-content {
    flex: 1;
    min-width: 0;
    padding: 14px 16px 16px;
    overflow-y: auto;       /* chỉ cards cuộn */
    overflow-x: hidden;
    /* max-height được set bằng JS = chiều cao sidebar */
    scroll-behavior: smooth;
}

/* Thanh cuộn mỏng, đẹp */
.cls-content::-webkit-scrollbar {
    width: 4px;
}
.cls-content::-webkit-scrollbar-track {
    background: transparent;
}
.cls-content::-webkit-scrollbar-thumb {
    background: rgba(122,92,32,0.30);
    border-radius: 4px;
}
.cls-content::-webkit-scrollbar-thumb:hover {
    background: rgba(122,92,32,0.55);
}

/* ============================================================
   SECTION
============================================================ */
.cls-section {
    margin-bottom: 18px;
}

.cls-section:last-child {
    margin-bottom: 0;
}

.cls-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cls-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 800;
    color: #222;
}

.cls-section-icon {
    font-size: 20px;
    line-height: 1;
}

.cls-view-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--cls-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(122,92,32,0.4);
    transition: color 0.18s;
    white-space: nowrap;
}

.cls-view-all:hover {
    color: var(--cls-secondary);
    text-decoration-color: var(--cls-secondary);
}

/* ============================================================
   CARDS GRID
============================================================ */
.cls-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* ============================================================
   GAME CARD
============================================================ */
.cls-card {
    background: var(--cls-card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(122,92,32,0.12);
    display: flex;
    flex-direction: column;
    /* Entrance animation */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.35s ease, transform 0.35s ease, box-shadow 0.2s;
}

.cls-card--visible {
    opacity: 1;
    transform: translateY(0);
}

.cls-card--visible:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(60,40,10,0.18);
    border-color: rgba(122,92,32,0.25);
}

/* Card Thumbnail */
.cls-card-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background-color: rgba(122,92,32,0.12);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Placeholder (no image) */
.cls-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(122,92,32,0.12), rgba(212,160,23,0.15));
}

.cls-card-placeholder span {
    font-size: 36px;
    opacity: 0.5;
}

/* Badges */
.cls-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.4;
    white-space: nowrap;
}

.cls-badge--LIVE {
    background: linear-gradient(90deg, #e53935, #ef5350);
    color: #fff;
    box-shadow: 0 2px 8px rgba(229,57,53,0.45);
}

.cls-badge-dot {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: cls-pulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes cls-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.75); }
}

.cls-badge--HOT {
    background: linear-gradient(90deg, #ff6f00, #ffa000);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255,111,0,0.4);
}

.cls-badge--NEW {
    background: linear-gradient(90deg, #2e7d32, #43a047);
    color: #fff;
    box-shadow: 0 2px 8px rgba(46,125,50,0.4);
}

.cls-badge--JACKPOT {
    background: linear-gradient(90deg, #6a1b9a, #9c27b0);
    color: #fff;
    box-shadow: 0 2px 8px rgba(106,27,154,0.4);
}

/* Card Body */
.cls-card-body {
    padding: 7px 9px 9px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.cls-card-name {
    font-size: 12px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cls-card-provider {
    font-size: 11px;
    color: var(--cls-secondary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.cls-btn-play {
    display: block;
    text-align: center;
    padding: 7px 8px;
    background: linear-gradient(135deg, var(--cls-btn-color), color-mix(in srgb, var(--cls-btn-color) 80%, #000));
    color: var(--cls-btn-text);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.18s, transform 0.18s;
    letter-spacing: 0.3px;
    margin-top: auto;
}

.cls-btn-play:hover {
    opacity: 0.88;
    transform: scale(1.02);
    color: var(--cls-btn-text);
    text-decoration: none;
}

/* Fallback for browsers that don't support color-mix */
@supports not (color: color-mix(in srgb, red, blue)) {
    .cls-btn-play {
        background: var(--cls-btn-color);
    }
}

/* ============================================================
   RESPONSIVE
============================================================ */

/* Tablet: 3 columns */
@media (max-width: 1024px) {
    .cls-sidebar {
        width: 190px;
        min-width: 190px;
    }
    .cls-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile landscape: sidebar collapses, 2 columns */
@media (max-width: 768px) {
    .cls-lobby {
        flex-direction: column;
        border-radius: 12px;
    }

    .cls-sidebar {
        width: 100%;
        min-width: 0;
        min-height: auto;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid rgba(122,92,32,0.12);
    }

    .cls-cat-list {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .cls-cat-list::-webkit-scrollbar { display: none; }

    .cls-cat-item {
        flex-shrink: 0;
        padding: 7px 12px;
        margin-bottom: 0;
        border-radius: 20px;
        font-size: 13px;
        white-space: nowrap;
    }

    .cls-cat-item.active {
        box-shadow: none;
    }

    .cls-sidebar-buttons {
        flex-direction: row;
        border-top: none;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(122,92,32,0.12);
    }

    .cls-btn-register,
    .cls-btn-login {
        flex: 1;
        padding: 9px 10px;
    }

    .cls-content {
        padding: 14px;
    }

    .cls-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cls-section-title {
        font-size: 16px;
    }
}

/* Mobile portrait: 2 columns stays */
@media (max-width: 480px) {
    .cls-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .cls-card-name {
        font-size: 12px;
    }
}
