/* Container for all sidebars */
#sidebar-container {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;

    display: flex;
    flex-direction: row;
    flex-shrink: 0;
    
    /* Polish: Slightly transparent with blur for depth */
    background-color: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(5px);
    border-right: 1px solid #444;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

/* Panel is a flex container for buttons and content */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    width: 100px;
    box-sizing: border-box;
    border-right: 1px solid #333;
    padding: 0;
}

/* Custom Scroll Buttons */
.scroll-button {
    flex-shrink: 0;
    height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px; /* Adjusted for cleaner look */
    color: #aaa;
    background-color: #252525;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s, color 0.2s;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}
.scroll-button:first-child { border-top: none; }
.scroll-button:last-child { border-bottom: none; }

.scroll-button:hover {
    background-color: #3f3f3f;
    color: #fff;
}
.scroll-button.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: #252525;
    color: #555;
}

/* Wrapper to hide scrollbar */
.sidebar-content-wrapper {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    background-color: #1e1e1e;
}

/* The actual scrollable area */
.sidebar-content {
    height: 100%;
    overflow-y: scroll;
    padding: 10px;
    box-sizing: border-box;
    scrollbar-width: none;  /* Firefox */
    scroll-behavior: smooth;
}
.sidebar-content::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Wrapper for item and its overlays */
.sidebar-item-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-bottom: 10px;
    transition: transform 0.2s ease;
}
.sidebar-item-wrapper:last-child {
    margin-bottom: 0;
}

/* Core Item Specifics */
.core-items-container {
    flex-shrink: 0;
    padding: 10px;
    border-top: 1px solid #444;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background-color: #232323;
}

.sidebar-item-wrapper.core-item {
    width: 100%;
    margin-bottom: 0;
}

/* The Item Image */
.sidebar-item {
    width: 100%;
    height: 100%;
    background-color: #3a3a3a;
    border: 2px solid #555;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    object-fit: cover;
    display: block;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.sidebar-item:hover {
    transform: scale(1.05);
    border-color: #00aaff;
    box-shadow: 0 4px 8px rgba(0, 170, 255, 0.3);
    z-index: 2; /* Bring above neighbors */
}

/* 1. Selected State */
.sidebar-item.selected {
    border-color: #c58af9;
    box-shadow: 0 0 8px rgba(197, 138, 249, 0.4);
}
.sidebar-item.selected:hover {
    border-color: #d4a7fa;
}

/* 2. Locked State */
.sidebar-item.locked {
    filter: grayscale(1) brightness(0.4);
    cursor: not-allowed;
    border-color: #444;
}
.sidebar-item.locked:hover {
    transform: none;
    border-color: #444;
    box-shadow: none;
}

/* Polish: Darkened background for better text contrast */
.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.4); 
    border-radius: 6px;
    pointer-events: none;
    color: #eee;
    text-shadow: 0 1px 3px black;
}
.lock-overlay span {
    font-size: 1.4em;
    font-weight: 800;
    font-family: monospace;
}

/* --- Completed Game Star Overlay --- */
.completed-star-overlay {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 28%;
    height: 28%;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.8));
    animation: star-pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.completed-star-overlay svg {
    width: 100%;
    height: 100%;
    color: #FFD700;
}

@keyframes star-pop-in {
    0% { transform: scale(0) rotate(-45deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* 3. Status States */
@keyframes pulse-yellow {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); border-color: #ffd700; }
    70% { box-shadow: 0 0 0 6px rgba(255, 215, 0, 0); border-color: #ffe44d; }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); border-color: #ffd700; }
}
@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(0, 191, 255, 0.7); border-color: #00bfff; }
    70% { box-shadow: 0 0 0 6px rgba(0, 191, 255, 0); border-color: #40e0d0; }
    100% { box-shadow: 0 0 0 0 rgba(0, 191, 255, 0); border-color: #00bfff; }
}

.sidebar-item.unseen {
    border: 2px solid #fff;
    box-shadow: 0 0 5px rgba(255,255,255,0.5);
}
.sidebar-item.new {
    animation: pulse-yellow 2s infinite;
}
.sidebar-item.updated {
    animation: pulse-blue 2s infinite;
}