/**
 * Стили для фронтенд части плагина
 */

/* ===== Основной контейнер ===== */
.wcg-gallery-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* ===== Описание под товарами ===== */
.wcg-bottom-description {
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}

.wcg-bottom-description h2,
.wcg-bottom-description h3,
.wcg-bottom-description h4 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    color: #222;
    font-weight: 600;
}

.wcg-bottom-description h2 {
    font-size: 1.75em;
}

.wcg-bottom-description h3 {
    font-size: 1.5em;
}

.wcg-bottom-description p {
    margin-bottom: 1em;
}

.wcg-bottom-description ul,
.wcg-bottom-description ol {
    margin: 1em 0;
    padding-left: 2em;
}

.wcg-bottom-description li {
    margin-bottom: 0.5em;
}

/* ===== Слайдер галереи ===== */
.wcg-gallery-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f9f9f9;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ===== Основной контейнер слайдов ===== */
.wcg-gallery-main {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

/* ===== Слайд ===== */
.wcg-gallery-slide {
    min-width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

.wcg-gallery-slide.active {
    opacity: 1;
    pointer-events: auto;
}

/* ===== Контейнер изображения ===== */
.wcg-gallery-image-container {
    position: relative;
    width: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

/* ===== Picture элемент ===== */
.wcg-gallery-image-container picture {
    display: block;
    width: 100%;
    max-width: 100%;
}

/* ===== Изображение ===== */
.wcg-gallery-image {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.wcg-gallery-image:hover {
    transform: scale(1.02);
}

/* ===== Описание изображения ===== */
.wcg-gallery-description {
    width: 100%;
    max-width: 800px;
    margin-top: 24px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}

.wcg-gallery-description p {
    margin-bottom: 0.75em;
}

.wcg-gallery-description p:last-child {
    margin-bottom: 0;
}

/* ===== Навигационные кнопки ===== */
.wcg-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wcg-gallery-nav:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%) scale(1.1);
}

.wcg-gallery-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.wcg-gallery-nav svg {
    width: 24px;
    height: 24px;
    color: #333;
}

.wcg-gallery-prev {
    left: 20px;
}

.wcg-gallery-next {
    right: 20px;
}

/* ===== Индикаторы ===== */
.wcg-gallery-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.wcg-gallery-indicator {
    width: 10px;
    height: 10px;
    padding: 0;
    background: #ccc;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wcg-gallery-indicator:hover {
    background: #999;
    transform: scale(1.2);
}

.wcg-gallery-indicator.active {
    background: #2271b1;
    width: 30px;
    border-radius: 5px;
}

/* ===== Адаптивность для планшетов ===== */
@media (max-width: 1024px) {
    .wcg-gallery-wrapper {
        padding: 0 15px;
        margin: 30px auto;
    }
    
    .wcg-gallery-image-container {
        padding: 30px;
        min-height: 350px;
    }
    
    .wcg-gallery-image {
        max-height: 500px;
    }
    
    .wcg-gallery-nav {
        width: 44px;
        height: 44px;
    }
    
    .wcg-gallery-prev {
        left: 15px;
    }
    
    .wcg-gallery-next {
        right: 15px;
    }
    
    .wcg-bottom-description {
        padding: 15px;
        font-size: 15px;
    }
}

/* ===== Адаптивность для мобильных ===== */
@media (max-width: 768px) {
    .wcg-gallery-wrapper {
        padding: 0 10px;
        margin: 20px auto;
    }
    
    .wcg-gallery-slider {
        border-radius: 8px;
    }
    
    .wcg-gallery-image-container {
        padding: 20px;
        min-height: 300px;
    }
    
    .wcg-gallery-image {
        max-height: 400px;
        border-radius: 6px;
    }
    
    .wcg-gallery-description {
        margin-top: 16px;
        padding: 15px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    .wcg-gallery-nav {
        width: 40px;
        height: 40px;
        opacity: 0.9;
    }
    
    .wcg-gallery-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .wcg-gallery-prev {
        left: 10px;
    }
    
    .wcg-gallery-next {
        right: 10px;
    }
    
    .wcg-gallery-indicators {
        bottom: 15px;
        padding: 8px 15px;
        gap: 8px;
    }
    
    .wcg-gallery-indicator {
        width: 8px;
        height: 8px;
    }
    
    .wcg-gallery-indicator.active {
        width: 24px;
    }
    
    .wcg-bottom-description {
        padding: 12px;
        font-size: 14px;
    }
    
    .wcg-bottom-description h2 {
        font-size: 1.5em;
    }
    
    .wcg-bottom-description h3 {
        font-size: 1.3em;
    }
}

/* ===== Очень маленькие экраны ===== */
@media (max-width: 480px) {
    .wcg-gallery-image-container {
        padding: 15px;
        min-height: 250px;
    }
    
    .wcg-gallery-image {
        max-height: 300px;
    }
    
    .wcg-gallery-nav {
        width: 36px;
        height: 36px;
    }
    
    .wcg-gallery-nav svg {
        width: 18px;
        height: 18px;
    }
    
    .wcg-gallery-prev {
        left: 8px;
    }
    
    .wcg-gallery-next {
        right: 8px;
    }
    
    .wcg-gallery-indicators {
        bottom: 12px;
        padding: 6px 12px;
        gap: 6px;
    }
    
    .wcg-gallery-indicator {
        width: 6px;
        height: 6px;
    }
    
    .wcg-gallery-indicator.active {
        width: 20px;
    }
}

/* ===== Состояния загрузки ===== */
.wcg-gallery-image[data-src] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: wcg-loading 1.5s ease-in-out infinite;
}

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

/* ===== Плавное появление ===== */
.wcg-gallery-wrapper {
    animation: wcg-fade-in 0.5s ease-out;
}

@keyframes wcg-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Доступность ===== */
.wcg-gallery-nav:focus,
.wcg-gallery-indicator:focus {
    outline: 3px solid #2271b1;
    outline-offset: 2px;
}

/* ===== Печать ===== */
@media print {
    .wcg-gallery-nav,
    .wcg-gallery-indicators {
        display: none;
    }
    
    .wcg-gallery-slider {
        box-shadow: none;
    }
    
    .wcg-gallery-slide {
        opacity: 1 !important;
        page-break-inside: avoid;
    }
}

/* ===== Темная тема (опционально) ===== */
@media (prefers-color-scheme: dark) {
    .wcg-gallery-slider {
        background: #1a1a1a;
    }
    
    .wcg-gallery-description {
        background: #2a2a2a;
        color: #e0e0e0;
    }
    
    .wcg-gallery-nav {
        background: rgba(42, 42, 42, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .wcg-gallery-nav svg {
        color: #fff;
    }
    
    .wcg-gallery-indicators {
        background: rgba(42, 42, 42, 0.95);
    }
    
    .wcg-bottom-description {
        color: #e0e0e0;
    }
    
    .wcg-bottom-description h2,
    .wcg-bottom-description h3,
    .wcg-bottom-description h4 {
        color: #fff;
    }
}

/* ===== Улучшения производительности ===== */
.wcg-gallery-slider,
.wcg-gallery-slide,
.wcg-gallery-nav,
.wcg-gallery-indicator {
    will-change: transform, opacity;
}

.wcg-gallery-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ===== Поддержка RTL ===== */
[dir="rtl"] .wcg-gallery-prev {
    left: auto;
    right: 20px;
}

[dir="rtl"] .wcg-gallery-next {
    right: auto;
    left: 20px;
}

/* ===== Полноэкранный режим (опционально) ===== */
.wcg-gallery-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
}

.wcg-gallery-fullscreen .wcg-gallery-image-container {
    min-height: 100vh;
    padding: 60px 20px;
}

.wcg-gallery-fullscreen .wcg-gallery-image {
    max-height: calc(100vh - 200px);
}

/* ===== Кнопка закрытия полноэкранного режима ===== */
.wcg-gallery-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.wcg-gallery-close:hover {
    background: #fff;
    transform: scale(1.1);
}

.wcg-gallery-close svg {
    width: 24px;
    height: 24px;
    color: #333;
}
