/* Synottip Game Rules */

@font-face {
    font-family: 'NeoSansPro';
    src: url('fonts/NeoSansProRegular.OTF') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'NeoSansPro';
    src: url('fonts/NeoSansProMedium.OTF') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

.sgr-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    column-gap: 24px;
    row-gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'NeoSansPro', sans-serif;
    background: #292929;
    color: #fff;
    overflow-x: hidden;
}

/* --- Logo --- */
.sgr-logo {
    grid-column: 1;
    grid-row: 1;
}

.sgr-logo img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

/* --- Sidebar --- */
.sgr-sidebar {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s;
}

.sgr-wrapper.sgr-searching .sgr-sidebar {
    opacity: 0.4;
    pointer-events: none;
}

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

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

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

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

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

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

.sgr-mobile-search-results .sgr-mobile-game a:hover {
    color: #ef3246;
}

.sgr-provider {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 8px;
    background: transparent;
    color: #fff;
    border: none;
    border-bottom: 1px solid #3a3a3a;
    border-radius: 0;
    cursor: pointer;
    font-family: 'NeoSansPro', sans-serif;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.15s;
    text-align: left;
}

.sgr-provider:hover {
    color: #ef3246;
}

.sgr-provider.active {
    color: #ef3246;
}

.sgr-provider-count {
    font-weight: 400;
    font-size: 18px;
    min-width: 30px;
    text-align: right;
}

/* --- Main Content --- */
.sgr-main {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
}

/* --- Search --- */
.sgr-search-desktop {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    position: relative;
}

.sgr-search-mobile {
    display: none;
    position: relative;
}

.sgr-search-wrap::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
}

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

.sgr-search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border: 1px solid #444;
    border-radius: 6px;
    font-family: 'NeoSansPro', sans-serif;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    background: #333;
    color: #fff;
}

.sgr-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;
}

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

.sgr-search-clear:hover {
    color: #fff;
}

.sgr-search-input::placeholder {
    color: #888;
}

.sgr-search-input:focus {
    border-color: #ef3246;
}

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

.sgr-game-item {
    border-radius: 4px;
    font-size: 14px;
    display: flex;
}

.sgr-game-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #595959;
    border-radius: 4px;
    color: #fff;
    text-decoration: none;
    font-family: 'NeoSansPro', sans-serif;
    font-weight: 400;
    transition: background 0.15s;
    flex: 1;
    box-sizing: border-box;
    min-height: 64px;
    line-height: 1.4;
}

.sgr-game-item a,
.sgr-game-item a .sgr-game-title {
    color: #fff !important;
}

.sgr-game-item a:hover {
    background: #ef3246;
}

/* External link icon */
.sgr-game-item a::after {
    content: '';
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231e1e1e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.sgr-game-item > span {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: transparent;
    border-radius: 4px;
    color: #888;
    flex: 1;
    box-sizing: border-box;
    min-height: 64px;
    line-height: 1.4;
}

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

/* Provider header in search results */
.sgr-provider-header {
    grid-column: 1 / -1;
    font-size: 16px;
    font-weight: 600;
    color: #ef3246;
    padding: 8px 0 2px;
}

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

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

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

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

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

.sgr-mobile-game a:hover {
    color: #ef3246;
}

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

/* --- Scrollbar --- */
.sgr-wrapper {
    scrollbar-color: #595959 #1e1e1e;
}

.sgr-wrapper *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sgr-wrapper *::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.sgr-wrapper *::-webkit-scrollbar-thumb {
    background: #595959;
    border-radius: 4px;
}

.sgr-wrapper *::-webkit-scrollbar-thumb:hover {
    background: #6a6a6a;
}

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

    .sgr-logo {
        order: -2;
        margin-bottom: 12px;
        max-width: 100%;
    }

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

    .sgr-sidebar {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

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

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

    .sgr-main {
        display: none;
    }

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

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

    .sgr-wrapper.sgr-searching .sgr-sidebar {
        display: none;
    }
}

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