/**
 * BBCode-редактор (seller/create, seller/edit и т.д.)
 * Подключается после templates/{red|orange|template1}.css — цвета из переменных шаблона.
 */

.bbcode-editor-wrapper {
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    overflow: hidden;
    background: var(--surface);
}

.bbcode-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem;
    padding: 0.5rem;
    align-items: center;
    position: relative;
    min-height: 40px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.bbcode-toolbar .bbcode-toolbar-btn {
    padding: 0.375rem 0.5rem !important;
    margin: 0;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--text-secondary) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bbcode-toolbar .bbcode-toolbar-btn i {
    color: inherit;
}

.bbcode-toolbar .bbcode-toolbar-btn:hover {
    color: var(--text-primary) !important;
    background: color-mix(in srgb, var(--primary-color) 14%, var(--surface)) !important;
    border-color: var(--border) !important;
}

.bbcode-toolbar .bbcode-toolbar-btn.active {
    color: var(--primary-color) !important;
    background: color-mix(in srgb, var(--primary-color) 22%, transparent) !important;
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent) !important;
}

@supports not (background: color-mix(in srgb, black 50%, white)) {
    .bbcode-toolbar .bbcode-toolbar-btn:hover {
        background: rgba(128, 128, 128, 0.2) !important;
    }
    .bbcode-toolbar .bbcode-toolbar-btn.active {
        background: rgba(128, 128, 128, 0.32) !important;
        border-color: var(--primary-color) !important;
    }
}

.bbcode-toolbar-sep {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.25rem;
    flex-shrink: 0;
}

.bbcode-editor-wrapper textarea.bbcode-editor-textarea,
.bbcode-editor-wrapper textarea.form-control.bbcode-editor-textarea {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0.75rem !important;
    resize: vertical;
    min-height: 150px;
    background: var(--bg) !important;
    color: var(--text-primary) !important;
}

.bbcode-popup {
    box-shadow: var(--shadow-lg) !important;
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
}

.bbcode-popup-input {
    background: var(--bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

.bbcode-size-item {
    border: none !important;
    background: transparent !important;
    color: var(--text-primary) !important;
}

.bbcode-size-item:hover {
    background: color-mix(in srgb, var(--primary-color) 12%, var(--surface)) !important;
}

.bbcode-size-item.active {
    color: var(--primary-color) !important;
    font-weight: 600;
    background: color-mix(in srgb, var(--primary-color) 18%, transparent) !important;
}

@supports not (background: color-mix(in srgb, black 50%, white)) {
    .bbcode-size-item:hover {
        background: rgba(128, 128, 128, 0.18) !important;
    }
    .bbcode-size-item.active {
        background: rgba(128, 128, 128, 0.28) !important;
    }
}
