/**
 * 后台各业务模块功能按钮统一（排除系统参数 / 食安：由 taste-scope 类控制）
 */

.taste-scope > .d-flex.justify-content-between.align-items-center,
.taste-scope > .d-flex.align-items-center.mb-3,
.taste-scope > .d-flex.align-items-center.mb-4,
.taste-scope > .d-flex.justify-content-between.align-items-center.mb-3,
.taste-scope > .d-flex.justify-content-between.align-items-center.mb-4,
.taste-scope > h2.page-title + .row.mb-3,
.taste-scope > .page-title + .row.mb-3 {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center !important;
    justify-content: space-between;
    gap: 0.85rem 1.25rem;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem !important;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius, 12px);
    box-shadow: var(--admin-shadow, 0 1px 2px rgba(28, 36, 48, 0.04));
}

.taste-scope > h2.page-title + .row.mb-3 > [class*="col-"],
.taste-scope > .page-title + .row.mb-3 > [class*="col-"] {
    flex: 1 1 auto;
    width: auto !important;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.taste-scope > h2.page-title + .row.mb-3 > [class*="col-"]:last-child,
.taste-scope > .page-title + .row.mb-3 > [class*="col-"]:last-child {
    justify-content: flex-end;
}

.taste-scope > .d-flex.align-items-center.mb-3 > .me-3,
.taste-scope > .d-flex.align-items-center.mb-4 > .me-3 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-right: 0.75rem !important;
}

.taste-scope > .d-flex.justify-content-between .d-flex.flex-wrap.gap-2,
.taste-scope > .d-flex.justify-content-between > div:not(h2):not(.page-title) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.taste-scope .page-title {
    margin-bottom: 0 !important;
}

.taste-scope .btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 38px;
    padding: 0 0.9rem !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em;
    line-height: 1.2;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease !important;
}

/* 按钮权限隐藏必须压过上方 .btn 的 display:!important，否则设备列表等模块无法管控 */
.taste-scope .btn.button-hidden,
.taste-scope [data-permission-code].button-hidden,
.button-hidden {
    display: none !important;
}

.taste-scope .btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.99) !important;
}

.taste-scope .btn:disabled,
.taste-scope .btn.disabled {
    opacity: 0.42 !important;
}

.taste-scope .btn-sm,
.taste-scope .btn.btn-sm {
    min-height: 30px;
    padding: 0 0.55rem !important;
    font-size: 0.78rem !important;
    border-radius: 8px !important;
}

.taste-scope .btn-primary {
    background: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: #f8fffe !important;
}

.taste-scope .btn-primary:hover:not(:disabled),
.taste-scope .btn-primary:focus:not(:disabled) {
    background: color-mix(in srgb, var(--secondary-color) 88%, #000) !important;
    border-color: color-mix(in srgb, var(--secondary-color) 88%, #000) !important;
    color: #f8fffe !important;
    filter: none !important;
}

.taste-scope .btn-success,
.taste-scope .btn-info {
    background: color-mix(in srgb, var(--secondary-color) 8%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--secondary-color) 35%, var(--admin-border)) !important;
    color: var(--secondary-color) !important;
}

.taste-scope .btn-success:hover:not(:disabled),
.taste-scope .btn-info:hover:not(:disabled) {
    background: color-mix(in srgb, var(--secondary-color) 16%, transparent) !important;
    color: var(--secondary-color) !important;
}

.taste-scope .btn-warning {
    background: color-mix(in srgb, var(--warning-color) 8%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--warning-color) 30%, var(--admin-border)) !important;
    color: var(--warning-color) !important;
}

.taste-scope .btn-warning:hover:not(:disabled) {
    background: color-mix(in srgb, var(--warning-color) 14%, transparent) !important;
}

.taste-scope .btn-danger {
    background: color-mix(in srgb, var(--danger-color) 6%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--danger-color) 30%, var(--admin-border)) !important;
    color: var(--danger-color) !important;
}

.taste-scope .btn-danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--danger-color) 12%, transparent) !important;
}

.taste-scope .btn-secondary,
.taste-scope .btn-outline-secondary,
.taste-scope .btn-outline-primary,
.taste-scope .btn-outline-info,
.taste-scope .btn-outline-success {
    background: transparent !important;
    border: 1px solid var(--admin-border) !important;
    color: var(--admin-muted) !important;
}

.taste-scope .btn-outline-primary:hover:not(:disabled),
.taste-scope .btn-outline-secondary:hover:not(:disabled),
.taste-scope .btn-outline-info:hover:not(:disabled),
.taste-scope .btn-outline-success:hover:not(:disabled),
.taste-scope .btn-secondary:hover:not(:disabled) {
    color: var(--admin-text) !important;
    border-color: color-mix(in srgb, var(--secondary-color) 35%, var(--admin-border)) !important;
    background: color-mix(in srgb, var(--admin-body-bg) 70%, #fff) !important;
}

.taste-scope .btn-outline-warning {
    background: transparent !important;
    border: 1px solid color-mix(in srgb, var(--warning-color) 35%, var(--admin-border)) !important;
    color: var(--warning-color) !important;
}

.taste-scope .btn-outline-danger {
    background: color-mix(in srgb, var(--danger-color) 6%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--danger-color) 30%, var(--admin-border)) !important;
    color: var(--danger-color) !important;
}

.taste-scope .btn-outline-danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--danger-color) 12%, transparent) !important;
}

.taste-scope .btn-link {
    min-height: auto;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--secondary-color) !important;
    font-weight: 600 !important;
}

.taste-scope td .btn,
.taste-scope td .btn-sm {
    margin: 0.1rem 0.1rem 0.1rem 0;
}

.taste-scope .card-header .btn,
.taste-scope .card-header .btn-sm {
    min-height: 32px;
}

.taste-scope .input-group {
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    max-width: 380px;
}

.taste-scope .input-group .form-control {
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.taste-scope .input-group .btn {
    border: 0 !important;
    border-left: 1px solid var(--admin-border) !important;
    border-radius: 0 !important;
    min-width: 42px;
    color: var(--admin-muted) !important;
    background: color-mix(in srgb, var(--admin-body-bg) 60%, #fff) !important;
}

.taste-scope .input-group .btn:hover:not(:disabled) {
    color: var(--secondary-color) !important;
    background: color-mix(in srgb, var(--secondary-color) 10%, transparent) !important;
}

.taste-scope .btn-group {
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    overflow: hidden;
}

/* 含下拉菜单的按钮组：放开 overflow，否则展开菜单被裁切（如「新建节目」拆分箭头） */
.taste-scope .btn-group:has([data-bs-toggle="dropdown"]),
.taste-scope .btn-group:has(> .dropdown-menu) {
    overflow: visible;
}

.taste-scope .btn-group > .btn {
    border: 0 !important;
    border-right: 1px solid var(--admin-border) !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.taste-scope .btn-group > .btn:last-child,
.taste-scope .btn-group > .btn:last-of-type {
    border-right: 0 !important;
}

/* overflow 放开后，用圆角补齐拆分按钮两端，避免方角溢出描边 */
.taste-scope .btn-group:has([data-bs-toggle="dropdown"]) > .btn:first-child {
    border-top-left-radius: 9px !important;
    border-bottom-left-radius: 9px !important;
}

.taste-scope .btn-group:has([data-bs-toggle="dropdown"]) > .btn.dropdown-toggle,
.taste-scope .btn-group:has([data-bs-toggle="dropdown"]) > .btn.dropdown-toggle-split {
    border-top-right-radius: 9px !important;
    border-bottom-right-radius: 9px !important;
    border-right: 0 !important;
}

.taste-scope .btn-group > .dropdown-menu {
    z-index: 1080;
}

.taste-scope .btn-group > .btn.active {
    background: color-mix(in srgb, var(--secondary-color) 14%, transparent) !important;
    color: var(--secondary-color) !important;
}

@media (max-width: 767px) {
    .taste-scope > h2.page-title + .row.mb-3 > [class*="col-"]:last-child,
    .taste-scope > .page-title + .row.mb-3 > [class*="col-"]:last-child {
        justify-content: flex-start;
    }

    .taste-scope .input-group {
        max-width: 100%;
        width: 100%;
    }
}
