/* Image Radius Refinement */
.gallery-item {
    border-radius: 30px 0 30px 30px !important;
    overflow: hidden;
}

.gallery-item img {
    border-radius: 30px 0 30px 30px !important;
}

/* Grid Favorite Button */
.gallery-item {
    position: relative;
    /* Ensure gallery items can position the absolute button */
}

.grid-fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    z-index: 5;
    color: rgb(176, 176, 176);
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.grid-fav-btn:hover {
    background: rgba(255, 255, 255, 0.678);
    transform: scale(1.1);
}

.grid-fav-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #e31b23;
}

.grid-fav-btn.active:hover {
    transform: scale(0.95);
}

@media (hover: hover) {
    .grid-fav-btn {
        opacity: 0;
        transform: translateY(-5px);
    }

    .gallery-item:hover .grid-fav-btn,
    .grid-fav-btn.active {
        opacity: 1;
        transform: translateY(0);
    }
}

/* On touch devices, always show the button or at least if active */
@media (hover: none) {
    .grid-fav-btn {
        opacity: 1;
        background: rgba(0, 0, 0, 0.2);
    }

    .grid-fav-btn.active {
        background: rgba(255, 255, 255, 0.9);
    }
}


/* Floating Download Bar */
.floating-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    z-index: 1000;
    width: 90%;
    max-width: 600px;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.floating-bar.hidden {
    transform: translateX(-50%) translateY(150%);
    opacity: 0;
    pointer-events: none;
}

.floating-bar-content {
    background: rgba(31, 0, 51, 0.85);
    /* Matches theme primary color with opacity */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    color: white;
}

#selected-count {
    font-family: 'Switzer-Regular', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
}

.floating-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.floating-actions button {
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-family: 'Switzer-Regular', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

#floating-download-btn {
    background: white;
    color: var(--detail-primary);
}

#floating-download-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

#floating-review-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

#floating-review-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

#clear-selection-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    justify-content: center;
}

#clear-selection-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 500px) {
    .floating-bar {
        width: 94%;
        bottom: 20px;
    }

    .floating-bar-content {
        padding: 12px 15px;
        flex-direction: column;
        gap: 12px;
    }

    .floating-actions {
        width: 100%;
        justify-content: space-between;
    }

    #selected-count {
        align-self: flex-start;
        font-size: 0.9rem;
    }
}

/* Floating Preview Panel */
#floating-preview-panel {
    position: relative;
    width: calc(100% - 30px);
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    margin-bottom: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 20px 0 20px 20px;
    /* smooth transition for height/display handled by JS toggling class hidden */
    transition: all 0.3s ease;
}

#floating-preview-panel.hidden {
    display: none;
}

.preview-list {
    display: flex;
    gap: 12px;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.preview-remove-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.9);
}

/* Scrollbar styles for preview */
#floating-preview-panel::-webkit-scrollbar {
    height: 6px;
}

#floating-preview-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#floating-preview-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#floating-preview-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}
.preview-panel-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    z-index: 10;
    color: #555;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-panel-close-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    color: #000;
}
