/* Общие стили страницы продукта */
h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Контейнер для деталей продукта */
.product-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
}

.product-images {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
    max-width: 500px; /* Родительский контейнер для галереи */
    margin: 0 auto;
    overflow: hidden; /* Важно для предотвращения влияния на другие элементы */
}

.image-container {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.selected-image {
    width: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.selected-image.hidden {
    visibility: hidden;
    opacity: 0;
}

.selected-image:not(.hidden) {
    visibility: visible;
    opacity: 1;
}

.thumbnail-images {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.thumbnail {
    height: 100px;
    width: auto;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.thumbnail:hover {
    border-color: #333;
}

.thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    transition: opacity 0.2s;
}

.thumbnail:active::before {
    opacity: 1;
}

/* Кнопки переключения изображений */
.arrow-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
}

.arrow-button img {
    width: 30px;
    height: 30px;
}

.arrow-left {
    left: 10px;
}

.arrow-right {
    right: 10px;
}

/* Информация о продукте */
.product-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hidden-section {
    display: none;
}

.contact-options {
    background: #f8f8f8;
    border-radius: 5px;
    padding: 15px;
    margin-top: 10px;
    border: 1px solid #ddd;
    animation: fadeIn 0.3s ease;
    max-width: 300px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.contact-option-heading {
    font-weight: 700;
    margin-bottom: 15px;
    color: #444;
}

.contact-options-container {
    display: flex;
    flex-direction: column;
    margin-top: 0px;
    gap: 10px;
}

/* Стили для кнопок контактов */
.telegram-button,
.viber-button,
.instagram-button,
.email-button {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 10px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    outline: none;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.telegram-button {
    background-color: #0088cc;
}

.viber-button {
    background-color: #7360F2;
}

.instagram-button {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.email-button {
    background-color: #d44638;
}

.telegram-button:hover,
.viber-button:hover,
.instagram-button:hover,
.email-button:hover {
    filter: brightness(1.1);
    opacity: 0.9;
}

.telegram-button:active,
.viber-button:active,
.instagram-button:active,
.email-button:active {
    filter: brightness(0.95);
}

.telegram-icon,
.instagram-icon,
.email-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.telegram-button,
.viber-button,
.instagram-button,
.email-button,
.telegram-button:hover,
.viber-button:hover,
.instagram-button:hover,
.email-button:hover,
.telegram-button:active,
.viber-button:active,
.instagram-button:active,
.email-button:active,
.telegram-button:visited,
.viber-button:visited,
.instagram-button:visited,
.email-button:visited,
.telegram-button:focus,
.viber-button:focus,
.instagram-button:focus,
.email-button:focus {
    color: white !important;
    text-decoration: none !important;
}

.telegram-button span,
.viber-button span,
.instagram-button span,
.email-button span {
    color: inherit;
    text-decoration: inherit;
}

/* Скрытый контент */
.hidden {
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.25s linear;
}

.notDisplay {
    display: none;
}

.svg-icon {
    width: 24px;
    height: 24px;
    padding-right: 0.7rem;
    fill: currentColor;
    transition: inherit;
    vertical-align: middle;
    display: inline-block;
}

h2.product-details-name {
    font-size: 1.3em;
}
p.product-price{
    font-size: 1.2em;
    margin: 0rem 0rem 0.15rem 0rem;
}

p.product-details_fields{
    font-size: 15px;
    font-weight: 400;
}

p.product-details-material{
    font-size: 15px;
    font-weight: 400;
    margin-top: 0rem;
    margin-bottom: 0rem;
    color: #444;
}

p.product-details_size {
    margin: 0.5rem 0rem 0.5rem 0rem;
}


.form-group {
    margin-bottom: 12px;
}

.order-form label {
    display: block;
    font-weight: 500;
}

.order-form input,
.order-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.order-form input:focus,
.order-form textarea:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
}

.order-form > .button[type=submit] {
    margin-top: 1rem;
}

.toast {
    visibility: hidden;
    min-width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 12px 24px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 60px;
}

/* Ring size wrapper for inline display */
.ring-size-wrapper {
    display: flex;
    align-items: flex-start; /* Changed from center to flex-start */
    flex-wrap: nowrap; /* Changed from wrap to nowrap */
    gap: 15px 10px;
    margin-bottom: 0px;
}

.ring-size-heading {
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 1.15em;
}

/* Adjust the existing ring-size-squares to work in the flex layout */
.ring-size-squares {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    flex: 1; /* Allow it to take remaining space */
}

.size-square {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 31px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    background-color: #fff;
    transition: all 0.2s ease;
    flex-shrink: 0;
    
    /* Remove blue highlight on click */
    -webkit-tap-highlight-color: transparent;
    outline: none;
    user-select: none;
    padding-bottom: 4px;
    -webkit-touch-callout: none;
}

.not-in-stock {
    color: #888;
    border-color: #ddd;
}

.size-square:focus {
    outline: none;
}

.size-square:active {
    background-color: #f0f0f0;
    border-color: #aaa;
}

.size-square.selected {
    border-color: #333;
    background-color: #f0f0f0;
}

.stock-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #888;
}

.under-order-message {
    margin-top: 10px;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 300;
    opacity: 1;
}

.swipeable-gallery-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* Default 1:1 aspect ratio */
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
  }
  
  .swipeable-gallery-track {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    display: flex;
    transition: transform 300ms ease;
  }
  
  .swipeable-gallery-slide {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
  }
  
  .swipeable-gallery-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  
  .swipeable-gallery-pagination {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
  }
  
  .swipeable-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    padding: 0;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
  }
  
  .swipeable-gallery-dot.active {
    background-color: #333;
    transform: scale(1.2);
  }

  .thumbnail-gallery {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 4px;
    width: 100%;
    max-width: 500px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    /* Явно указываем все стороны padding для ясности */
    padding-top: 0;
    padding-bottom: 5px; /* Для пространства под скроллбаром */
    padding-left: 4px;   /* Желаемый отступ слева */
    padding-right: 4px;  /* Желаемый отступ справа */
    box-sizing: border-box;
    justify-content: flex-start;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;

    /* Добавляем scroll-padding для корректных отступов при прокрутке */
    scroll-padding-left: 8px;
    scroll-padding-right: 8px;
}

.thumbnail {
    width: 48px;
    height: 48px;
    min-width: 48px;
    flex: 0 0 auto;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    border-radius: 8px;
    transition: border-color 0.3s ease;
    scroll-snap-align: start;
}

.thumbnail.active {
    border-color: #333;
}

/* Стилизация скроллбара (опционально) */
.thumbnail-gallery::-webkit-scrollbar {
    height: 2px;
}

.thumbnail-gallery::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.05);
    border-radius: 2px;
}

.thumbnail-gallery:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.1);
}


/* Медиа-запросы для адаптивности */
@media (min-width: 768px) {
    .product-details {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767px) {
    .product-details {
        padding: 0px;
    }

    .product-info {
        padding: 0px 20px 20px 20px;
    }

    .arrow-button {
        display: none;
    }

    .selected-image {
        width: 100%;
        aspect-ratio: 1 / 1;
        object-fit: cover;
        display: block;
    }

    .thumbnail-images {
        margin-top: 0.5rem;
    }

    .button--full-width {
        max-width: none;
    }

    .contact-options {
        max-width: none;
    }
    h2.product-details-name {
        font-size: 1.25em;
    }
    p.product-details_size{
        margin: 0.75rem 0rem 0.5rem 0rem;
    }
}

/* Обновленные стили для плавного перехода изображений */
.content-placeholder {
    background: linear-gradient(90deg, #f0f0f0 0%, #e6e6e6 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: placeholderShimmer 1.5s infinite;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

@keyframes placeholderShimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

/* Stone selector styles */
.stone-color-selector {
    margin-top: 0rem;
    margin-bottom: 0.5rem;
    max-width: 500px;
}

.selector-label {
    font-size: 1.15em;
    margin-bottom: 8px;
}

.current-stone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 12px 2px 2px;
    cursor: pointer;
    background-color: white;
}

.current-stone img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    margin-right: 10px;
}

.selector-indicator {
    display: flex;
    align-items: center;
}

.selector-indicator svg {
    width: 12px;
    height: 12px;
    fill: #888;
}

.stone-options-dropdown {
    display: none;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
    padding: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.stone-options-dropdown.active {
    display: block;
}

.stone-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px; /* Changed from 10px to 4px */
}

.stone-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border-radius: 4px;
}

.stone-option:hover {
    background-color: #f5f5f5;
}

.stone-option img {
    width: 100%; /* Fill available width */
    max-width: 86px; /* But no more than 72px */
    aspect-ratio: 1/1; /* Ensure 1:1 aspect ratio */
    object-fit: cover; /* Ensure image fills the space properly */
    border-radius: 6px; /* Slightly rounded corners */
    margin-bottom: 4px; /* Reduced from 5px */
}

.stone-name {
    font-size: 11px; /* Slightly smaller font for better fit */
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Adjust dropdown padding for better spacing */
.stone-options-dropdown {
    padding: 6px; /* Reduced padding */
    max-height: 300px;
    overflow-y: auto;
}

.current-stone-name {
    flex-grow: 1;
    margin: 0 10px;
    font-size: 15px;
}

.design-parts-selector {
    margin: 0rem 0 1rem 0;
}

.parts-selector-heading {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #333;
    font-size: 18px;
    font-weight: 500;
}

.parts-options-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.part-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    width: 100%;
    max-width: 500px;
}

.part-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #333;
}

.part-label {
    cursor: pointer;
    user-select: none;
    color: #555;
    font-size: 15px;
    font-weight: 400;
}

.part-option:hover .part-label {
    color: #333;
}

.part-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-left: 8px; /* отступ от чекбокса */
}

.part-label-text {
    flex: 1;
}

.part-label-price {
    font-size: 14px;
    font-weight: 300;
    color: #666;
    margin-left: 10px;
}

.total-price-display {
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
    margin-top: 15px;
}

.total-price {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    text-align: right;
}