/* body {
    font-family: Arial, sans-serif;
    background-color: #2a3a4f;
    color: #8d97ad;
} */

.grid-container {
    padding: 20px;
}

.discover-columns {
    flex-wrap: nowrap;
}

.discover-columns > .flex-fill {
    min-width: 0;
    flex: 1 1 0;
}

.discover-separator {
    flex: 0 0 1px;
}


.icon-grid {
    display: grid;
    /* Keep icon tiles at an actual, distinct size per step (don't stretch to fill). */
    grid-template-columns: repeat(auto-fill, minmax(var(--icon-size, 120px), var(--icon-size, 120px)));
    gap: 1rem;
    margin: 0 auto;
    justify-content: center;
}

.game-icon-btn {
    text-align: center;
}

.library-icon-tile {
    text-align: left;
    color: inherit;
    text-decoration: none;
}

.library-icon-tile .discover-tile-body {
    position: relative;
}

.library-icon-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.library-icon-item {
    display: flex;
    flex-direction: column;
    position: relative;
}

.library-icon-info-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 6px 8px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
}

/* Keep overlay button from triggering the details click */
.library-icon-info-overlay {
    pointer-events: auto;
}

.game-icon {
    width: 100%;
    height: auto;
    display: block;
}

.game-info {
    bottom: 0;
    left: 0;
    text-align: left !important;
    /* background-image: linear-gradient(to top, rgba(7, 0, 91, 0.49), #003aa800); */
    background-image: linear-gradient(to top, rgba(7, 0, 91, 0.71), #001233a1);
    padding: 10px;
    border-radius: 0 0 8px 8px;
    border-top: 1px solid #d5d5d5bd;
    top: unset;
}

.game-tag {
    font-size: 1em;
    margin-right: 5px;
}

.card {
    border-radius: 8px !important;
    /* linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 50%), */
}

.card-img {
    mask-image: linear-gradient(to top, rgba(7, 0, 91, 0.71), #001233ed);
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
}

/* Card view: keep overlays inside card bounds */
.game-card {
    overflow: hidden;
}

.game-card .card-img {
    width: 100%;
    aspect-ratio: 920 / 520;
    object-fit: cover;
    display: block;
}

.game-title {
    font-size: 1.1rem;
    /* font-size: 18px; */
    font-weight: bold;
    margin-bottom: 5px;
    color: white;
}

p.game-description {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.game-genre {
    margin-top: 4px;
    margin-bottom: 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.tags-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.game-status-icons {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.game-action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 576px) {
    .grid-container {
        padding: 12px;
    }

    /* Force 1 column in card view on phones to prevent overlay collisions */
    #gameGrid.row .game-col {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .game-info {
        right: 0;
        width: 100%;
        padding: 8px;
    }

    .game-title {
        font-size: 1rem;
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Place tags below text (avoid overlapping title/description) */
    .tags-container {
        position: static;
        margin-top: 8px;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }

    .game-status-icons,
    .game-action-buttons {
        justify-content: flex-start;
    }

    /* Icon view: avoid cramped/overlapping tiles */
    .icon-grid {
        gap: 0.75rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* List view: allow scroll + hide least useful columns */
    .list-view {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .list-view table th:nth-child(2),
    .list-view table td:nth-child(2),
    .list-view table th:nth-child(5),
    .list-view table td:nth-child(5) {
        display: none;
    }
}

/* Library discovery rows */
.discover-row-wrapper {
    position: relative;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.discover-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 40px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: thin;
}

.discover-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(33, 37, 41, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.discover-scroll-btn:hover {
    background: rgba(33, 37, 41, 1);
    color: rgba(255, 255, 255, 1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
}

.discover-scroll-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.discover-scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.discover-scroll-left {
    left: 0;
}

.discover-scroll-right {
    right: 0;
}

.discover-tile {
    flex: 0 0 auto;
    width: 160px;
    color: inherit;
    text-decoration: none;
    scroll-snap-align: start;
}

.discover-tile-body {
    background: rgba(33, 37, 41, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px;
}

.discover-tile-img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
}

.discover-tile-title {
    margin-top: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.discover-tile-subtitle {
    margin-top: 4px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-outline-info {
    --bs-btn-hover-color: #fff;
}

.game-info-body {
    display: grid;
    gap: 12px;
}

.game-info-description {
    white-space: pre-wrap;
    line-height: 1.4;
}

.game-info-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.game-info-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
}

.game-info-image:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

#screenshotModalImg {
    max-height: 86vh;
    object-fit: contain;
    background: #000;
}

.text-bg-warning {
    color: #fff !important;
    background-color: RGBA(var(--bs-warning-rgb),var(--bs-bg-opacity,1)) !important;
}

.text-bg-info {
    color: #fff !important;
    background-color: RGBA(var(--bs-info-rgb),var(--bs-bg-opacity,1)) !important;
    font-weight: normal;
  }

.col-1, .col-2, .col-3, .col-4, .col-6, .col-12 {
    display: flex;
    flex-direction: column;
}

.col-1 > .card, .col-2 > .card, .col-3 > .card, .col-4 > .card, .col-6 > .card, .col-12 > .card {
    flex: 1;
}

/* Update popover */
.popover-body {
    max-height: 200px; /* Set your desired max height */
    overflow-y: auto; /* Enable vertical scrolling */
}

.upload-panel {
    background: rgba(33, 37, 41, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px;
}

.upload-dropzone {
    position: relative;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-dropzone:hover {
    border-color: rgba(13, 110, 253, 0.6);
    background: rgba(13, 110, 253, 0.08);
}

.upload-dropzone.is-dragover {
    border-color: rgba(13, 110, 253, 0.9);
    background: rgba(13, 110, 253, 0.16);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.upload-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-dropzone-body {
    display: grid;
    gap: 6px;
    place-items: center;
    color: rgba(255, 255, 255, 0.9);
}

.upload-dropzone-body i {
    font-size: 2rem;
    color: rgba(13, 110, 253, 0.85);
}

.upload-dropzone-title {
    font-weight: 600;
}

.upload-dropzone-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.upload-file-list {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    max-height: 180px;
    overflow-y: auto;
}

.upload-file-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
}

.upload-file-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.9rem;
}

.upload-file-item:last-child {
    border-bottom: none;
}

/* Settings sidebar navigation */
.setting-body {
    padding-left: 0;
    padding-right: 0;
}

#settingsSidebar {
    min-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
    overflow-y: auto;
    background-color: rgba(26, 30, 34, 0.98) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#settingsSidebar .d-flex {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

#settingsNav .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

#settingsNav .nav-link:hover {
    color: rgba(255, 255, 255, 0.95);
    background-color: rgba(255, 255, 255, 0.08);
}

#settingsNav .nav-link.active {
    color: #fff;
    background-color: rgba(13, 110, 253, 0.25);
    font-weight: 500;
}

#settingsNav .nav-link svg {
    flex-shrink: 0;
}

/* Mobile sidebar */
@media (max-width: 767.98px) {
    #settingsSidebar {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 56px);
        z-index: 1040;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    }
    
    #settingsSidebar.show {
        left: 0;
    }
    
    /* Overlay when sidebar is open */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1039;
    }
}

.settings-section {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
