.bsb-gallery-editor {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 1.5rem 0;
    padding: 1.25rem;
    border: 1px solid rgba(128, 128, 128, 0.35);
    border-radius: 12px;
    color: inherit;
    background: transparent;
}

.bsb-gallery-editor *,
.bsb-gallery-editor *::before,
.bsb-gallery-editor *::after {
    box-sizing: border-box;
}

.bsb-gallery-editor h3 {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    line-height: 1.4;
    color: inherit;
}

.bsb-gallery-editor h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    line-height: 1.4;
    color: inherit;
}

.bsb-gallery-editor p {
    margin: 0.5rem 0;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.bsb-gallery-editor .bsb-gallery-group {
    min-width: 0;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(128, 128, 128, 0.25);
}

.bsb-gallery-editor .bsb-gallery-items {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}

.bsb-gallery-editor .bsb-gallery-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid rgba(128, 128, 128, 0.35);
    border-radius: 10px;
    background: transparent;
}

.bsb-gallery-editor .bsb-gallery-item img,
.bsb-gallery-editor .bsb-gallery-item video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border-radius: 7px;
    background: rgba(128, 128, 128, 0.10);
}

.bsb-gallery-editor .bsb-gallery-item video {
    background: #171717;
}

.bsb-gallery-editor label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: inherit;
}

.bsb-gallery-editor input[type="text"],
.bsb-gallery-editor input[type="file"] {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 0.6rem;
    border: 1px solid rgba(128, 128, 128, 0.45);
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    color: inherit;
    background: transparent;
}

.bsb-gallery-editor input[type="file"] {
    cursor: pointer;
    overflow: hidden;
}

.bsb-gallery-editor input[type="file"]::file-selector-button {
    min-height: 32px;
    margin-right: 0.5rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid rgba(128, 128, 128, 0.45);
    border-radius: 5px;
    color: inherit;
    background: rgba(128, 128, 128, 0.12);
    cursor: pointer;
}

.bsb-gallery-editor .bsb-gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.bsb-gallery-editor button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    max-width: 100%;
    margin: 0;
    padding: 0.55rem 0.8rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 6px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    color: inherit;
    background: rgba(128, 128, 128, 0.10);
    cursor: pointer;
}

.bsb-gallery-editor button:not(:disabled):hover {
    background: rgba(128, 128, 128, 0.20);
}

.bsb-gallery-editor button:focus-visible,
.bsb-gallery-editor input:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.bsb-gallery-editor button:disabled,
.bsb-gallery-editor input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bsb-gallery-editor .bsb-gallery-save {
    width: 100%;
    min-height: 46px;
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    border-color: #365843;
    background: #365843;
    color: #ffffff;
    font-size: 0.95rem;
}

.bsb-gallery-editor .bsb-gallery-save:not(:disabled):hover {
    background: #294533;
}

.bsb-gallery-editor .bsb-gallery-status {
    min-height: 1.5rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.bsb-gallery-editor .bsb-gallery-status:not(:empty) {
    padding: 0.75rem;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 6px;
    background: rgba(128, 128, 128, 0.10);
}

@media (max-width: 600px) {
    .bsb-gallery-editor {
        margin: 1rem 0;
        padding: 0.85rem;
    }

    .bsb-gallery-editor .bsb-gallery-items {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.85rem;
    }

    .bsb-gallery-editor .bsb-gallery-item {
        padding: 0.75rem;
    }

    .bsb-gallery-editor .bsb-gallery-controls button {
        flex: 1 1 auto;
    }

    .bsb-gallery-editor input[type="text"],
    .bsb-gallery-editor input[type="file"] {
        font-size: 16px;
    }
}

/* BSB GALLERY PRESENTATION H9 */

.bsb-gallery-host {
    grid-column: 1 / -1;
    width: 100%;
    margin: 1rem 0;
}

.bsb-gallery-host [hidden] {
    display: none !important;
}

.bsb-gallery-limits {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin: 0 0 0.75rem;
}

.bsb-gallery-discard {
    min-height: 44px;
    padding: 10px 18px;
    margin: 12px 0;
    border: 1px solid #52633d;
    border-radius: 4px;
    background: transparent;
    color: #52633d;
    font: inherit;
    cursor: pointer;
}

.bsb-gallery-discard:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.bsb-gallery-discard:not(:disabled):hover {
    background: #52633d;
    color: white;
}

.bsb-gallery-discard:focus-visible {
    outline: 2px solid #52633d;
    outline-offset: 3px;
}
