/* pack_editor.css - Стили для редактора пачек */
/* v3.0.0 - 15.12.2025 17:15 (Оптимизация: кеш + параллельная загрузка + группировка) */

/* ═══════════════════════════════════════════════════════════
   ОБЩИЕ СТИЛИ
   ═══════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* ═══════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════ */

.pack-editor-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.header-left h1 {
    font-size: 24px;
    color: #333;
}

.shop-switcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
}

.shop-switcher i {
    color: #667eea;
    font-size: 16px;
}

.shop-switcher select {
    padding: 10px 35px 10px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 200px;
    transition: all 0.3s;
}

.shop-switcher select:hover {
    border-color: #5568d3;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.shop-switcher select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Кастомный select с поиском внутри */
.custom-select-wrapper {
    position: relative;
    width: 250px;
}

.custom-select {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.custom-select:hover {
    border-color: #667eea;
}

.custom-select.active {
    border-color: #667eea;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select .fa-filter {
    color: #667eea;
    font-size: 14px;
}

.custom-select-value {
    flex: 1;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-arrow {
    color: #999;
    font-size: 12px;
    transition: transform 0.3s;
}

.custom-select.active .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
}

.custom-select-search {
    position: relative;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.custom-select-search i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
}

.custom-select-search input {
    width: 100%;
    padding: 8px 12px 8px 35px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    transition: all 0.3s;
}

.custom-select-search input:focus {
    outline: none;
    border-color: #667eea;
}

.custom-select-options {
    max-height: 300px;
    overflow-y: auto;
}

.custom-select-option {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: #f0f4ff;
    color: #667eea;
}

.custom-select-option.selected {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.custom-select-option[style*="display: none"] {
    display: none !important;
}

.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.custom-select-header {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

.category-clear-btn {
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.category-clear-btn:hover {
    background: #ef4444;
    border-color: #dc2626;
    color: white;
}

.custom-select-checkbox-option {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
    user-select: none;
}

.custom-select-checkbox-option:last-child {
    border-bottom: none;
}

.custom-select-checkbox-option:hover {
    background: #f0f4ff;
}

.custom-select-checkbox-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.custom-select-checkbox-option label {
    flex: 1;
    cursor: pointer;
}

.custom-select-checkbox-option.checked {
    background: #eff6ff;
}

.custom-select-checkbox-option[style*="display: none"] {
    display: none !important;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 15px;
    color: #999;
}

.search-box input {
    padding: 12px 15px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    width: 300px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.refresh-data-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.refresh-data-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.refresh-data-btn:active {
    transform: translateY(0);
}

.refresh-data-btn i {
    animation: none;
}

.refresh-data-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.stats-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f0f4ff;
    border-radius: 8px;
    color: #667eea;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */

.pack-editor-main {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 30px;
    min-height: calc(100vh - 250px);
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 80px 20px;
    color: white;
}

/* Skeleton Loaders */
.skeleton-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-line {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-photo {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: white;
}

.empty-state i {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.empty-state h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 16px;
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════
   PACKS GRID
   ═══════════════════════════════════════════════════════════ */

.packs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
    padding-bottom: 40px;
}

/* Pack Card */
.pack-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.pack-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.pack-card.editing {
    border: 2px solid #667eea;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

/* Pack Header */
.pack-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.pack-id {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
}

.shop-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 5px;
}

/* Компактные кнопки-иконки */
.pack-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    position: relative;
    text-decoration: none;
}

.embeddings-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.embeddings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.photo-btn {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    color: white;
}

.photo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(32, 201, 151, 0.4);
}

.edit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pack-card.editing .edit-btn {
    background: #dc3545;
}

.pack-card.editing .edit-btn i::before {
    content: "\f00d"; /* X icon */
}

.delete-btn {
    background: #ef4444;
    color: white;
}

.delete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Старые классы для совместимости */
.edit-button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

.edit-button:hover {
    transform: scale(1.05);
}

.edit-button.cancel {
    background: #dc3545;
}

/* Pack Fields */
.pack-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0; /* Важно для правильного overflow */
}

.field-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-value {
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    border: 2px solid transparent;
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.field-value.editing {
    border-color: #667eea;
    background: white;
    outline: none;
}

.field-value.editing:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Pack Photos */
.pack-photos {
    margin-top: 20px;
}

.photos-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: block;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.photo-slot {
    aspect-ratio: 1;
    border: 2px dashed #ddd;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
    transition: all 0.3s;
}

.photo-slot.has-photo {
    border-style: solid;
    border-color: #667eea;
}

.photo-slot.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.photo-slot.drag-over {
    border-color: #28a745;
    background: #d4edda;
}

.photo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: move;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
}

.photo-image.loading {
    animation: shimmer 1.5s infinite;
}

.photo-image.loaded {
    animation: none;
}

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    font-size: 14px;
}

.photo-controls {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}

.photo-slot:hover .photo-controls {
    opacity: 1;
}

.photo-delete {
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.photo-delete:hover {
    transform: scale(1.1);
    background: rgba(220, 53, 69, 1);
}

.photo-index {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* Save Button */
.save-button {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: none;
}

.pack-card.editing .save-button {
    display: block;
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.save-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */

.pack-editor-footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    text-align: center;
    margin-top: 40px;
}

.version-info {
    color: white;
    font-size: 14px;
    opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .search-box input {
        width: 100%;
    }

    .packs-grid {
        grid-template-columns: 1fr;
    }

    .pack-fields {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════
   NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    border-left: 4px solid #28a745;
}

.notification.error {
    border-left: 4px solid #dc3545;
}

.notification.info {
    border-left: 4px solid #667eea;
}

.notification i {
    font-size: 20px;
}

.notification.success i {
    color: #28a745;
}

.notification.error i {
    color: #dc3545;
}

.notification.info i {
    color: #667eea;
}

/* ═══════════════════════════════════════════════════════════
   ФОТО МОДАЛЬНОЕ ОКНО
   ═══════════════════════════════════════════════════════════ */

.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.photo-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.photo-modal-header {
    padding: 25px 30px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
}

.photo-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: white;
}

.photo-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s;
}

.photo-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.photo-modal-body {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

/* Слоты редактирования фото */
.photo-edit-slot {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    background: #f8f9fa;
    transition: all 0.3s;
}

.photo-edit-slot:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.photo-edit-header {
    margin-bottom: 15px;
}

.photo-edit-label {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.photo-edit-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    background: white;
    border: 2px dashed #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-edit-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-edit-preview .photo-placeholder {
    color: #999;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.photo-edit-preview .photo-placeholder i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
}

.photo-edit-controls {
    display: flex;
    gap: 10px;
}

.photo-edit-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.photo-upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.photo-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.photo-delete-btn {
    background: #dc3545;
    color: white;
}

.photo-delete-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.photo-delete-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Прогресс загрузки */
.photo-upload-progress {
    margin-top: 15px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
    animation: progressAnimation 1.5s ease-in-out infinite;
}

@keyframes progressAnimation {
    0% { width: 0%; }
    50% { width: 50%; }
    100% { width: 100%; }
}

.progress-text {
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
}

.photo-modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.photo-modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.photo-cancel-btn {
    background: #6c757d;
    color: white;
}

.photo-cancel-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.photo-save-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.photo-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.photo-save-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Старые классы для совместимости - убраны */

/* Responsive для модалки */
@media (max-width: 768px) {
    .photo-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .photo-modal-header {
        border-radius: 0;
    }
    
    .photo-modal-body {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .photo-modal-footer {
        flex-direction: column;
    }
    
    .photo-modal-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ═══════════════════════════════════════════════════════════
   МОДАЛЬНОЕ ОКНО ПОДТВЕРЖДЕНИЯ УДАЛЕНИЯ
   ═══════════════════════════════════════════════════════════ */

.delete-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.delete-confirm-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.delete-confirm-header {
    padding: 25px 30px;
    border-bottom: 2px solid #fee2e2;
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-radius: 16px 16px 0 0;
}

.delete-confirm-header i {
    font-size: 28px;
    color: #dc2626;
}

.delete-confirm-header h3 {
    margin: 0;
    font-size: 20px;
    color: #991b1b;
}

.delete-confirm-body {
    padding: 25px 30px;
}

.delete-confirm-body p {
    margin: 0 0 15px 0;
    font-size: 15px;
    color: #374151;
    line-height: 1.6;
}

.delete-product-info {
    padding: 12px 15px;
    background: #f3f4f6;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-weight: 600;
    color: #1f2937;
}

.delete-warning {
    color: #dc2626;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 15px;
    background: #fef2f2;
    border-radius: 8px;
    border-left: 4px solid #dc2626;
}

.delete-confirm-footer {
    padding: 20px 30px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.delete-btn-cancel,
.delete-btn-confirm {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.delete-btn-cancel {
    background: #6b7280;
    color: white;
}

.delete-btn-cancel:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

.delete-btn-confirm {
    background: #ef4444;
    color: white;
}

.delete-btn-confirm:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.delete-btn-confirm:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* ═══════════════════════════════════════════════════════════
   ВКЛАДКИ НАВИГАЦИИ
   ═══════════════════════════════════════════════════════════ */

.tabs-navigation {
    background: white;
    padding: 0 30px;
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 80px;
    z-index: 99;
}

.tab-btn {
    padding: 15px 25px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* ═══════════════════════════════════════════════════════════
   КНОПКА НАСТРОЕК В МОДАЛЬНОМ ОКНЕ
   ═══════════════════════════════════════════════════════════ */

.photo-settings-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s;
    margin-left: auto;
}

.photo-settings-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════════════════
   ПАНЕЛЬ НАСТРОЕК ОБРАБОТКИ ФОТО
   ═══════════════════════════════════════════════════════════ */

.processing-settings {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    padding: 16px;
    margin: 0 16px 16px;
    border: 1px solid #e2e8f0;
}

.processing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1e293b;
}

.processing-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.processing-toggle input {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
}

/* Пресеты фильтров */
.filter-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.preset-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.preset-btn.active {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
}

/* Слайдеры настроек */
.processing-sliders {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slider-group label {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    display: flex;
    justify-content: space-between;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    appearance: none;
    cursor: pointer;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.reset-settings-btn {
    width: 100%;
    padding: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-settings-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

/* ═══════════════════════════════════════════════════════════
   КНОПКИ ДЕЙСТВИЙ В ЗАГОЛОВКЕ ФОТО
   ═══════════════════════════════════════════════════════════ */

.photo-edit-actions {
    display: flex;
    gap: 8px;
}

.photo-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-action-btn:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.photo-download-btn {
    background: #10b981 !important;
}

.photo-download-btn:hover {
    background: #059669 !important;
}

/* ═══════════════════════════════════════════════════════════
   МОДАЛЬНОЕ ОКНО ОБРЕЗКИ
   ═══════════════════════════════════════════════════════════ */

.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.crop-modal-content {
    background: #1f2937;
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.crop-modal-header {
    padding: 16px 20px;
    background: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #374151;
}

.crop-modal-header h3 {
    color: white;
    font-size: 18px;
    margin: 0;
}

.crop-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.crop-modal-close:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.crop-modal-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: auto;
}

.crop-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 60vh;
}

.crop-container img {
    max-width: 100%;
    max-height: 60vh;
    display: block;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 3px solid #10b981;
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    cursor: move;
    pointer-events: auto;
    min-width: 50px;
    min-height: 50px;
}

.crop-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px dashed rgba(255, 255, 255, 0.5);
}

/* Сетка 3x3 внутри области обрезки */
.crop-box::after {
    content: '';
    position: absolute;
    top: 33.33%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 calc(33.33% + 1px) 0 rgba(255, 255, 255, 0.3);
}

.crop-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.crop-handle-nw {
    top: -10px;
    left: -10px;
    cursor: nw-resize;
}

.crop-handle-ne {
    top: -10px;
    right: -10px;
    cursor: ne-resize;
}

.crop-handle-sw {
    bottom: -10px;
    left: -10px;
    cursor: sw-resize;
}

.crop-handle-se {
    bottom: -10px;
    right: -10px;
    cursor: se-resize;
}

.crop-info {
    margin-top: 16px;
    color: #9ca3af;
    font-size: 14px;
}

.crop-modal-footer {
    padding: 16px 20px;
    background: #111827;
    display: flex;
    gap: 12px;
    border-top: 1px solid #374151;
}

.crop-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.crop-cancel-btn {
    background: #4b5563;
    color: white;
}

.crop-cancel-btn:hover {
    background: #374151;
}

.crop-apply-btn {
    background: #10b981;
    color: white;
}

.crop-apply-btn:hover {
    background: #059669;
    transform: scale(1.02);
}

/* ═══════════════════════════════════════════════════════════
   ИНДИКАТОРЫ СОСТОЯНИЯ ФОТО
   ═══════════════════════════════════════════════════════════ */

.photo-preview-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.photo-status-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10;
}

.photo-status-pending {
    background: #fbbf24;
    color: #78350f;
}

.photo-status-uploading {
    background: #3b82f6;
    color: white;
    animation: pulse 1.5s infinite;
}

.photo-status-uploaded {
    background: #10b981;
    color: white;
}

.photo-status-error {
    background: #ef4444;
    color: white;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.photo-status-processing {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    background: #f3f4f6;
    border-radius: 8px;
    color: #6b7280;
    font-size: 14px;
}

/* Блокировка кнопки сохранения */
.photo-save-btn:disabled {
    background: #9ca3af !important;
    cursor: not-allowed;
    transform: none !important;
}

.photo-cancel-btn:disabled {
    background: #9ca3af !important;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════
   ГРУППИРОВКА ПО ПОДКАТЕГОРИЯМ
   ═══════════════════════════════════════════════════════════ */

.subcategory-group {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.subcategory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 3px solid #f0f0f0;
}

.subcategory-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
}

.subcategory-header h2 i {
    font-size: 18px;
}

.subcategory-count {
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
}

/* ═══════════════════════════════════════════════════════════
   ДУБЛИКАТЫ
   ═══════════════════════════════════════════════════════════ */

.duplicate-group {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.duplicate-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.duplicate-group-header h3 {
    margin: 0;
    font-size: 18px;
    color: #667eea;
    font-weight: 700;
}

.duplicate-characteristics {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.char-badge {
    padding: 6px 12px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.duplicate-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.duplicate-card {
    border: 3px solid #fbbf24;
    background: linear-gradient(to bottom, #fffbeb 0%, white 100%);
}

.duplicate-card:hover {
    border-color: #f59e0b;
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3);
}

.differences-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
}

.exact-duplicate-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
}

.not-duplicate-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.not-duplicate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE ДЛЯ НОВЫХ ЭЛЕМЕНТОВ
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .tabs-navigation {
        padding: 0 15px;
    }
    
    .tab-btn {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .processing-settings {
        margin: 0 10px 10px;
        padding: 12px;
    }
    
    .filter-presets {
        flex-direction: column;
    }
    
    .preset-btn {
        min-width: auto;
    }
    
    .crop-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

