:root {
    --success: var(--green);
    --success-hover: color-mix(in srgb, var(--success) 70%, var(--background));
    --info: var(--blue);
    --info-hover: color-mix(in srgb, var(--info) 70%, var(--background));
    --warning: var(--orange);
    --warning-hover: color-mix(in srgb, var(--warning) 70%, var(--background));
    --danger: var(--red);
    --danger-hover: color-mix(in srgb, var(--danger) 70%, var(--background));

    --video-outline: var(--red);
    --gif-outline: var(--orange);

    --parent-outline: var(--blue);
    --child-outline: var(--green);

    --rating-safe: var(--green);
    --rating-questionable: var(--orange);
    --rating-explicit: var(--red);
}

::-moz-selection {
    color: var(--primary-text);
    background: var(--primary-color);
}

::selection {
    color: var(--primary-text);
    background: var(--primary-color);
}

::placeholder {
    color: var(--text-tertiary);
    opacity: 1;
}

::-ms-input-placeholder {
    color: var(--text-tertiary);
}

input[type="radio"]:checked+span,
.rating-filter-input:checked+.rating-filter-label,
.custom-filter-input:checked+.custom-filter-label,
span.checked {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: var(--primary-text);
}

input[type="radio"]:checked+span:hover,
.rating-filter-input:checked+.rating-filter-label:hover,
.custom-filter-input:checked+.custom-filter-label:hover,
span.checked:hover {
    background-color: var(--primary-hover);
}

/* Category filter buttons with respective category colors */
.category-filter-label-general:hover {
    border-color: var(--tag-general);
}

.category-filter-input:checked+.category-filter-label-general {
    border-color: var(--tag-general);
    background-color: var(--tag-general);
    color: var(--tag-text);
}

.category-filter-input:checked+.category-filter-label-general:hover {
    filter: brightness(1.1);
}

.category-filter-label-artist:hover {
    border-color: var(--tag-artist);
}

.category-filter-input:checked+.category-filter-label-artist {
    border-color: var(--tag-artist);
    background-color: var(--tag-artist);
    color: var(--tag-text);
}

.category-filter-input:checked+.category-filter-label-artist:hover {
    filter: brightness(1.1);
}

.category-filter-label-character:hover {
    border-color: var(--tag-character);
}

.category-filter-input:checked+.category-filter-label-character {
    border-color: var(--tag-character);
    background-color: var(--tag-character);
    color: var(--tag-text);
}

.category-filter-input:checked+.category-filter-label-character:hover {
    filter: brightness(1.1);
}

.category-filter-label-copyright:hover {
    border-color: var(--tag-copyright);
}

.category-filter-input:checked+.category-filter-label-copyright {
    border-color: var(--tag-copyright);
    background-color: var(--tag-copyright);
    color: var(--tag-text);
}

.category-filter-input:checked+.category-filter-label-copyright:hover {
    filter: brightness(1.1);
}

.category-filter-label-meta:hover {
    border-color: var(--tag-meta);
}

.category-filter-input:checked+.category-filter-label-meta {
    border-color: var(--tag-meta);
    background-color: var(--tag-meta);
    color: var(--tag-text);
}

.category-filter-input:checked+.category-filter-label-meta:hover {
    filter: brightness(1.1);
}

.filter-check-icon {
    display: none;
}

.rating-filter-input:checked+.rating-filter-label .filter-check-icon,
.custom-filter-input:checked+.custom-filter-label .filter-check-icon,
.category-filter-input:checked+.category-filter-label .filter-check-icon,
span.checked .filter-check-icon {
    display: block;
}

/* Header logo and title styling
   Override these in your theme or custom CSS to customise the logo colors.
   --logo-icon-primary  : fill color for the outer SVG shape (defaults to --primary-color)
   --logo-icon-secondary: fill color for the inner SVG glyph (defaults to --primary-text)
   --logo-text-color    : color of the app-name text next to the logo (defaults to --primary-color)

   To use a raster image (PNG, WebP, etc.) instead of the SVG, set
   display:none on #header-logo-svg and display:block on #header-logo-img,
   then set content:url('your-image.png') on #header-logo-img
*/
:root {
    --logo-icon-primary: var(--primary-color);
    --logo-icon-secondary: var(--primary-text);
    --logo-text-color: var(--primary-color);
    --logo-text-hover-color: var(--primary-hover);
}

#header-logo {
    color: var(--logo-text-color);
}

#header-logo-title {
    color: var(--logo-text-color);
    transition: color 0.15s;
}

#header-logo:hover #header-logo-title {
    color: var(--logo-text-hover-color);
}

#header-logo-svg path:nth-child(1) {
    fill: var(--logo-icon-primary);
}

#header-logo-svg path:nth-child(2) {
    fill: var(--logo-icon-secondary);
}

#header-logo-img {
    max-height: 28px;
    width: auto;
    content: url('/static/images/pwa-icon.png');
    display: none;
}

/* Tag input styling */
#tags-input:empty:before,
[contenteditable="true"]:empty:before,
[contenteditable="true"].empty:before {
    content: attr(data-placeholder);
    color: var(--text-tertiary);
}

#tags-input:focus:before,
[contenteditable="true"]:focus:before,
[contenteditable="true"].empty:focus:before {
    content: '';
}

#tags-input .invalid-tag,
[contenteditable="true"] .invalid-tag {
    text-decoration: line-through;
    color: var(--danger);
}

#tags-input .new-tag,
[contenteditable="true"] .new-tag {
    color: var(--success);
}

#tags-input .implied-tag,
[contenteditable="true"] .implied-tag {
    text-decoration: underline dotted var(--info);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

/* Tag suggestion styling */
.tag-suggestions {
    position: fixed;
    z-index: 100000 !important;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
}

.bulk-tag-item:focus-within,
.bulk-manual-item:focus-within,
.bulk-ai-tags-item:focus-within,
.bulk-wd-tagger-item:focus-within {
    content-visibility: visible !important;
    contain: none !important;
    position: relative;
    z-index: 40;
}

.tag-suggestion {
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.tag-suggestion:last-child {
    border-bottom: none;
}

.tag-suggestion:hover,
.tag-suggestion.selected {
    background: var(--surface-light);
}

.tag-suggestion.tag-alias-info {
    background: color-mix(in srgb, var(--orange) 50%, var(--black));
    border-left: 3px solid var(--orange);
}

.tag-suggestion.tag-alias-info:hover,
.tag-suggestion.tag-alias-info.selected {
    background: color-mix(in srgb, var(--orange) 60%, var(--black));
}

.tag-suggestion .tag-name {
    color: var(--text);
}

.tag-suggestion .tag-count {
    color: var(--text-secondary);
    font-size: 0.8em;
}

.tag-suggestion .tag-category {
    margin-bottom: 0.15rem;
    margin-right: 0;
    padding: 0;
}

.tag-suggestion .tag-category .tag-text {
    padding: 0.1rem 0.3rem;
    text-transform: uppercase;
}

.tag-suggestion .tag-category .general {
    background-color: var(--tag-general);
}

.tag-suggestion .tag-category .artist {
    background-color: var(--tag-artist);
}

.tag-suggestion .tag-category .character {
    background-color: var(--tag-character);
}

.tag-suggestion .tag-category .copyright {
    background-color: var(--tag-copyright);
}

.tag-suggestion .tag-category .meta {
    background-color: var(--tag-meta);
}

.tag-suggestion.tag-create-new {
    background-color: color-mix(in srgb, var(--primary-color) 8%, var(--surface));
}

.tag-suggestion.tag-create-new:hover,
.tag-suggestion.tag-create-new.selected {
    background-color: color-mix(in srgb, var(--primary-color) 18%, var(--surface));
}

/* Tag styling */
.tag-category {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    font-size: 0.7em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    margin-right: 0;
    width: 100%;
}

.tag-category:last-child {
    margin-bottom: 0;
}

.tag-category h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    text-decoration: none;
    transition: opacity 0.2s;
    font-weight: 500;
    cursor: default;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

a.tag {
    cursor: pointer;
}

a.tag:hover {
    opacity: 0.8;
}

.tag.artist {
    background-color: var(--tag-artist);
}

.tag.character {
    background-color: var(--tag-character);
}

.tag.copyright {
    background-color: var(--tag-copyright);
}

.tag.general {
    background-color: var(--tag-general);
}

.tag.meta {
    background-color: var(--tag-meta);
}

/* Tag Rating Badges */
.tag-rating-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    border: 1px solid currentColor;
    user-select: none;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.tag-rating-badge.rating-safe {
    color: var(--rating-safe);
    background-color: color-mix(in srgb, var(--rating-safe) 15%, transparent);
}

.tag-rating-badge.rating-questionable {
    color: var(--rating-questionable);
    background-color: color-mix(in srgb, var(--rating-questionable) 15%, transparent);
}

.tag-rating-badge.rating-explicit {
    color: var(--rating-explicit);
    background-color: color-mix(in srgb, var(--rating-explicit) 15%, transparent);
}

.tag-rating-badge.rating-none {
    color: var(--text-tertiary);
    border-color: var(--border);
    background-color: color-mix(in srgb, var(--text-tertiary) 10%, transparent);
}

/* Tag Rating Styles */
.tag.rating-safe {
    background-color: var(--rating-safe);
    color: var(--tag-text);
}

.tag.rating-questionable {
    background-color: var(--rating-questionable);
    color: var(--tag-text);
}

.tag.rating-explicit {
    background-color: var(--rating-explicit);
    color: var(--tag-text);
}

.tag.rating-none {
    background-color: var(--surface-light);
    color: var(--text-secondary);
}

.tag-rating-element .custom-select-dropdown {
    min-width: 10rem;
    white-space: nowrap;
}

/* Tag Gallery Item */
.tag-card {
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tag-card.selected {
    border-color: var(--primary-color) !important;
    background-color: color-mix(in srgb, var(--primary-color) 8%, var(--surface)) !important;
}

#tags-grid.selection-mode .tag-card {
    cursor: pointer;
}

#tags-grid.selection-mode .tag-card:hover {
    border-color: var(--primary-color);
}

/* Gallery styling */
.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.gallery-item a {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.gallery-item .gif-preview {
    display: none;
}

.gallery-item a img.gif-preview,
.gallery-item .blur-wrapper>img.gif-preview {
    opacity: 1;
    transition: border-color 0.15s ease;
}

.gallery-item a img {
    border-width: 2px;
    border-style: solid;
    border-color: var(--border);
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: border-color 0.15s ease, opacity 0.2s ease-in-out;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none;
    background-color: var(--surface);
    background-image: linear-gradient(90deg, var(--surface) 0%, color-mix(in srgb, var(--surface-light), var(--surface) 40%) 50%, var(--surface) 100%);
    background-size: 200% 100%;
    animation: skeleton-wave 2s infinite linear;
    color: transparent;
    text-indent: -9999px;
}

.gallery-item.parent-item a img {
    border-color: var(--parent-outline);
}

.gallery-item.child-item a img {
    border-color: var(--child-outline);
}

.gallery-item.video a img {
    border-color: var(--video-outline);
}

.gallery-item.video.parent-item a img {
    border-left-color: var(--video-outline);
    border-top-color: var(--video-outline);
    border-right-color: var(--parent-outline);
    border-bottom-color: var(--parent-outline);
}

.gallery-item.video.child-item a img {
    border-left-color: var(--video-outline);
    border-top-color: var(--video-outline);
    border-right-color: var(--child-outline);
    border-bottom-color: var(--child-outline);
}

.gallery-item.gif a img {
    border-color: var(--gif-outline);
}

.gallery-item.gif.parent-item a img {
    border-left-color: var(--gif-outline);
    border-top-color: var(--gif-outline);
    border-right-color: var(--parent-outline);
    border-bottom-color: var(--parent-outline);
}

.gallery-item.gif.child-item a img {
    border-left-color: var(--gif-outline);
    border-top-color: var(--gif-outline);
    border-right-color: var(--child-outline);
    border-bottom-color: var(--child-outline);
}

.gallery-item.selected a img {
    border-color: var(--primary-color);
}

.gallery-item:hover a img,
.gallery-item a:focus img,
.gallery-item a:focus-visible img,
.gallery-item:focus-within a img {
    border-color: var(--primary-color);
}

.gallery-item a:focus,
.gallery-item a:focus-visible {
    outline: none;
}

#albums-grid a:focus,
#albums-grid a:focus-visible,
#sub-albums-grid a:focus,
#sub-albums-grid a:focus-visible,
.album-card:focus,
.album-card:focus-visible {
    outline: none;
    border-color: var(--primary-color);
}

.gallery-item .select-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.gallery-item .select-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--background) 70%, transparent);
    border: 2px solid color-mix(in srgb, var(--primary-color) 70%, transparent);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    opacity: 0;
    pointer-events: none;
}

.gallery-item .select-indicator svg {
    width: 14px;
    height: 14px;
    stroke: var(--primary-text);
    stroke-width: 3;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.gallery-item:hover .select-indicator {
    opacity: 1;
    pointer-events: auto;
}

.gallery-item.selected .select-indicator {
    opacity: 1;
    pointer-events: auto;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.gallery-item.selected .select-indicator svg {
    opacity: 1;
}

.gallery-item .select-indicator:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.gallery-item.selected .select-indicator:hover {
    background: var(--primary-color);
}

#gallery-grid.selection-mode .gallery-item .select-indicator {
    opacity: 1;
    pointer-events: auto;
}

#gallery-grid.selection-mode .gallery-item:not(.selected) a img {
    opacity: 0.7;
}

#gallery-grid.selection-mode .gallery-item:not(.selected):hover a img {
    opacity: 1;
}

@keyframes longPressRing {
    0% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary-color) 40%, transparent);
    }

    100% {
        box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary-color) 0%, transparent);
    }
}

.gallery-item.long-pressing .select-indicator {
    opacity: 1;
    transform: scale(1);
}

@keyframes skeleton-wave {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.gallery-item a img.loaded {
    opacity: 1;
    background: none;
    animation: none;
    color: inherit;
    text-indent: 0;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Popular tag styling */
.popular-tag-item {
    align-items: center;
    padding-bottom: 0.6rem;
    gap: 0.5rem;
}

.popular-tag-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.popular-tag-name {
    display: flex;
    justify-content: space-between;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popular-tag-name:hover {
    cursor: pointer;
}

.popular-tag-count {
    font-weight: bold;
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Media styling */
#media-container img,
#media-container video {
    max-width: 100%;
    margin: 0 auto;
}

video:focus,
video:focus-visible {
    outline: 2px solid var(--primary-color);
}

.nav-prev-gradient {
    background: linear-gradient(to right,
            color-mix(in srgb, var(--surface) 90%, transparent) 0%,
            color-mix(in srgb, var(--surface) 50%, transparent) 55%,
            transparent 100%);
}

.nav-next-gradient {
    background: linear-gradient(to left,
            color-mix(in srgb, var(--surface) 90%, transparent) 0%,
            color-mix(in srgb, var(--surface) 50%, transparent) 55%,
            transparent 100%);
}

.nav-btn-hover-overlay {
    background-color: var(--surface);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
}

.info-row:first-child {
    padding-top: 0;
}

.info-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.ai-section {
    background-color: var(--background);
    border-left: 2px solid var(--info);
    padding: 0.25rem;
    padding-left: 0.5rem;
}

.ai-data-row {
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.ai-data-row:last-child {
    border-bottom: none;
}

.ai-data-row span {
    flex-shrink: 0;
}

.ai-data-row strong {
    text-align: right;
    word-break: break-word;
}

#fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--black) 95%, transparent);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

#fullscreen-overlay.active {
    display: flex;
}

#fullscreen-image-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    max-height: 100%;
}

#fullscreen-image {
    display: block;
    object-fit: contain;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

#fullscreen-image.dragging {
    cursor: grabbing !important;
}

#fullscreen-image.zoomed {
    cursor: grab;
}

.fullscreen-close-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    width: max-content;
    transform: translateX(-50%);
    color: color-mix(in srgb, var(--text) 70%, transparent);
    background-color: color-mix(in srgb, var(--background) 70%, transparent);
    padding: 0 4px;
    font-size: 14px;
    pointer-events: none;
    z-index: 10001;
}

#media-container img {
    cursor: pointer;
}

/* AI Metadata Text Styles */
.ai-text-content {
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
}

.ai-text-content.ai-structured-content,
.ai-text-content:has(pre),
.ai-text-content:has(.ai-data-row) {
    white-space: normal;
}

.ai-text-content.is-collapsed {
    display: -webkit-box;
    line-clamp: 4;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.ai-toggle-btn {
    font-size: 0.75rem;
    color: var(--primary-color);
    margin-top: 0.25rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color var(--default-transition-duration) var(--default-transition-timing-function);
}

.ai-toggle-btn:hover {
    color: var(--primary-hover);
}

.ai-toggle-btn:after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    transition: transform 0.2s;
}

.ai-toggle-btn.is-expanded:after {
    transform: rotate(180deg);
}

/* Custom Select Dropdown */
.custom-select {
    position: relative;
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.custom-select:not(.open) .custom-select-dropdown {
    display: none;
}

.pending-tag-item {
    max-width: 100%;
}

.booru-tag-select {
    max-width: 100%;
}

.custom-select-trigger.tag,
.custom-select-trigger.tag-text {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.custom-select-trigger.tag .custom-select-arrow,
.custom-select-trigger.tag-text .custom-select-arrow {
    flex-shrink: 0;
}

.pending-album-item {
    border-left: 3px solid transparent;
}

.pending-album-item.is-all-selected {
    border-left-color: var(--primary-color);
}

.auto-expand-textarea {
    field-sizing: content;
    min-height: calc(2 * 1.4em + 0.75rem);
    max-height: calc(5 * 1.4em + 0.75rem);
    overflow-y: auto;
    resize: none;
}

@media (max-width: 640px) {
    .custom-select-dropdown {
        max-width: min(240px, calc(100vw - 32px));
    }
}

.custom-select.open .custom-select-trigger {
    border-color: var(--primary-color);
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select.open .custom-select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.custom-select-option.selected {
    background-color: var(--surface-light);
    color: var(--primary-color);
}

.custom-select-option.focused {
    background-color: var(--surface-light-hover);
}

.custom-select-option:hover {
    background-color: var(--surface-hover);
}

.sort-order-toggle .sort-order-chevron {
    transition: transform 0.2s ease;
}

.sort-order-toggle.asc .sort-order-chevron {
    transform: rotate(180deg);
}

/* Share icon overlay */
.share-icon {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background-color: var(--primary-color);
    color: var(--primary-text);
    z-index: 5;
}

/* Loading Spinner */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    margin: auto;
    width: 90%;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    z-index: 10;
    display: none;
}

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

.autocomplete-item {
    padding: 0.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.autocomplete-item:hover {
    background-color: var(--surface-hover);
}

/* Upload area */
.upload-area {
    border: 2px dashed var(--border);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
}

.upload-area input[type="file"] {
    display: none;
}

/* Responsive tweaks */
@media (max-width: 768px) {
    body {
        font-size: 11px;
    }
}

/* Age verification */
.media-blurred {
    filter: blur(120px);
    pointer-events: none;
}

.age-verification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--background) 95%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateY(-100px) scale(0.85);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

#bulk-actions {
    top: -1px;
    transition: top 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

body:has(#main-header.-translate-y-full) #bulk-actions {
    top: calc(var(--header-height, 0px) * -1 - 1px);
}

/* Manual Reorder */
body.is-dragging #main-header,
body.is-dragging .manual-reorder-bar {
    pointer-events: none !important;
}

body.reorder-active-mode .gallery-item .select-indicator,
body.reorder-active-mode .gallery-item .select-checkbox {
    display: none !important;
    pointer-events: none !important;
}

.reorder-active-item {
    -webkit-touch-callout: none !important;
}

/* Blur Explicit Thumbnails */
.gallery-item.blur-content .blur-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    flex-shrink: 0;
}

.gallery-item.blur-content .blur-wrapper>img,
.gallery-item.blur-content .blur-wrapper>img.loaded {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: blur(8px);
    border: none !important;
}

.gallery-item.blur-content .blur-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    border-width: 2px;
    border-style: solid;
    border-color: var(--border);
    pointer-events: none;
    z-index: 1;
}

.gallery-item.blur-content.parent-item .blur-wrapper::after {
    border-color: var(--parent-outline);
}

.gallery-item.blur-content.child-item .blur-wrapper::after {
    border-color: var(--child-outline);
}

.gallery-item.blur-content.video .blur-wrapper::after {
    border-color: var(--video-outline);
}

.gallery-item.blur-content.video.parent-item .blur-wrapper::after {
    border-left-color: var(--video-outline);
    border-top-color: var(--video-outline);
    border-right-color: var(--parent-outline);
    border-bottom-color: var(--parent-outline);
}

.gallery-item.blur-content.video.child-item .blur-wrapper::after {
    border-left-color: var(--video-outline);
    border-top-color: var(--video-outline);
    border-right-color: var(--child-outline);
    border-bottom-color: var(--child-outline);
}

.gallery-item.blur-content.gif .blur-wrapper::after {
    border-color: var(--gif-outline);
}

.gallery-item.blur-content.gif.parent-item .blur-wrapper::after {
    border-left-color: var(--gif-outline);
    border-top-color: var(--gif-outline);
    border-right-color: var(--parent-outline);
    border-bottom-color: var(--parent-outline);
}

.gallery-item.blur-content.gif.child-item .blur-wrapper::after {
    border-left-color: var(--gif-outline);
    border-top-color: var(--gif-outline);
    border-right-color: var(--child-outline);
    border-bottom-color: var(--child-outline);
}

.gallery-item.blur-content.selected .blur-wrapper::after,
.gallery-item.blur-content:hover .blur-wrapper::after,
.gallery-item.blur-content a:focus .blur-wrapper::after,
.gallery-item.blur-content a:focus-visible .blur-wrapper::after,
.gallery-item.blur-content:focus-within .blur-wrapper::after {
    border-color: var(--primary-color);
}

/* Album Card and Media Nav Button Thumbnails */
.album-thumb-blur {
    overflow: hidden;
    position: relative;
}

.album-thumb-blur img,
#nav-prev-btn.blur-content #nav-prev-thumb,
#nav-next-btn.blur-content #nav-next-thumb {
    filter: blur(8px);
}

/* Administrative Tasks and Admin Views Exception: Never blur */
body.reorder-active-mode .gallery-item.blur-content .blur-wrapper>img,
body.reorder-active-mode .album-thumb-blur img,
body.reorder-active-mode #nav-prev-btn #nav-prev-thumb,
body.reorder-active-mode #nav-next-btn #nav-next-thumb,
.selection-mode .gallery-item.blur-content .blur-wrapper>img,
.selection-mode .album-thumb-blur img,
.gallery-item.selected.blur-content .blur-wrapper>img,
#admin-panel .blur-content img,
#admin-panel .blur-wrapper>img,
#admin-panel .album-thumb-blur img,
.mpicker-gallery img,
.mpicker-container img,
.bulk-modal img,
#bulk-tag-modal img,
#bulk-edit-modal img,
#bulk-wd-tagger-modal img {
    filter: none !important;
}
