/**
 * Адаптивные стили для интерактивных областей конфигурации товаров
 * Обеспечивает корректное отображение областей при любом размере изображения
 */

/* Контейнер для изображения товара с интерактивными областями */
.product-image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.product-image-container img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Интерактивные области конфигурации */
.configuration-area {
    position: absolute;
    background-color: rgba(16, 28, 137, 0.2);
    border: 2px solid rgba(16, 28, 137, 0.4);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-sizing: border-box;
}

.configuration-area:hover {
    background-color: rgba(16, 28, 137, 0.3);
    border-color: rgba(16, 28, 137, 0.6);
    box-shadow: 0 4px 12px rgba(16, 28, 137, 0.3);
}

.configuration-area.selected {
    background-color: rgba(16, 28, 137, 0.4);
    border-color: rgba(16, 28, 137, 0.8);
    box-shadow: 0 6px 16px rgba(16, 28, 137, 0.4);
}

/* Tooltip для областей */
.area-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    z-index: 1000;
    pointer-events: none;
    max-width: 250px;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.area-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

/* Анимации для областей */
@keyframes areaHighlight {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(0, 123, 255, 0);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(0, 123, 255, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
    }
}

.configuration-area.highlight {
    animation: areaHighlight 0.6s ease-in-out;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .configuration-area {
        border-width: 3px;
        min-width: 30px;
        min-height: 30px;
    }
    
    .configuration-area:hover {
        transform: scale(1.1);
    }
    
    .area-tooltip {
        font-size: 16px;
        padding: 10px 14px;
        max-width: 200px;
    }
}

/* Стили для больших экранов */
@media (min-width: 1920px) {
    .configuration-area {
        border-width: 3px;
    }
    
    .area-tooltip {
        font-size: 16px;
        padding: 10px 16px;
        max-width: 300px;
    }
}

/* Дополнительные стили для визуального редактора в админке */
.visual-editor .configuration-area {
    border-style: dashed;
}

.visual-editor .configuration-area:hover {
    border-style: solid;
}

.visual-editor .configuration-area.selected {
    border-style: solid;
    border-width: 3px;
}

/* Ручки для изменения размера в визуальном редакторе */
.resize-handle {
    position: absolute;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    z-index: 15;
}

.resize-handle:hover {
    background: #0056b3;
    transform: scale(1.2);
}

/* Метки областей */
.area-label {
    position: absolute;
    top: -25px;
    left: 0;
    background: #007bff;
    color: white;
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 11;
    pointer-events: none;
}

@media (min-width: 1920px) {
    .area-label {
        font-size: 14px;
        padding: 3px 8px;
        top: -30px;
    }
}

/* Состояния загрузки */
.configuration-area.loading {
    opacity: 0.6;
    pointer-events: none;
}

.configuration-area.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007bff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Улучшенная доступность */
.configuration-area:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

.configuration-area[aria-selected="true"] {
    border-color: #28a745;
    background-color: rgba(40, 167, 69, 0.3);
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    .configuration-area {
        background-color: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .configuration-area:hover {
        background-color: rgba(0, 123, 255, 0.3);
        border-color: #007bff;
    }
    
    .area-tooltip {
        background: rgba(255, 255, 255, 0.95);
        color: #333;
    }
    
    .area-tooltip::after {
        border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
    }
}
