/**
 * Стилі для клієнтської частини плагіну SPU
 * Організовано за логічними блоками для кращого обслуговування
 */


/* ========================================= */
/* 1. ОСНОВНІ СТИЛІ ФОРМИ ЗАВАНТАЖЕННЯ      */
/* ========================================= */
.spu-upload-form {
    margin: 20px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
.spu-upload-form * { box-sizing: border-box; }

.spu-upload-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.spu-upload-form-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}
.spu-files-counter {
    color: #666;
    font-size: 14px;
    font-weight: normal;
    margin-left: 8px;
}
.spu-version {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* ========================================= */
/* 2. СЕЛЕКТОР ФОРМАТІВ                     */
/* ========================================= */
.spu-format-info {
    display: flex;
    margin-top: 5px;
    padding: 5px;
    /*
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    */
}

/* ========================================= */
/* 3. ДРОПЗОНА                              */
/* ========================================= */
.spu-dropzone { margin-bottom: 2px; }
.spu-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    background-color: #fff;
    border: 2px dashed #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.spu-dropzone-inner:hover { border-color: #999; }
.spu-dropzone-icon {
    font-size: 24px;
    color: #4CAF50;
    margin-bottom: 5px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.spu-dropzone-text {
    font-size: 14px; color: #666;
    text-align: center;
}

.spu-dropzone-info {
    font-size: 10px;
    text-align: center;
    color: #7e7e7e;
}

.spu-dropzone-info p { margin: 5px 0; }

/* ========================================= */
/* 4. ПРОГРЕС-БАРИ                          */
/* ========================================= */

/* Індикатор throttling */
.spu-throttle-indicator {
    font-size: 12px;
    color: #666;
    padding: 4px 8px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    text-align: center;
    margin-top: 4px;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ========================================= */
/* 5. ГАЛЕРЕЯ ТА МІНІАТЮРИ                 */
/* ========================================= */
.spu-gallery { margin-bottom: 20px; }
.spu-gallery h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: 600;
}


.spu-gallery-empty {
    text-align: center;
    color: #666;
    background-color: #dee2e6;
    border: 1px solid #ddd;
    border-radius: 3px;
}

/* ========================================= */
/* 6. КНОПКИ ГАЛЕРЕЇ                       */
/* ========================================= */
.spu-gallery-header {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 5px;
}



.spu-divider {
    color: #ccc;
    padding: 0 5px;
}

.spu-thumbnail-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========================================= */
/* 7. ПАЛІТРА КОЛЬОРІВ                      */
/* ========================================= */
.spu-thumbnail-color-palette {
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    background-color: transparent;
    z-index: var(--spu-z-progress);
    transform: translateY(-50%);
}

.spu-palette-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}
.spu-palette-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.spu-thumbnail-main-palette,
.spu-thumbnail-brightness-gradient {
    position: relative;
    margin-bottom: 0;
    margin-top: 0;
}
.spu-thumbnail-palette-canvas,
.spu-thumbnail-brightness-canvas {
    width: 100%;
    height: 15px;
    cursor: pointer;
    border: 2px solid #fff;
    display: block;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
    margin: 0;
}
.spu-palette-apply,
.spu-palette-cancel {
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}
.spu-palette-apply { background-color: #74d377; }
.spu-palette-apply:hover { background-color: #45a049; transform: scale(1.1); }
.spu-palette-cancel { background-color: #d68383; }
.spu-palette-cancel:hover { background-color: #a00; transform: scale(1.1); }
.spu-palette-marker {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #fff;
    border: 2px solid #000;
    border-radius: 50%;
    pointer-events: none;
    z-index: var(--spu-z-progress);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}
.spu-main-marker,
.spu-brightness-marker {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ========================================= */
/* 8. МОДАЛЬНЕ ВІКНО РЕДАКТОРА              */
/* ========================================= */
.spu-editor-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: var(--spu-z-modals);
    display: flex;
    align-items: center;
    justify-content: center;
}
.spu-editor-modal-content {
    width: 95%;
    max-width: 1200px;
    max-height: 95vh;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.spu-editor-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}
.spu-editor-modal-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
}
.spu-editor-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}
.spu-editor-modal-close:hover { background-color: #e9ecef; color: #333; }
.spu-editor-modal-body {
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    background-color: #f8f9fa;
}
.spu-editor-canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    min-height: 400px;
    overflow: hidden;
}
#spu-editor-canvas {
    border: 1px solid #ccc;
    cursor: move;
    background-color: #f8f9fa;
}

/* ========================================= */
/* 9. ПАНЕЛЬ ШАБЛОНІВ                       */
/* ========================================= */
.spu-editor-templates {
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    max-height: 150px;
    overflow-y: auto;
}
.spu-templates-header h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.spu-templates-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.spu-template-item {
    width: 60px;
    height: 60px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.spu-template-item:hover { border-color: #007bff; transform: scale(1.05); }
.spu-template-item.active { border-color: #007bff; background-color: #e3f2fd; }
.spu-template-item img { width: 100%; height: 40px; object-fit: cover; }
.spu-template-item .spu-template-name {
    font-size: 8px;
    text-align: center;
    padding: 2px;
    color: #666;
}

/* ========================================= */
/* 10. ДОДАТКОВІ КОНТРОЛИ                   */
/* ========================================= */
.spu-additional-controls { margin-bottom: 15px; }
.spu-editor-sliders {
    width: 60%;
    margin: 0 auto 15px auto;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
}
.spu-filters-panel {
    display: flex;
    gap: 10px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
}
.spu-filters-panel button {
    padding: 8px 16px;
    background-color: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
}
.spu-filters-panel button:hover { background-color: #5a6268; }
.spu-filters-panel button.active { background-color: #007bff; }
.spu-slider-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 8px;
}
.spu-slider-panel label {
    font-weight: bold;
    min-width: 80px;
    font-size: 12px;
}
.spu-slider-panel input[type="range"] {
    flex-grow: 1;
    margin: 0 10px;
}
.spu-slider-panel .spu-slider-value {
    font-size: 12px;
    font-weight: bold;
    min-width: 40px;
    text-align: right;
}
.spu-slider-apply {
    background-color: #28a745 !important;
    color: #fff !important;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.spu-slider-apply:hover { background-color: #218838 !important; }
.spu-slider-apply .dashicons { color: #fff !important; font-size: 14px; }
.spu-slider-cancel {
    background-color: #dc3545 !important;
    color: #fff !important;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.spu-slider-cancel:hover { background-color: #c82333 !important; }
.spu-slider-cancel .dashicons { color: #fff !important; font-size: 14px; }

/* ========================================= */
/* 11. ДОДАТКОВІ ЕЛЕМЕНТИ                   */
/* ========================================= */
.spu-hide-gallery { display: none !important; }
.spu-bg-color-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border: 1px solid #333;
    border-radius: 2px;
    background-color: #fff;
    transition: background-color 0.2s ease;
}
.spu-editor-bg-toggle { position: relative; }
.spu-editor-save { background-color: #28a745 !important; }
.spu-editor-save:hover { background-color: #218838 !important; }
.spu-editor-save .dashicons { color: #fff !important; }
.spu-editor-cancel { background-color: #dc3545 !important; }
.spu-editor-cancel:hover { background-color: #c82333 !important; }
.spu-editor-cancel .dashicons { color: #fff !important; }

/* ========================================= */
/* 12. ДІЇ ФОРМИ                            */
/* ========================================= */
.spu-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0px 0px 0px;
}

/* ========================================= */
/* 13. ЛОАДЕР ЗАВАНТАЖЕННЯ ФАЙЛІВ           */
/* ========================================= */
.spu-loading {
    display: none;
    text-align: center;
    /*padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    */
    margin: 0 0 10px 0;
}

.spu-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spu-spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spu-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spu-loading p {
    margin: 0;
    color: #383838;
    font-size: 14px;
}

/* ========================================= */
/* 14. ПРИХОВАНІ ЕЛЕМЕНТИ                   */
/* ========================================= */
.spu-file-input { display: none !important; }
.spu-editor-modal { display: none; }
.spu-color-palette { display: none; }
.spu-filters-panel { display: none; }
.spu-contrast-panel { display: none; }
.spu-brightness-panel { display: none; }
.spu-saturation-panel { display: none; }
.spu-sharpness-panel { display: none; }
.spu-blur-panel { display: none; }
.spu-template-modal { display: none; }

/* ========================================= */
/* 14. ЗАБОРОНА DRAG/ВИДІЛЕННЯ              */
/* ========================================= */
.spu-thumbnail-content,
.spu-thumbnail-image {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    touch-action: none;
}

/* ========================================= */
/* 15. АДАПТИВНІСТЬ (MOBILE)                */
/* ========================================= */
@media (max-width: 768px) {
    .spu-gallery-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .spu-divider {
        display: none;
    }
    .spu-editor-controls { grid-template-columns: 1fr; }
    .spu-format-info { flex-direction: column; }
    .spu-upload-form-footer { flex-direction: column; gap: 10px; }
    .spu-upload-form-counter { margin-top: 10px; }
}

@media (max-width: 480px) {
    .spu-editor-controls { flex-direction: column; gap: 10px; padding: 10px; }
    .spu-editor-tools-left,
    .spu-editor-tools-center,
    .spu-editor-tools-right { justify-content: center; flex-wrap: wrap; gap: 6px; }
    .spu-editor-controls button { min-width: 40px; min-height: 40px; padding: 6px; }
    .spu-color-palette { padding: 8px; }
    .spu-color-palette-main,
    .spu-color-brightness { margin-bottom: 8px; }
    #spu-color-palette-canvas,
    #spu-brightness-gradient-canvas { height: 20px; }
    .spu-editor-modal-content { width: 98%; max-height: 98vh; }
    .spu-editor-canvas-container { min-height: 200px; padding: 5px; }
    #spu-editor-canvas { max-height: 40vh; }
    .spu-slider-panel { padding: 8px; gap: 8px; }
    .spu-slider-panel label { min-width: 60px; font-size: 11px; }
    .spu-filters-panel { padding: 8px; gap: 8px; }
    .spu-filters-panel button { padding: 6px 12px; font-size: 11px; }
}

/* ========================================= */
/* 16. ЧАНКОВЕ ЗАВАНТАЖЕННЯ                  */
/* ========================================= */

/* Статус завантаження */
.spu-uploading {
    border-color: #007cba;
    background-color: #f0f8ff;
}

/* Порожня мініатюра під час завантаження */
.spu-empty-thumbnail {
    width: 100%;
    height: 120px;
    background-color: #e9ecef;
    border: 2px dashed #adb5bd;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Прогрес-бар завантаження */
.spu-upload-progress-bar {
    position: relative;
    flex: 1;
    height: 20px;
    background: repeating-linear-gradient(
        -45deg,
        #e0e0e0 0px,
        #e0e0e0 10px,
        #eeeeee 10px,
        #eeeeee 20px
    );
    animation: spu-progress-stripes 1s linear infinite;
    border-radius: 4px;
    overflow: hidden;
}

.spu-upload-progress-fill {
    height: 100%;
    background: linear-gradient(-45deg, #7cdaff, #7ac2fc);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
    position: relative;
}

.spu-upload-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: spuProgressShine 2s infinite;
}

@keyframes spu-progress-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 40px 0; }
}

/* Текст прогресу */
.spu-upload-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #333;
    font-weight: 500;
    text-align: center;
    z-index: 2;
}

/* Кнопка скасування завантаження */
.spu-cancel-upload {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.spu-cancel-upload:hover {
    background-color: #c82333;
    border-color: #c82333;
    color: #fff;
}

/* Помилки завантаження */
.spu-upload-error {
    border-color: #dc3545;
    background-color: #f8d7da;
}

.spu-upload-error-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(220, 53, 69, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    max-width: 90%;
    word-wrap: break-word;
    z-index: var(--spu-z-progress);
}

/* Анімація завантаження */
@keyframes spu-upload-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.spu-uploading .spu-empty-thumbnail {
    animation: spu-upload-pulse 2s infinite;
}

/* Адаптивність для завантаження */
@media (max-width: 768px) {
    .spu-empty-thumbnail {
        height: 100px;
    }

    .spu-upload-progress-text {
        font-size: 12px;
    }

    .spu-upload-error-msg {
        font-size: 10px;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .spu-empty-thumbnail {
        height: 80px;
    }

    .spu-upload-progress-text {
        font-size: 10px;
    }

    .spu-upload-error-msg {
        font-size: 9px;
        padding: 4px 6px;
    }
}

/* ========================================= */
/* 17. МОДАЛЬНЕ ВІКНО ПОВТОРНОГО ЗАВАНТАЖЕННЯ */
/* ========================================= */

/* Retry Modal Styles */
.spu-retry-modal-overlay {
    position: fixed;
    z-index: var(--spu-z-critical);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--spu-z-notifications);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.spu-retry-modal-overlay.spu-retry-modal-visible {
    opacity: 1;
}

.spu-retry-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    margin: 20px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.spu-retry-modal-overlay.spu-retry-modal-visible .spu-retry-modal {
    transform: scale(1);
}

.spu-retry-modal-header {
    padding: 20px 20px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.spu-retry-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.spu-retry-modal-body {
    padding: 20px;
}

.spu-retry-modal-body p {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #555;
}

.spu-retry-modal-body p:last-child {
    margin-bottom: 0;
}

.spu-retry-modal-actions {
    padding: 15px 20px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.spu-retry-modal-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spu-retry-button {
    background: #007cba;
    color: #fff;
}

.spu-retry-button:hover {
    background: #005a87;
}

.spu-cancel-button {
    background: #f0f0f0;
    color: #333;
}

.spu-cancel-button:hover {
    background: #e0e0e0;
}

.spu-retry-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: var(--spu-z-notifications);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.spu-retry-modal-overlay.spu-retry-modal-visible {
    opacity: 1;
}

.spu-retry-modal {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.spu-retry-modal-overlay.spu-retry-modal-visible .spu-retry-modal {
    transform: scale(1);
}

.spu-retry-modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.spu-retry-modal-header h3 {
    margin: 0 0 10px 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
}

.spu-retry-modal-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.spu-retry-file-list {
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.spu-retry-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
}

.spu-retry-file-item:last-child {
    margin-bottom: 0;
}

.spu-retry-file-name {
    font-weight: 600;
    color: #333;
    flex: 1;
    margin-right: 10px;
    word-break: break-word;
}

.spu-retry-file-error {
    font-size: 12px;
    color: #dc3545;
    flex: 1;
    text-align: right;
    font-style: italic;
}

.spu-retry-modal-buttons {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.spu-retry-btn,
.spu-cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 120px;
}

.spu-retry-btn {
    background-color: #007cba;
    color: #fff;
}

.spu-retry-btn:hover {
    background-color: #005a87;
    transform: translateY(-1px);
}

.spu-cancel-btn {
    background-color: #6c757d;
    color: #fff;
}

.spu-cancel-btn:hover {
    background-color: #545b62;
    transform: translateY(-1px);
}

/* Адаптивність для модального вікна */
@media (max-width: 768px) {
    .spu-retry-modal {
        width: 95%;
        max-height: 90vh;
    }

    .spu-retry-modal-header {
        padding: 15px;
    }

    .spu-retry-modal-header h3 {
        font-size: 1.2em;
    }

    .spu-retry-file-list {
        padding: 15px;
        max-height: 250px;
    }

    .spu-retry-file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .spu-retry-file-error {
        text-align: left;
        font-size: 11px;
    }

    .spu-retry-modal-buttons {
        padding: 15px;
        flex-direction: column;
    }

    .spu-retry-btn,
    .spu-cancel-btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .spu-retry-modal-header {
        padding: 12px;
    }

    .spu-retry-modal-header h3 {
        font-size: 1.1em;
    }

    .spu-retry-file-list {
        padding: 12px;
    }

    .spu-retry-modal-buttons {
        padding: 12px;
    }
}
/* ========================================= */
/* 17. ПРОГРЕС-БАРИ ПАЧОК ЗАВАНТАЖЕННЯ      */
/* ========================================= */

/* Контейнер для прогрес-барів пачок */
.spu-progress-container {
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Окремий прогрес-бар пачки */
.spu-progress-item {
    padding: 0;
    position: relative;
    display: flex;
    align-items: center;
    z-index: calc(var(--spu-z-ui) + 0);
}

/* Прогрес-бар завантаження */
.spu-upload-progress-bar {
    position: relative;
    flex: 1;
    height: 20px;
    background-color: #dee2e6;
    border-radius: 4px;
    overflow: hidden;
}

/* Прогрес-бар для пачок завантаження */
.spu-batch-progress-bar {
    position: relative;
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.spu-batch-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: spuProgressShine 2s infinite;
}


/* Текст прогресу */
.spu-upload-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #333;
    font-weight: 500;
    text-align: center;
    z-index: 2;
}

/* Кнопка скасування пачки */
.spu-batch-stop {
    width: 20px;
    height: 20px;
    border: none;
    background: #f44336;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.spu-batch-stop:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.spu-batch-stop:active {
    transform: scale(0.95);
}

/* Completed batch button - green checkmark */
.spu-batch-stop.spu-batch-done {
    background: #80e684;
    color: white;
}

.spu-batch-stop.spu-batch-done:hover {
    background: #45a049;
}

/* Стани для нових класів spu-upload-progress */
.spu-batch-done .spu-upload-progress-fill {
    background: linear-gradient(-45deg, #98FB98, #32CD32);
}

.spu-batch-stopped .spu-upload-progress-fill {
    background: linear-gradient(-45deg, #FFDAB9, #FFA500);
}

.spu-batch-error .spu-upload-progress-fill {
    background: linear-gradient(-45deg, #FFB6C1, #DC143C);
}

/* ========================================= */
/* 18. УНІВЕРСАЛЬНА ПРОГРЕС ПАНЕЛЬ (ProgressPanel) */
/* ========================================= */

/* Основні стилі модального вікна */
.spu-progress-modal {
    position: fixed;
    z-index: var(--spu-z-modals);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s, transform 0.3s;
}

.spu-progress-modal.spu-progress-modal-visible {
    opacity: 1;
    transform: scale(1);
}

/* Оверлей */
.spu-progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* Контейнер вмісту */
.spu-progress-content {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-width: 280px;
    max-width: 600px;
    width: auto;
    max-height: 80vh;
    overflow: hidden;
}

/* Заголовок */
.spu-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 0 4px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 8px;
    background: #007cba;
    color: white;
    border-radius: 6px 6px 0 0;
}

.spu-progress-title {
    margin: 4px;
    font-size: 12px;
    font-weight: 600;
}

.spu-progress-close {
    background: none;
    border: none;
    font-size: 10px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.spu-progress-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Тіло модального вікна */
.spu-progress-body {
    padding: 0 8px 8px 8px;
}

/* Крок прогресу */
.spu-progress-step {
    text-align: left;
}

.spu-progress-text {
    font-size: 14px;
    color: #333;
    margin-bottom: 16px;
    font-weight: 500;
    min-height: 20px;
    line-height: 1.4;
    display: none;
}

/* Контейнер прогрес-бару */
.spu-progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

/* Сам прогрес-бар */
.spu-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007cba 0%, #005a87 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
}

.spu-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: spuProgressShine 2s infinite;
}

/* Анімація блиску */
@keyframes spuProgressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Деталі процесу */
.spu-progress-details {
    margin-top: 8px;
    padding: 4px 4px 4px 0px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007cba;
}

.spu-progress-details ul {
    margin: 0;
    padding-left: 8px;
    list-style: none;
}

.spu-progress-details li {
    font-size: 13px;
    color: #666;
    margin-bottom: 1px;
    position: relative;
}

.spu-progress-details li::before {
    content: '○';
    color: #666;
    font-weight: bold;
    margin-right: 8px;
}

.spu-progress-details li.current {
    color: #007cba;
    font-weight: 500;
}

.spu-progress-details li.current::before {
    content: '֍';
    color: #007cba;
    display: inline-block;
    animation: spuSpin 1s linear infinite;
}

.spu-progress-details li.completed::before {
    content: '✓';
    color: #28a745;
    animation: none;
}

/* Анімація обертання */
@keyframes spuSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Стан помилки */
.spu-progress-modal.error .spu-progress-bar {
    background: #dc3545;
}

.spu-progress-modal.error .spu-progress-text {
    color: #dc3545;
}

/* Стан успіху */
.spu-progress-modal.success .spu-progress-bar {
    background: #28a745;
}

.spu-progress-modal.success .spu-progress-text {
    color: #28a745;
}

/* Кнопка */
.spu-progress-button-container {
    text-align: center;
    margin-top: 8px;
}

.spu-progress-button {
    background: #007cba;
    color: white;
    border: none;
    padding: 4px 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.spu-progress-button:hover:not(:disabled) {
    background: #005a87;
}

.spu-progress-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Темна тема для ProgressPanel */
@media (prefers-color-scheme: dark) {
    .spu-progress-content {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    .spu-progress-header {
        border-bottom-color: #404040;
    }

    .spu-progress-close:hover {
        background: #404040;
    }

    .spu-progress-bar-container {
        background: #404040;
    }

    .spu-progress-details {
        background: #333;
        border-left-color: #007cba;
    }
}


/* ========================================= */
/* 19. МОДАЛЬНЕ ВІКНО ЯКОСТІ ФОТО            */
/* ========================================= */

.spu-quality-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: var(--spu-z-modals);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spu-quality-modal {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 5px solid #dc3545;
}

.spu-quality-modal-overlay.spu-quality-modal-visible .spu-quality-modal {
    transform: scale(1);
}

.spu-quality-modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.spu-quality-modal-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.spu-quality-modal-header h3::before,
.spu-quality-modal-header h3::after {
    content: '';
    width: 48px;
    height: 48px;
    background-image: url('../svg/Atention.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.spu-quality-modal-body {
    padding: 20px;
    line-height: 1.6;
}

.spu-quality-modal-body p {
    margin: 0 0 15px 0;
    color: #555;
    white-space: pre-line;
}

.spu-confirmation-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.spu-confirmation-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    transition: background-color 0.3s ease;
}

.spu-confirmation-checkbox input[type="checkbox"]:not(:checked) {
    background-color: #ffb3ba;
}

.spu-confirmation-checkbox input[type="checkbox"]:checked {
    background-color: #90ee90;
}

.spu-confirmation-checkbox span {
    font-weight: 500;
    color: #333;
}

.spu-quality-modal-footer {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.spu-quality-cancel,
.spu-quality-confirm {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.spu-quality-cancel {
    background-color: #dc3545;
    color: #fff;
}

.spu-quality-cancel:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

.spu-quality-confirm {
    background-color: #28a745;
    color: #fff;
}

.spu-quality-confirm:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.spu-quality-confirm:not(:disabled):hover {
    background-color: #218838;
    transform: translateY(-1px);
}

/* Адаптивність для модального вікна якості */
@media (max-width: 768px) {
    .spu-quality-modal {
        width: 95%;
        max-height: 90vh;
    }

    .spu-quality-modal-header {
        padding: 15px;
    }

    .spu-quality-modal-header h3 {
        font-size: 1.2em;
    }

    .spu-quality-modal-body {
        padding: 15px;
    }

    .spu-quality-modal-footer {
        padding: 15px;
        flex-direction: row;
    }

    .spu-quality-cancel,
    .spu-quality-confirm {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .spu-quality-modal-header {
        padding: 12px;
    }

    .spu-quality-modal-header h3 {
        font-size: 1.1em;
    }

    .spu-quality-modal-body {
        padding: 12px;
    }

    .spu-quality-modal-footer {
        padding: 12px;
    }
}

/* ========================================= */
/* 20. АНІМАЦІЯ ВИДАЛЕННЯ                    */
/* ========================================= */

.spu-gallery-item.deleting {
    opacity: 0.5 !important;
    pointer-events: none;
    transition: opacity 0.3s ease;
    position: relative;
}

.spu-gallery-item.deleting::after {
    content: 'Видаляється...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(252, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 2px;
    font-size: 8px;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
}