/* === Quality tool styles === */

/* Выключенные товары (оранжевый пунктир справа) */
tr.product-disabled,
.product-item.product-disabled {

    position: relative;
}

.product-item.product-disabled::after {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    right: 6px;
    width: 3px;
    border-radius: 2px;
    border-right: 3px dashed #f59e0b;
}

/* Архивные товары (красная полоска справа) */
.product-item.product-archive {
    position: relative;
}

.product-item.product-archive::after {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    right: 6px;
    width: 3px;
    border-radius: 2px;
    background: #ef4444;
}

/* Изменённые товары (подсветка строки, для таблицы скана) */
tr.product-modified {
    background: rgba(34, 197, 94, 0.08);
}

/* Ссылка на товар */
.product-link {
    color: var(--text-primary, #e0e0e0);
    text-decoration: none;
}

.product-link:hover {
    color: var(--accent-color, #6ea8fe);
    text-decoration: underline;
}

/* Иконка редактирования */
.edit-icon {
    cursor: pointer;
    opacity: 0.4;
    font-size: 14px;
    transition: opacity 0.15s;
}

.edit-icon:hover {
    opacity: 1;
}

/* Иконка информации о товаре */
.product-info-icon {
    cursor: pointer;
    opacity: 0.35;
    font-size: 15px;
    margin-left: 6px;
    transition: opacity 0.15s;
    color: var(--accent-color, #6ea8fe);
    user-select: none;
}

.product-info-icon:hover {
    opacity: 1;
}

/* Попап с информацией о товаре */
.product-info-popup {
    position: absolute;
    z-index: 1000;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 400px;
    max-width: 600px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border-color, #2d2d44);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    padding: 14px;
    font-size: 13px;
    line-height: 1.5;
}

.product-info-popup .product-info-close {
    position: absolute;
    top: 6px;
    right: 10px;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary, #888);
    opacity: 0.6;
    transition: opacity 0.15s;
}

.product-info-popup .product-info-close:hover {
    opacity: 1;
}

.product-info-section {
    margin-bottom: 6px;
    font-size: 12px;
}

.product-info-attrs {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 12px;
}

.product-info-attrs td {
    padding: 2px 8px 2px 0;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color, #2d2d44);
}

.product-info-attr-name {
    white-space: nowrap;
    color: var(--text-secondary, #888);
    font-weight: 500;
}

.product-info-desc {
    font-size: 12px;
    color: var(--text-secondary, #aaa);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 180px;
    overflow-y: auto;
}

.product-info-highlight {
    background: rgba(250, 204, 21, 0.35);
    color: #fde047;
    padding: 0 2px;
    border-radius: 2px;
}

.product-info-loading {
    font-size: 12px;
    color: var(--text-secondary, #888);
    padding: 8px 0;
}

.product-info-error {
    font-size: 12px;
    color: var(--error-color, #ef4444);
    padding: 8px 0;
}

/* Отключённые категории в дереве */
.tree-row-disabled .tree-name {
    color: #ef4444;
    opacity: 0.6;
}

.tree-row-disabled .tree-count {
    color: #ef4444;
    opacity: 0.6;
}

/* Компактное дерево — уменьшаем отступы вложенности */
.tree-children {
    padding-left: 12px !important;
}

.tree-row {
    padding: 4px 6px !important;
}

.tree-name {
    font-size: 12px !important;
}

.tree-toggle {
    width: 16px !important;
    height: 16px !important;
    font-size: 12px !important;
    margin-right: 4px !important;
}

.tree-toggle-spacer {
    width: 16px !important;
    margin-right: 4px !important;
}

.tree-count {
    font-size: 10px !important;
    margin-left: 4px !important;
    padding: 0 4px !important;
}

/* Панель промпта + модели (раскрывающаяся) */
.ai-config-panel {
    background: var(--bg-secondary, #1a1a2e);
    border: 1px solid var(--border-color, #2d2d44);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    display: none;
}

.ai-config-panel.open {
    display: block;
}

.ai-config-panel .model-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.ai-config-panel .model-checkboxes label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    cursor: pointer;
}

.ai-config-panel textarea {
    width: 100%;
    min-height: 120px;
    font-family: monospace;
    font-size: 12px;
    resize: vertical;
    background: var(--bg-primary, #0f0f23);
    color: var(--text-primary, #e0e0e0);
    border: 1px solid var(--border-color, #2d2d44);
    border-radius: 4px;
    padding: 8px;
}

.ai-config-panel .panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* === Product item card layout (Атрибуты workbench) === */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-item {
    background: var(--bg-secondary, #18222D);
    border: 1px solid var(--border-color, #2d2d44);
    border-radius: 10px;
    padding: 14px;
    transition: background 0.2s;
}

.product-item.no-value {
    background: rgba(248, 81, 73, 0.06);
}

/* Основной ряд: фото | центр (название + поля) | кнопки */
.product-item-body {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.product-item-image {
    flex-shrink: 0;
    position: relative;
}

.product-item-image img {
    width: 130px;
    height: 130px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    cursor: pointer;
}

/* Карусель миниатюр */
.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
}

.carousel-btn {
    background: var(--bg-color, #1e1e2e);
    border: 1px solid var(--border-color, #2d2d44);
    color: var(--text-color, #ccc);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn:hover {
    background: var(--hover-bg, #2a2a3e);
}

.carousel-counter {
    font-size: 11px;
    color: var(--text-secondary, #888);
    min-width: 30px;
    text-align: center;
}

/* Лайтбокс */
.image-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-lightbox {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.lb-img {
    max-width: 400px;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    background: #111;
}

.lb-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 36px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lb-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lb-close {
    position: absolute;
    top: -40px;
    right: -10px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
}

.lb-close:hover {
    color: #f66;
}

.lb-counter {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #ccc;
    font-size: 13px;
}

/* Центральный блок: название сверху, поля снизу */
.product-item-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.product-item-name {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.product-item-name .product-link {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

/* Поля RU + UA — горизонтально */
.product-item-fields {
    display: flex;
    gap: 12px;
}

.product-item-field {
    flex: 1;
    min-width: 0;
}

.product-item-field .field-label {
    font-size: 11px;
    color: var(--text-secondary, #888);
    margin-bottom: 4px;
    font-weight: 600;
}

/* Кнопки справа */
.product-item-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100px;
    align-self: stretch;
}

.product-item-actions .btn-save {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: var(--success-color, #22c55e);
    color: #fff;
    transition: background 0.15s;
    text-align: center;
}

.product-item-actions .btn-save:hover {
    background: #16a34a;
}

.product-item-actions .btn-delete {
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary, #888);
    transition: color 0.15s;
    text-align: right;
    align-self: flex-end;
}

.product-item-actions .btn-delete:hover {
    color: #ef4444;
}

/* Несохранённые изменения */
.product-item.product-unsaved {
    border-color: var(--warning-color, #f59e0b);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3);
}

.product-item.product-unsaved .btn-save {
    animation: pulse-save 1.5s ease-in-out 2;
}

@keyframes pulse-save {

    0%,
    100% {
        box-shadow: none;
    }

    50% {
        box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    }
}

/* Иконка настройки AI (возле кнопок) */
.ai-config-icon {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: opacity 0.15s;
    vertical-align: middle;
}

.ai-config-icon:hover {
    opacity: 1;
}

.ai-config-icon.active {
    opacity: 1;
    color: var(--accent-color, #6ea8fe);
}

/* === Quick Editor Modal (название + мета + перевод) === */
.qe-modal {
    max-width: 900px;
}

.qe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.qe-header h3 {
    margin: 0;
}

.qe-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary, #888);
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.qe-close:hover {
    color: var(--text-primary, #e0e0e0);
}

.qe-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.qe-col-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color, #2d2d44);
}

.qe-field {
    margin-bottom: 10px;
}

.qe-field label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary, #888);
    margin-bottom: 4px;
    font-weight: 500;
}

.qe-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    background: var(--bg-color, #0f0f23);
    color: var(--text-primary, #e0e0e0);
    border: 1px solid var(--border-color, #2d2d44);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.qe-input:focus {
    border-color: var(--accent-color, #6ea8fe);
}

textarea.qe-input {
    resize: vertical;
    font-family: inherit;
    min-height: 60px;
}

.qe-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #2d2d44);
}

.qe-actions-left {
    display: flex;
    gap: 8px;
}

.qe-actions-right {
    display: flex;
    gap: 8px;
}

.qe-status {
    margin-top: 8px;
    font-size: 12px;
    min-height: 18px;
}

.qe-status-loading {
    color: var(--text-secondary, #888);
}

.qe-status-success {
    color: var(--success-color, #22c55e);
}

.qe-status-error {
    color: var(--error-color, #ef4444);
}

/* Строка с группами кнопок */
.qe-actions-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--border-color, #2d2d44);
}

.qe-actions-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qe-group-label {
    font-size: 12px;
    color: var(--text-secondary, #888);
    white-space: nowrap;
}

/* AI кнопки — акцентный цвет */
.btn-small.ai-btn {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.3);
}

.btn-small.ai-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}

/* Подсветка изменённых AI полей */
.qe-input.qe-changed {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.06);
}