/* --- TOP HORIZONTAL AVATAR GALLERY --- */
.reference-gallery-container {
 width: 100%;
 height: 140px;
 /* Made it larger */
 background-color: var(--surface-color);
 border: 1px solid var(--border-color);
 border-radius: 12px;
 padding: 10px;
 display: flex;
 align-items: center;
 overflow: hidden;
}

#avatars-gallery-list {
 display: flex;
 gap: 12px;
 overflow-x: auto;
 padding-bottom: 15px;
 /* For scrollbar */
 flex-grow: 1;
 scrollbar-width: thin;
 scrollbar-color: var(--primary-color) var(--surface-color);
}

.avatar-gallery-card {
 flex-shrink: 0;
 width: 85px;
 /* Larger cards */
 background: #27272a;
 border-radius: 8px;
 overflow: hidden;
 border: 2px solid transparent;
 cursor: pointer;
 transition: all 0.2s ease;
 position: relative;
 aspect-ratio: 3 / 4;
 display: flex;
 flex-direction: column;
 justify-content: flex-end;
}

.avatar-gallery-card:hover {
 border-color: var(--primary-color);
 transform: translateY(-3px);
}

.avatar-gallery-card.selected {
 border-color: #34d399;
 box-shadow: 0 0 15px #34d39955;
}

.avatar-gallery-image {
 position: absolute;
 top: 0;
 left: 0;
 width: 100%;
 height: 100%;
 object-fit: cover;
 z-index: 1;
}

.gallery-card-overlay {
 position: absolute;
 top: 5px;
 right: 5px;
 z-index: 2;
 opacity: 0;
 transition: opacity 0.2s ease;
 pointer-events: none;
}

.avatar-gallery-card:hover .gallery-card-overlay {
 opacity: 1;
 pointer-events: auto;
}

.gallery-info-icon {
 background: rgba(0, 0, 0, 0.7);
 border: none;
 color: white;
 font-size: 12px;
 cursor: pointer;
 border-radius: 50%;
 width: 18px;
 height: 18px;
 display: flex;
 align-items: center;
 justify-content: center;
 padding: 0;
 transition: all 0.2s ease;
}

.gallery-info-icon:hover {
 background: rgba(0, 0, 0, 0.9);
 color: #bb86fc;
 transform: scale(1.1);
}

#loading-gallery,
#error-gallery {
 text-align: center;
 width: 100%;
 align-self: center;
 color: #9ca3af;
}

/* Main Image */
.main-image-grid {
 border: 2px dashed var(--primary-color);
 border-radius: 16px;
 padding: 8px;
 background-color: #0c0c0c;
 position: relative;
}

.main-image-grid img {
 display: block;
 width: 100%;
 max-width: 250px;
 border-radius: 12px;
}

.grid-icon {
 position: absolute;
 bottom: 15px;
 right: 15px;
 background-color: var(--primary-color);
 color: black;
 border-radius: 50%;
 width: 35px;
 height: 35px;
 display: flex;
 align-items: center;
 justify-content: center;
 cursor: pointer;
}