.product-page {
    display: flex;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    gap: 20px;
}

.product-gallery {
    flex: 1;
    max-width: 50%;
}

.product-gallery iframe {
    width: 100%;
    padding-top: 40px;
}

.main-image {
    width: 100%;
    height: 0;
    padding-top: 100%; /* Square aspect ratio */
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background-color: #e0e0e0;
}
.main-image:hover {
    cursor: zoom-in;
}

.main-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.primary-image {
    transition: opacity 0.3s ease;
}

.thumbnail-gallery {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    margin-top: 10px;
    width: 100%;
}

.thumbnail {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.3s ease;
    max-width: 60px;
    border: 2px solid transparent; /* Прозрачная обводка по умолчанию */
}

.thumbnail:hover {
    opacity: 0.8;
}

.thumbnail.active {
    border: 2px solid #28a745; /* Зеленая обводка для активной миниатюры */
}

.product-details {
    padding: 20px 0;
    flex: 1;
}

.product-details h1 {
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 20px;
    text-align: left;
}

.product-details h3 {
    padding: 0;
}

.product-delivery ul, .product-payment ul {
    list-style-type:none ;
}

.product-delivery li, .product-payment li {
    padding: 5px 0 5px 40px;
    list-style-type:none ;
}

.product-description {
    line-height: 1.5;
    margin-top: 0;
}

.product-description ul, .product-description ol {
    margin: 0 0 0 40px;
    padding: 0 0 20px 0;
}

.product-description p {
    padding-bottom: 20px;
}

.nova-icon {
    background: url("/uploads/icons/nova-icon.svg") left/30px no-repeat;
}

.ukrp-icon {
    background: url("/uploads/icons/ukrp-icon.svg") left/30px no-repeat;
}

.rztk-icon {
    background: url("/uploads/icons/rztk-icon.svg") left/30px no-repeat;
}

.gpay-icon {
    background: url("/uploads/icons/gpay-icon.svg") left/30px no-repeat;
}

.half-icon {
    background: url("/uploads/icons/half-icon.svg") left/30px no-repeat;
}

.stock-info {
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.breadcrumbs {
    font-size: 1rem;
    margin: 20px;
    text-align: center;
    line-height: 30px;
}

.breadcrumbs a {
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    margin: 0 5px;
}

/* Иконка для открытия галереи */
.sale-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    font-weight: bold;
    background: rgba(255, 255, 0, 0.8);
    font-size: 1rem;
    color: #000000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}

.sale-icon:hover {
    background: rgba(255, 255, 0, 1);
}

/* Скрываем бар по умолчанию (на ПК) */
#mobile-sticky-bar {
    display: none;
}

/* Показываем только на мобильных */
@media (max-width: 768px) {
    /* Добавляем отступ сайту снизу, чтобы бар не закрывал контент/футер */
    body {
        padding-bottom: 60px; 
    }

    #mobile-sticky-bar {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: #fff;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
        z-index: 990;
        /* Убрали transform и transition, так как блок виден всегда */
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .msb-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
        gap: 20px;
    }

    .msb-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .msb-price {
        margin: 0 !important;
        line-height: 1.2;
        font-size: 1rem;
    }
    
    .msb-price .old {
        font-size: 1rem;
        margin-right: 5px;
        color: #999;
        text-decoration: line-through;
    }
    
    .msb-price .new {
        color: #333;
        font-weight: bold;
    }

    .msb-stock {
        font-size: 0.75rem;
        margin: 0 !important;
        padding: 0;
    }

    .msb-action {
        flex-shrink: 0;
        width: 50%;
    }

    .msb-btn {
        width: 100%;
        padding: 10px 0;
        background-color: #28a745;
        color: #fff;
        border: none;
        border-radius: 25px;
        font-size: 1rem;
        font-weight: normal;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .msb-btn:active {
        background-color: #218838;
    }
    
    .msb-btn.disabled {
        background-color: #ccc;
        cursor: not-allowed;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .thumbnail-gallery {
        grid-template-columns: repeat(6, 1fr);
    }

    .product-page {
        flex-direction: column;
        padding: 20px;
        gap: 0;
    }

    .product-gallery {
        max-width: 100%;
    }

    .product-details {
        padding: 20px 0;
    }

    .sale-icon {
        padding: 10px;
    }
}