/* --- Переменные --- */
:root {
    --color-bg: #F9F5F0;
    --color-primary: #B38C73;
    --color-primary-hover: #A07A61;
    --color-dark: #1E1E1E;
    --color-text: #3A3A3A;
    --color-muted: #7A7A7A;
    --color-border: #E5DDD6;
    --color-white: #FFFFFF;
    --color-disabled: #C4BDB7;
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
    --transition: 0.3s ease;
}

body {
    background-color: var(--color-bg);
    color: var(--color-dark);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Хлебные крошки --- */
.breadcrumbs {
    font-size: 13px;
    color: var(--color-muted);
    padding: 20px 0 30px;
    letter-spacing: 0.5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.breadcrumbs a {
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumbs a:hover { color: var(--color-primary); }

/* --- Секция товара (Сетка) --- */
.product-section {
    display: grid;
    grid-template-columns: 45% 1fr;
    gap: 60px;
    margin-bottom: 50px;
    align-items: start;
}

/* --- Галерея --- */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.gallery-main {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 20px;
    overflow: hidden;
    background-color: var(--color-white);
    box-shadow: var(--shadow-sm);
}
.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.gallery-thumbnails img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
    border: 2px solid transparent;
}
.gallery-thumbnails img:hover {
    border-color: var(--color-primary);
    transform: scale(1.03);
}
.gallery-thumbnails img.active {
    border-color: var(--color-primary);
}

/* --- Информация о товаре --- */
.product-details {
    display: flex;
    flex-direction: column;
}
.product-title {
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.2;
}
.product-price {
    font-size: clamp(24px, 3vw, 28px);
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--color-dark);
    transition: color 0.2s;
}

/* --- Блок выбора вариантов (Размер и т.д.) --- */
.product-options {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.option-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}
.option-values {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
/* Кнопки вариантов (Размер, Цвет и т.д.) — видны сразу */
.option-btn {
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid var(--color-border);
    background-color: var(--color-white);
    color: var(--color-dark);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.option-btn:hover:not(.disabled):not(.active) {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: rgba(179, 140, 115, 0.05);
}
.option-btn.active {
    border-color: var(--color-primary);
    background-color: rgba(179, 140, 115, 0.15);
    color: var(--color-primary);
    font-weight: 600;
}
.option-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
    pointer-events: none;
    border-color: var(--color-border);
    background-color: transparent;
}

/* --- Описание --- */
.product-desc {
    color: var(--color-text);
    line-height: 1.7;
    margin-bottom: 30px;
    font-size: 15px;
}

/* --- Управление (Количество и кнопка) --- */
.product-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.qty-selector {
    display: flex;
    align-items: center;
    background: var(--color-white);
    border-radius: 30px;
    padding: 6px 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}
.qty-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-dark);
    cursor: pointer;
    padding: 5px 10px;
    font-weight: 500;
    transition: color 0.2s;
}
.qty-btn:hover { color: var(--color-primary); }
.qty-input {
    width: 40px;
    text-align: center;
    border: none;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    padding: 8px 0;
    color: var(--color-dark);
    /* Скрываем стрелки в Firefox */
    -moz-appearance: textfield;
    appearance: textfield;
}
/* Скрываем стрелки в WebKit (Chrome, Safari, Edge) */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.qty-input:focus { outline: none; }

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 30px;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    font-family: inherit;
    white-space: nowrap;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}
.btn-primary:disabled {
    background-color: var(--color-disabled);
    cursor: not-allowed;
    transform: none;
}
.btn-primary svg { margin-top: -2px; flex-shrink: 0; }

/* --- Вкладки --- */
.tabs-section {
    margin-bottom: 70px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 30px;
}
.tabs-header {
    display: flex;
    gap: 30px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 25px;
    padding-bottom: 10px;
    flex-wrap: wrap;
}
.tab-btn {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--color-muted);
    cursor: pointer;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s;
    font-family: inherit;
}
.tab-btn:hover { color: var(--color-dark); }
.tab-btn.active {
    color: var(--color-dark);
    font-weight: 600;
}
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-primary);
}
.tab-pane {
    display: none;
    padding: 10px 0;
    animation: fade 0.3s;
}
.tab-pane.active { display: block; }
@keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.tab-pane p {
    color: var(--color-text);
    line-height: 1.7;
    font-size: 15px;
    margin-bottom: 15px;
}

/* --- Отзывы (Instagram) --- */
.instagram-reviews {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
}
.instagram-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
}
.instagram-text {
    font-size: 16px;
    color: var(--color-text);
    margin-bottom: 25px;
    line-height: 1.5;
}
.instagram-link {
    display: inline-block;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    padding: 12px 36px;
    border-radius: 30px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(188, 24, 136, 0.3);
}
.instagram-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(188, 24, 136, 0.45);
}

/* --- Похожие товары --- */
.similar-products { margin-bottom: 80px; }
.section-title {
    font-size: clamp(20px, 3vw, 24px);
    margin-bottom: 30px;
    font-weight: 600;
}
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Ссылка вокруг карточки */
.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.product-card {
    background: var(--color-white);
    border-radius: 16px;
    padding: 15px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}
.card-img {
    width: 100%;
    aspect-ratio: 6 / 5;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}
.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.product-card:hover .card-img img { transform: scale(1.05); }
.card-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
    color: var(--color-dark);
}
.card-info p {
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--color-border);
    gap: 10px;
    flex-wrap: wrap;
}
.card-footer .price {
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
}
.cart-small {
    background: #2C2C2C;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    font-family: inherit;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.cart-small:hover {
    background: #000;
    transform: translateY(-1px);
}
.cart-small:active {
    transform: translateY(0);
}

/* --- Адаптивность --- */
@media (max-width: 1200px) {
    .products-grid {
        gap: 15px;
    }
}

@media (max-width: 992px) {
    .product-section {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .gallery-main {
        aspect-ratio: 6 / 5;
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .tabs-section {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .product-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .qty-selector {
        justify-content: center;
        align-self: center;
    }
    .btn-primary {
        justify-content: center;
        width: 100%;
    }
    .tabs-header {
        gap: 15px;
        font-size: 14px;
    }
    .option-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .card-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .cart-small {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    .breadcrumbs {
        padding: 15px 0 20px;
        font-size: 12px;
    }
    .product-title {
        font-size: 22px;
    }
    .gallery-thumbnails {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    .gallery-thumbnails img {
        border-radius: 8px;
    }
    .tabs-section {
        padding: 15px;
        border-radius: 16px;
    }
    .tab-btn {
        font-size: 14px;
    }
}

/* --- Улучшения для устройств с вырезом (iPhone notch) --- */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* --- Уважение к настройкам уменьшенного движения --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Доступность: фокус --- */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}