/* ============================================================================ */
/* ERASER TOOL STYLES - КОМПАКТНА ВЕРСІЯ З ЕКОНОМІЄЮ ВЕРТИКАЛЬНОГО ПРОСТОРУ */
/* ============================================================================ */

/* Основна панель eraser tool (заміщує background кнопки) */
.eraser-control-panel {
    display: none; /* За замовчуванням прихована */
    flex-direction: column;
    gap: 15px; /* Зменшено з 20px до 15px */
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 20px; /* Зменшено верхній/нижній padding з 20px до 15px */
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.eraser-control-panel.active {
    display: flex;
}

/* ПЕРШИЙ РЯД: Save + Cancel + Erase/Restore перемикач */
.eraser-buttons-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.eraser-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px; /* Зменшено з 10px 16px */
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 36px; /* Зменшено з 40px */
    min-width: 100px; /* Зменшено з 120px */
    justify-content: center;
    flex-shrink: 0;
}

/* Кнопка Save - зелена */
.eraser-btn.save {
    background: #28a745;
    color: white;
}

.eraser-btn.save:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* Кнопка Cancel - червона (не дуже яскрава) */
.eraser-btn.cancel {
    background: #c82333;
    color: white;
}

.eraser-btn.cancel:hover {
    background: #a71e2a;
    transform: translateY(-1px);
}

/* Кнопка Undo - помаранчева */
.eraser-btn.undo {
    background: #fd7e14;
    color: white;
}

.eraser-btn.undo:hover {
    background: #e8650e;
    transform: translateY(-1px);
}

/* Іконки в кнопках */
.eraser-btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Перемикач режиму видалення/відновлення - ТЕПЕР В ПЕРШОМУ РЯДУ */
.eraser-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px; /* Зменшено з 8px 12px */
    flex-shrink: 0;
}

.eraser-mode-label {
    font-size: 13px; /* Зменшено з 14px */
    color: #333;
    margin: 0 6px; /* Зменшено з 8px */
}

.eraser-toggle-switch {
    position: relative;
    width: 50px; /* Зменшено з 60px */
    height: 24px; /* Зменшено з 30px */
    background: #dc3545;
    border-radius: 12px; /* Зменшено з 15px */
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.eraser-toggle-switch.restore-mode {
    background: #28a745;
}

.eraser-toggle-handle {
    position: absolute;
    top: 2px; /* Зменшено з 3px */
    left: 2px; /* Зменшено з 3px */
    width: 20px; /* Зменшено з 24px */
    height: 20px; /* Зменшено з 24px */
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.eraser-toggle-switch.restore-mode .eraser-toggle-handle {
    transform: translateX(26px); /* Зменшено з 30px */
}

/* ДРУГИЙ РЯД: Size: + значення + слайдер */
.eraser-brush-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.eraser-brush-label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
}

.eraser-brush-value {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    min-width: 35px;
    text-align: left;
    white-space: nowrap;
}

.eraser-brush-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #e9ecef 0%, #e9ecef 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.eraser-brush-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.eraser-brush-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #0056b3;
}

.eraser-brush-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.eraser-brush-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: #0056b3;
}

/* Zoom вікно - збільшено на 30% (195x195px) */
.eraser-zoom-window {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 195px;
    height: 195px;
    border: 2px solid #007bff;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.eraser-zoom-window.active {
    display: block;
}

.eraser-zoom-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Заголовок zoom вікна */
.eraser-zoom-title {
    position: absolute;
    top: -25px;
    left: 0;
    font-size: 12px;
    color: #666;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Кастомний курсор для eraser режиму */
.eraser-cursor {
    cursor: none !important;
}

/* Кастомний курсор-кисть */
.eraser-brush-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 999;
    border: 2px solid #dc3545;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.1);
    transform: translate(-50%, -50%);
    display: none;
}

.eraser-brush-cursor.restore-mode {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.eraser-brush-cursor.active {
    display: block;
}

/* Червона маска для областей що видаляються */
.eraser-red-mask {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 998;
}

/* Canvas overlay для малювання масок */
.eraser-mask-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 997;
}

/* Стан активного eraser режиму для canvas контейнера */
.canvas-container.eraser-active {
    position: relative;
}

.canvas-container.eraser-active #canvas {
    cursor: none;
}

/* Анімації */
@keyframes eraserPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.eraser-btn:active {
    animation: eraserPulse 0.2s ease;
}

/* Responsive - приховуємо на мобільних */
@media (max-width: 768px) {
    .eraser-control-panel {
        display: none !important;
    }
    
    .eraser-zoom-window {
        display: none !important;
    }
    
    .eraser-brush-cursor {
        display: none !important;
    }
}