

button.button_show_type{
    background: var(--color-button-secondary-bg);
    color: var(--color-text);
    border-color: transparent;
    padding: 0.4em 1em; /* Adjusted padding */
    line-height: 1;
    font-size: 1em;
    font-weight: 500; /* Lighter weight */
}
button.button_show_type.selected {
    background: var(--color-primary);
    color: #000A1A;
}
#list_images #list_images_list{
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* Left-to-right filling */
    gap: 0; /* No gap */
    margin-top: 20px;
    width: 100%;
}

#list_images #list_images_list .list_image{
    flex: 0 0 auto;
    width: 234px; /* Fixed width */
    height: 234px; /* Fixed height to maintain aspect ratio */
    aspect-ratio: 1/1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,.1);
    overflow: visible !important; /* Changed from hidden to visible to allow tooltips to show */
    isolation: isolate; /* Creates a new stacking context */
    transition: transform 0.2s ease;
    border-radius: 0; /* Removed rounded corners for seamless grid */
}

#list_images #list_images_list .list_image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Ensure the image is contained */
    object-position: center;
    /* Add a clip-path to prevent image overflow while allowing tooltips to show */
    clip-path: inset(0); /* This clips the image to its container without affecting tooltips */
    transition: filter 0.3s ease; /* Add transition for smooth filter changes */
    filter: saturate(0.7); /* Slight desaturation by default */
}

#list_images #list_images_list .list_image:hover {
    transform: scale(1.02);
    z-index: 1; /* Ensure hovered image appears above others */
    background-color: rgba(255,255,255,.1);
}

#list_images #list_images_list .list_image:hover img {
    filter: saturate(1); /* Full saturation on hover */
}

/* Common image icon styling */
.image-icon {
    position: absolute;
    z-index: 5 !important;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-icon i {
    color: white;
    font-size: 14px;
}

.image-icon:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.7);
}

/* Heart icon positioning */
.heart-icon {
    top: 10px;
    right: 40px;
}

.heart-icon.liked {
    background-color: rgba(255, 0, 0, 0.7);
}

.heart-icon .likes-count {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 12px;
    min-width: 20px;
    text-align: center;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.heart-icon:hover .likes-count {
    background-color: rgba(0, 0, 0, 0.7);
    opacity: 1;
    visibility: visible;
}

.heart-icon.liked .likes-count {
    background-color: rgba(255, 0, 0, 0.7);
}

/* Folder icon positioning */
.folder-icon {
    top: 10px;
    left: 45px;
}

/* Info icon positioning */
.info-icon {
    top: 10px;
    right: 10px;
}

/* Shared icon positioning */
.shared-icon {
    top: 10px;
    left: 10px;
    background-color: rgba(100, 100, 100, 0.7); /* Default gray for unshared */
}

.shared-icon.shared {
    background-color: rgba(0, 100, 200, 0.7); /* Blue for shared */
}

.shared-icon.shared:hover {
    background-color: rgba(0, 100, 200, 0.9);
}
.nsfw-icon {
    position: absolute;
    bottom: 10px;
    left: 10px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    padding: 5px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.nsfw-icon:hover {
    background: rgba(0, 0, 0, 0.8);
}

.nsfw-icon.isNSFW {
    background-color: rgba(255, 0, 0, 0.7);
}
/* Delete icon positioning */
.delete-icon {
    bottom: 10px;
    right: 10px;
    background-color: rgba(200, 0, 0, 0.7);
}

.delete-icon:hover {
    background-color: rgba(200, 0, 0, 0.9);
}

/* Style the tippy content for better readability and text selection */
.tippy-content {
    padding: 12px;
    font-size: 14px;
    line-height: 1.4;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    cursor: auto;
}

/* Style for selectable text within tooltips */
.tippy-content p, 
.tippy-content span, 
.tippy-content div:not(.tooltip-button-container):not(.close_tippy_button) {
    cursor: text;
    user-select: text !important;
    padding-bottom: 0;
    margin-bottom: 2px;
}

/* Tooltip settings layout */
.tooltip-settings {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tooltip-settings h4 {
    margin-top: 0;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

/* Full width items */
.tooltip-full-width {
    width: 100%;
}

/* Two column layout */
.tooltip-columns {
    display: flex;
    gap: 15px;
    margin: 5px 0;
}

.tooltip-column {
    flex: 1;
    min-width: 0; /* Allows columns to shrink below content size */
}

/* Paragraph styling */
.tippy-content p {
    max-height: 65px;
    overflow: hidden;
    padding-right: 10px;
    position: relative;
    line-height: 1.5em;
    margin-bottom: 2px;
}

/* Truncated paragraphs with ellipsis */
.tippy-content p.truncated::after {
    content: "...";
    position: absolute;
    bottom: 0;
    right: 10px;
    background-color: inherit;
    padding-left: 3px;
}

/* Special styling for prompt and negative prompt */


/* Button container */
.tooltip-button-container {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 10px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .tooltip-columns {
        flex-direction: column;
        gap: 5px;
    }
}

/* Ensure the tooltip has proper interaction properties */
.tippy-box {
    z-index: 9999 !important;
    position: relative;
    pointer-events: auto !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

/* Tippy backdrop overlay styles */
.tippy-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998; /* Just below the tippy z-index */
    opacity: 0;
    display: none;
    transition: opacity 0.3s ease;
}

/* Make sure the tippy tooltip appears above the backdrop */
.tippy-popper,
div[data-tippy-root] {
    z-index: 9999 !important;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Make sure the tippy tooltip appears above all other elements */
div[data-tippy-root] {
    max-width: calc(100vw - 10px);
}

/* Styles for the close button in tippy tooltips */
.close_tippy_button {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 10000;
}

.tippy-close-button {
    background: none;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 50%;
    line-height: 1;
}

.tippy-close-button:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Position the tippy content to accommodate the close button */
.tippy-content {
    padding-top: 20px;
}

/* Prevent event propagation for elements with this class */
.no-propagation {
    pointer-events: auto !important;
}

/* Style the tooltip button container */
.tooltip-button-container {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 10px;
}

/* Style the settings button in the tooltip */
.tooltip-button-container .settings-button {
    display: inline-block;
    padding: 8px 12px;
    background-color: var(--color-primary, #4CAF50);
    color: #000A1A;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s;
    flex: 1;
}

.tooltip-button-container .settings-button:hover {
    background-color: var(--color-primary-hover, #45a049);
    color: #000A1A;
    text-decoration: none;
}

/* Style the cancel button */
.tooltip-button-container .cancel-button {
    display: inline-block;
    padding: 8px 12px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s;
    flex: 1;
}

.tooltip-button-container .cancel-button:hover {
    background-color: #d32f2f;
}

@media (max-width: 768px) {
    #list_images #list_images_list {
        gap: 0; /* No gap on mobile */
        justify-content: center;
    }

    #list_images #list_images_list .list_image {
        width: 50%; /* Exactly 50% width with no gap */
        height: auto; /* Set height to 0 */
        min-width: 120px; /* Adjusted minimum size */
        max-width: 220px; /* Maximum size as requested */
        aspect-ratio: 1/1;
        touch-action: pan-y;
        -webkit-tap-highlight-color: transparent;
        position: relative; /* Ensure position is relative for absolute positioning of the image */
        overflow: visible !important; /* Ensure tooltips are visible on mobile too */
        isolation: isolate; /* Creates a new stacking context */
    }

    #list_images #list_images_list .list_image img {
        position: absolute; /* Position absolutely within the container */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: auto; /* Center the image */
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain; /* Ensure the image is contained */
        clip-path: inset(0); /* This clips the image to its container without affecting tooltips */
    }

    /* Make the icons slightly smaller on mobile */
    .image-icon {
        width: 20px;
        height: 20px;
    }

    .image-icon i {
        font-size: 12px;
    }
}

/* For larger screens */
@media (min-width: 769px) {
    #list_images #list_images_list {
        gap: 0; /* No gap on desktop */
    }

    /* More noticeable desaturation on desktop */
    #list_images #list_images_list .shared_image img {
        filter: saturate(0.6); /* More desaturation on desktop */
    }

    #list_images #list_images_list .shared_image:hover img {
        filter: saturate(1.05); /* Slightly enhanced saturation on hover for desktop */
    }
}

/* Remove old move success message style */
.move-success-message {
    display: none;
}


/* Make sure the overlay works well on mobile */
@media (max-width: 768px) {

    
    /* Fix for tippy tooltips on mobile */
    .tippy-box {
        z-index: 8000 !important; /* Lower than overlay */
    }
    

}

/* Folder item styling for Tippy dropdown */
.folder-tippy-content {
    padding: 5px 0;
}

.folder-dropdown-item {
    padding: 10px 15px;
    cursor: pointer !important;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f5f5f5;
    color: #000; /* Changed from #333 to #000 for better visibility */
    font-size: 14px;
}

.folder-dropdown-item:last-child {
    border-bottom: none;
}

.folder-dropdown-item:hover {
    background-color: #f5f9ff;
}

.folder-dropdown-item.selected {
    background-color: #e6f4ff;
    color: #0078d7;
}

.folder-dropdown-item i {
    margin-right: 10px;
    width: 16px;
    text-align: center;
}

/* Dark theme support for folder items */
[data-theme="dark"] .folder-dropdown-item {
    color: #e0e0e0;
    border-bottom-color: #444;
}

[data-theme="dark"] .folder-dropdown-item:hover {
    background-color: #3a3a3a;
}

[data-theme="dark"] .folder-dropdown-item.selected {
    background-color: #0d3a58;
    color: #e0e0e0;
}

/* Tippy theme for folder dropdown */
.tippy-box[data-theme~='folder-dropdown'] {
    background-color: white;
    color: #333;
    border-radius: 6px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    border: 1px solid #ddd;
}

.tippy-box[data-theme~='folder-dropdown'] .tippy-content {
    padding: 0;
}

.tippy-box[data-theme~='folder-dropdown'] .tippy-arrow {
    color: white;
}

/* Dark theme support for Tippy folder dropdown */
[data-theme="dark"] .tippy-box[data-theme~='folder-dropdown'] {
    background-color: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

[data-theme="dark"] .tippy-box[data-theme~='folder-dropdown'] .tippy-arrow {
    color: #2d2d2d;
}

/* Pagination Styles */
.pagination {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.pagination-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 10px 15px;
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.pagination-button {
    min-width: 36px;
    height: 36px;
    border-radius: 18px;
    border: none;
    background-color: var(--color-button-secondary-bg, #2a2a2a);
    color: var(--color-text, #ffffff);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 10px;
}

.pagination-button:hover:not(.disabled):not(.active) {
    background-color: var(--color-button-secondary-hover, #3a3a3a);
    transform: translateY(-2px);
}

.pagination-button.active {
    background-color: var(--color-primary, #4a90e2);
    color: #000A1A;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.pagination-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-button.prev-button,
.pagination-button.next-button {
    min-width: 36px;
    padding: 0;
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text, #ffffff);
    font-size: 14px;
    padding: 0 5px;
}

/* Mark as dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #EEEEEE;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.dropdown-content.show {
    display: block;
}

.dropdown-content a {
    color: #000A1A;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: var(--hover-color);
}

.dropdown-content a:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.dropdown-content a:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .pagination-container {
        padding: 8px 12px;
    }

    .pagination-button {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }

    /* Hide some elements on small screens */
    .pagination-ellipsis,
    .pagination-button.page-button:not(.active) {
        display: none;
    }

    /* Always show first, last, prev, next and active buttons */
    .pagination-button.page-button:first-of-type,
    .pagination-button.page-button:last-of-type,
    .pagination-button.page-button.active,
    .pagination-button.prev-button,
    .pagination-button.next-button {
        display: flex;
    }
}
