/* Joker Game Rules */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed&display=swap');

.jgr-wrapper {
    display: flex;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Roboto Condensed', sans-serif;
    overflow-x: hidden;
}

/* --- Sidebar --- */
.jgr-sidebar {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jgr-provider {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #222a58;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s;
    text-align: left;
}

.jgr-provider:hover {
    background: #2d3568;
}

.jgr-provider.active {
    background: #4a5fd9;
}

.jgr-provider-count {
    font-weight: 700;
    font-size: 15px;
    min-width: 30px;
    text-align: right;
}

/* --- Main Content --- */
.jgr-main {
    flex: 1;
    min-width: 0;
}

/* --- Search --- */
.jgr-search-desktop,
.jgr-search-mobile {
    margin-bottom: 6px;
}

.jgr-search-mobile {
    display: none;
}

.jgr-search-wrap {
    position: relative;
}

.jgr-search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
}

.jgr-search-input:focus {
    border-color: #222a58;
}

.jgr-search-clear {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.jgr-search-clear.visible {
    display: block;
}

.jgr-search-clear:hover {
    color: #333;
}

/* --- Games Grid --- */
.jgr-games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.jgr-game-item {
    border-radius: 4px;
    font-size: 14px;
}

.jgr-game-item a {
    display: flex;
    align-items: center;
    min-height: 62px;
    padding: 8px 16px;
    background: #e5e5e5;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    box-sizing: border-box;
}

.jgr-game-item a:hover {
    background: #d9d9d9;
    color: #222a58;
}

.jgr-game-item span {
    display: flex;
    align-items: center;
    min-height: 62px;
    padding: 8px 16px;
    background: #e5e5e5;
    border-radius: 4px;
    color: #666;
    box-sizing: border-box;
}

.jgr-game-item.hidden {
    display: none;
}

/* --- Mobile Games (accordion under provider) --- */
.jgr-mobile-games {
    display: none;
}

.jgr-mobile-games.open {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #f7f7f7;
    border-radius: 0 0 6px 6px;
    margin-top: -4px;
    margin-bottom: 4px;
    padding: 8px 0;
}

.jgr-mobile-game {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
}

.jgr-mobile-game a {
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    word-break: break-word;
    flex: 1;
}

.jgr-mobile-game a:hover {
    color: #222a58;
}

.jgr-mobile-game .jgr-pdf-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Searching state — desktop: dim sidebar, mobile: hide it */
.jgr-sidebar.searching {
    opacity: 0.4;
    pointer-events: none;
}

/* Mobile search results */
.jgr-mobile-search-results {
    display: none;
}

.jgr-mobile-search-results.active {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.jgr-mobile-search-results .jgr-provider-header {
    font-size: 15px;
    font-weight: 600;
    color: #222a58;
    padding: 12px 4px 4px;
}

.jgr-mobile-search-results .jgr-provider-header:first-child {
    padding-top: 4px;
}

.jgr-mobile-search-results .jgr-mobile-game {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    background: #f7f7f7;
    border-radius: 4px;
    margin-bottom: 2px;
}

.jgr-mobile-search-results .jgr-mobile-game a {
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    word-break: break-word;
    flex: 1;
}

.jgr-mobile-search-results .jgr-mobile-game a:hover {
    color: #222a58;
}

.jgr-mobile-search-results .jgr-pdf-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.jgr-provider-header {
    grid-column: 1 / -1;
    font-size: 16px;
    font-weight: 600;
    color: #222a58;
    padding: 8px 0 2px;
}

.jgr-provider-header:first-child {
    padding-top: 0;
}

.jgr-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 15px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .jgr-wrapper {
        flex-direction: column;
        padding: 12px;
        gap: 0;
    }

    .jgr-sidebar {
        flex: none;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .jgr-search-mobile {
        display: block;
        margin-bottom: 12px;
        max-width: 100%;
    }

    .jgr-mobile-search-results {
        max-width: 100%;
    }

    .jgr-search-desktop {
        display: none;
    }

    .jgr-main {
        display: none;
    }

    .jgr-wrapper.desktop-active .jgr-main {
        display: none;
    }

    .jgr-mobile-games {
        /* shown via .open class */
    }

    .jgr-sidebar.searching {
        display: none;
    }
}

@media (min-width: 769px) {
    .jgr-mobile-games {
        display: none !important;
    }
}
