.publish-gallery-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.375rem;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    background: rgba(148, 163, 184, 0.08);
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--color-default-500, #64748b);
}

.publish-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

@media (min-width: 640px) {
    .publish-gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .publish-gallery-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .publish-gallery-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.publish-gallery-item {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.publish-gallery-item:hover {
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.publish-gallery-item.sortable-chosen {
    border-color: rgba(59, 130, 246, 0.65);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}

.publish-gallery-item.sortable-ghost {
    opacity: 0.45;
    border-style: dashed;
    border-color: rgba(59, 130, 246, 0.55);
}

.publish-gallery-item.sortable-drag {
    opacity: 1;
}

.publish-gallery-item-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    background: rgba(148, 163, 184, 0.1);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.publish-gallery-hint .iconify {
    flex-shrink: 0;
    font-size: 1rem;
    color: #64748b;
}

.publish-gallery-handle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #64748b;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.publish-gallery-handle .iconify {
    font-size: 0.875rem;
    color: inherit;
}

.publish-gallery-handle:active {
    cursor: grabbing;
}

.publish-gallery-handle:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.publish-gallery-position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border-radius: 50%;
    box-sizing: border-box;
    flex-shrink: 0;
    background: #1e293b;
    color: #fff;
    user-select: none;
}

.publish-gallery-position--wide {
    width: auto;
    min-width: 1.5rem;
    padding-inline: 0.3125rem;
    border-radius: 9999px;
}

.publish-gallery-position__num {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums lining-nums;
    text-align: center;
    transform: translateY(0.5px);
}

.publish-gallery-position--hero {
    background: #2563eb;
}

.publish-gallery-item-body {
    position: relative;
    padding: 0.375rem;
}

.publish-gallery-preview-btn {
    display: block;
    position: relative;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.publish-gallery-preview-btn img {
    display: block;
    width: 100%;
    height: 5rem;
    border-radius: 0.375rem;
    object-fit: cover;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.publish-gallery-play-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.publish-gallery-play-badge span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    font-size: 1.125rem;
}

.publish-gallery-item.is-selected .publish-gallery-preview-btn img {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.55);
}

.publish-gallery-item:not(.is-selected) .publish-gallery-preview-btn img {
    opacity: 0.55;
}

.crm-media-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.82);
}

.crm-media-preview-overlay.is-open {
    display: flex;
}

body.crm-media-preview-open {
    overflow: hidden;
}

.crm-media-preview-dialog {
    width: min(960px, 100%);
    max-height: calc(100dvh - 3rem);
}

.crm-media-preview-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.crm-media-preview-image,
.crm-media-preview-video {
    max-width: 100%;
    max-height: calc(100dvh - 4rem);
    border-radius: 0.5rem;
    background: #000;
}

.crm-media-preview-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 121;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.publish-gallery-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

.publish-gallery-type-label {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    z-index: 2;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}
