/* --- Glass Section Styles --- */
.glass-section {
    padding: 50px 0;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.accent-text {
    color: var(--accent-color);
}

/* Main Wrapper */
.glass-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Ліва колонка ширша */
    gap: 40px;
    align-items: start; /* Важливо для sticky ефекту */
}

/* Left Column: Grid of Thumbs */
.glass-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 в ряд */
    gap: 20px;
}

.glass-item {
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: #222; /* Фон картки */
}

.glass-item:hover {
    border-color: #666; /* Легка рамка при наведенні */
}

.glass-item.active {
    border-color: var(--accent-color); /* Червона рамка для активного */
    box-shadow: 0 0 10px rgba(227, 30, 36, 0.2);
}

.thumb-img-box {
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.thumb-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.glass-item:hover .thumb-img-box img {
    transform: scale(1.05);
}

.thumb-label {
    padding: 10px;
    font-size: 13px;
    text-align: center;
    background: #2a2a2a;
    color: #ddd;
    border-top: 1px solid #333;
}

/* Right Column: Sticky Preview */
.glass-preview-col {
    height: 100%;
    position: relative; 
    /* Для sticky всередині */
}

.sticky-preview {
    position: sticky;
    top: 20px; /* Відступ від верху екрану при скролі */
    width: 100%;
    height: 550px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    border: 1px solid #333;
}

.sticky-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Mobile Adaptation --- */
@media (max-width: 900px) {
    .glass-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 в ряд на планшетах */
    }
}

@media (max-width: 768px) {
    .glass-wrapper {
        display: flex;
        flex-direction: column-reverse; /* Змінюємо порядок: Превью зверху, список знизу */
        gap: 20px;
    }

    .glass-preview-col {
        width: 100%;
        height: auto;
    }

    .sticky-preview {
        position: relative; /* На мобайлі sticky не потрібен */
        top: 0;
        height: 350px; /* Менша висота для мобайлу */
    }

    .glass-thumbs-col {
        width: 100%;
    }

    .glass-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 в ряд на мобайлі */
        gap: 15px;
    }
}

/* --- Центрування для десктопу (коли слайдів < 5 і Swiper відключений) --- */
.swiper.flex-centered .swiper-wrapper {
    display: flex;
    justify-content: center; /* Центруємо елементи */
    flex-wrap: wrap; /* Дозволяємо перенесення, якщо щось піде не так */
    gap: 25px; /* Заміняє spaceBetween зі Swiper */
    transform: none !important; /* Відміняємо трансформації Swiper */
}

.swiper.flex-centered .swiper-slide {
    width: calc(20% - 20px) !important; /* Імітуємо slidesPerView: 5. (100% / 5 = 20%, мінус відступ) */
    flex-shrink: 0;
}

/* На всякий випадок для менших екранів відміняємо цей клас, якщо користувач змінив розмір вікна браузера */
@media (max-width: 1199px) {
    .swiper.flex-centered .swiper-wrapper {
        display: flex;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 0;
    }
    .swiper.flex-centered .swiper-slide {
        width: auto !important;
    }
}


/* Універсальна секція галереї */
.gallery-section {
    padding: 50px 0;
    background-color: var(--bg-color);
    position: relative;
}

.gallery-section a,
.gallery-section a:visited,
.gallery-section a:hover {
    color: #fff;

    text-decoration: none;
}

.gallery-section .section-title {
    margin: 0;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Вирівнювання по верху */
    margin-bottom: 30px;
}

/* Текст опису */
.section-description {
    margin-bottom: 30px;
    color: #ccc;
    font-size: 15px;
    line-height: 1.6;
}

/* Навігація */
.swiper-nav-btns {
    display: flex;
    gap: 10px;
    flex-shrink: 0; /* Щоб кнопки не сплющувались */
}

.swiper-button-custom {
    width: 45px;
    height: 45px;
    background-color: var(--accent-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.swiper-button-custom:hover {
    background-color: var(--accent-color);
}

.swiper-button-disabled {
    opacity: 0.5;
    cursor: default;
    background-color: #555;
}

/* Універсальна картка товару */
.gallery-card {
    display: block;
    background: #222;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.3s;
}

.gallery-card:hover {
    transform: translateY(-5px);
}

.card-img {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
    background: #fff;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-title {
    padding: 15px 10px;
    text-align: center;
    color: #fff;
    font-size: 14px;
    border-top: 1px solid #333;
}

/* Якщо немає заголовка (для Фацетів) */
.gallery-card.no-title .card-title {
    display: none;
}

/* --- PhotoSwipe Customization --- */
.pswp img {
    object-fit: contain !important;
}

.swiper-button-lock {
    display: none !important;
}

#handles-gallery .card-img img {
    object-fit: contain;
}

#shprosy-gallery .card-img img {
    object-position: top;
}

@media (max-width: 991px) {
    .gallery-section .section-title {
        margin: 0;
    }
}

/* --- Lamination Section Styles --- */
.lamination-section {
    padding: 50px 0;
    background-color: var(--bg-color, #1a1a1a); /* Дефолт якщо змінна не задана */
    color: var(--text-color, #ffffff);
}

.lamination-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Картинка зліва, кольори справа */
    gap: 50px;
    align-items: stretch;
}

/* --- Left Column: Sticky Image --- */
.lamination-image-col {
    position: relative;
    min-height: 400px;
}

.sticky-lamination-img {
    position: sticky; /* Вмикає липкість */
    position: -webkit-sticky; /* Для Safari */
    top: 80px; /* Відступ зверху (збільшив до 80px, щоб не прилипало під хедер, якщо він фіксований) */
    width: 100%;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.sticky-lamination-img img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* --- Right Column: Controls --- */
.lamination-controls-col {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Selected Color Info */
.selected-color-info {
    font-size: 20px;
    font-weight: 600;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.selected-color-name {
    color: var(--accent-color, #e31e24);
}

/* Groups */
.color-group {
    margin-bottom: 20px;
}

.group-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.colors-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Swatch Item */
.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.color-swatch:hover {
    transform: scale(1.1);
    z-index: 2;
}

/* Active State */
.color-swatch.active {
    box-shadow: 0 0 0 3px var(--accent-color, #e31e24), 0 5px 15px rgba(0,0,0,0.5);
    transform: scale(1.1);
    z-index: 1;
}

/* --- Custom CSS Tooltip --- */
.color-swatch::before {
    content: attr(data-name);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #fff;
    color: #000;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Arrow for tooltip */
.color-swatch::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    border-width: 6px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

.color-swatch:hover::before,
.color-swatch:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px); /* Smooth lift effect */
}

/* Mobile Adaptation */
@media (max-width: 900px) {
    .lamination-wrapper {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .sticky-lamination-img {
        position: relative;
        top: 0;
        margin-bottom: 0px;
    }

    .lamination-image-col {
        min-height: unset;
    }

    .selected-color-info {
        font-size: 18px;
    }

    .colors-grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
    }
    
    /* Зменшуємо розмір плашок на мобільному */
    .color-swatch {
        aspect-ratio: 1/1;
        width: auto;
        height: auto;

        position: initial;
    }

    .color-swatch.active {
        box-shadow: unset;
        border: 1px solid var(--accent-color, #e31e24);
        transform: scale(1);
    }

    .color-swatch:hover {
        transform: scale(1);
    }

    .color-swatch::before, .color-swatch::after {
        content: unset;
    }
}

 /* --- Стилі для секції "Інші віконні системи" --- */

/* 1. Картка (Контейнер) */
.other-systems-section .gallery-card {
    display: flex;
    flex-direction: column;
    background: #222;
    border-radius: 6px;
    overflow: hidden;
    height: 100%; /* Розтягуємо на всю висоту слайда */
    padding-bottom: 20px; /* Відступ знизу для кнопки */
}

/* 2. Блок з картинкою (Лінк для поп-апу) */
.other-systems-section .popup-image-link {
    display: block;
    width: 100%;
    overflow: hidden;
    background: transparent; /* Ваша правка: прозорий фон */
}

/* Картинка */
.other-systems-section .card-img {
    width: 100%;
    aspect-ratio: 1/1; /* Квадратна зона під фото */
    background: transparent; /* Ваша правка */
    display: flex;
    align-items: center;
    justify-content: center;
}

.other-systems-section .card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain !important; /* Ваша правка: фото вписується */
    padding: 10px; /* Невеликий відступ від країв */
    display: block;
    transition: transform 0.3s ease;
}

/* Ефект при наведенні на картинку */
.other-systems-section .popup-image-link:hover img {
    transform: scale(1.05);
}

/* 3. Контентна частина */
.other-systems-section .card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Займає вільне місце, притискаючи кнопку до низу */
}

/* Заголовок (Ваші стилі) */
.other-systems-section .card-title {
    border-top: 1px solid #333;
    margin-top: 0;
    padding: 15px 15px 5px 15px; /* Додав padding зверху/збоку для відступів */
    
    font-size: 20px;
    text-transform: uppercase;
    color: #fff;
    font-weight: 700;
    text-align: center;
}

/* Опис (Ваші стилі) */
.other-systems-section .card-desc {
    padding: 0 15px 15px 15px;
    text-align: center;
    color: #aaa; /* Трохи світліший за білий */
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: auto; /* Цей стиль важливий: він відштовхує кнопку в самий низ */
}

/* 4. Кнопка "Дізнатись більше" */
.other-systems-section .card-btn {
    display: block;
    width: calc(100% - 30px); /* Відступи по 15px з боків */
    margin: 10px auto 0 auto;
    
    background-color: var(--accent-color, #e31e24); /* Червоний */
    color: #fff;
    text-align: center;
    padding: 12px 0;
    border-radius: 4px; /* Як у навігації */
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    transition: background 0.3s ease;
}

.other-systems-section .card-btn:hover {
    background-color: #c4191e; /* Темніший червоний при наведенні */
    color: #fff;
}