/* ============================================================
   СТИЛИ ДЕТАЛЬНОЙ СТРАНИЦЫ ТОВАРА (product.css)
   ============================================================ */

/* ---------- Основной контейнер ---------- */
.product-detail {
    display: flex;
    gap: 50px;
    margin: 40px auto;
    max-width: 1200px;
    padding: 0 20px;
    align-items: flex-start;
}

/* ============================================================
   ГАЛЕРЕЯ
   ============================================================ */
.product-gallery {
    flex: 0 0 500px;
    max-width: 500px;
    position: sticky;
    top: 20px;
}

/* Главное изображение */
.main-image-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    background: #fafafa;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
    cursor: zoom-in;
    position: relative;
    transition: box-shadow 0.3s;
}

.main-image-container:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.4s ease, transform 0.5s ease;
}

.main-image:hover {
    transform: scale(1.03);
}

.main-image.fade-out {
    opacity: 0;
    transform: scale(1);
}

/* Заглушка "Нет изображения" */
.main-image-container .no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 1.2em;
    background: #f5f5f5;
}

/* Спиннер загрузки */
.main-image-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #eee;
    border-top: 3px solid #d1005c;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 10;
}

.main-image-container.loading .main-image {
    opacity: 0.6;
}

.main-image-container.loading::after {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Миниатюры */
.thumbnails-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.thumbnail-item {
    width: 85px;
    height: 85px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    flex-shrink: 0;
    position: relative;
}

.thumbnail-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    box-shadow: inset 0 0 0 0 rgba(209, 0, 92, 0.3);
    transition: box-shadow 0.25s;
}

.thumbnail-item:hover {
    transform: translateY(-3px);
    border-color: #ddd;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.thumbnail-item.active {
    border-color: #d1005c;
}

.thumbnail-item.active::after {
    box-shadow: inset 0 0 0 3px rgba(209, 0, 92, 0.4);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================================
   ИНФОРМАЦИЯ О ТОВАРЕ
   ============================================================ */
.product-info {
    flex: 1;
    min-width: 0;
}

.product-info h1 {
    font-size: 2.2em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.category {
    color: #888;
    font-size: 0.95em;
    margin-bottom: 24px;
}

/* Цена */
.price {
    font-size: 2.4em;
    font-weight: 800;
    color: #d1005c;
    margin: 20px 0 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Варианты */
.variants {
    margin: 20px 0;
}

.variants h3 {
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 10px;
    font-weight: 600;
}

.variants select {
    width: 100%;
    max-width: 400px;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1em;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.variants select:focus {
    border-color: #d1005c;
    box-shadow: 0 0 0 4px rgba(209, 0, 92, 0.08);
    outline: none;
}

/* Кнопка Купить */
.buy-button {
    display: block;
    width: 100%;
    max-width: 400px;
    padding: 18px 32px;
    background: linear-gradient(135deg, #d1005c, #e91e63);
    color: #fff;
    font-size: 1.1em;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 28px 0;
    box-shadow: 0 6px 24px rgba(209, 0, 92, 0.3);
}

.buy-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(209, 0, 92, 0.4);
    background: linear-gradient(135deg, #b0004b, #d81b60);
}

.buy-button:active {
    transform: translateY(-1px);
}

/* Табы */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #eee;
    margin: 30px 0 0;
}

.tab-btn {
    padding: 14px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #888;
    transition: all 0.3s;
    position: relative;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #d1005c;
    border-bottom-color: #d1005c;
    font-weight: 600;
}

/* Содержимое табов */
.tab-content {
    padding: 20px 0;
    line-height: 1.8;
    color: #444;
    font-size: 1.05em;
}

.tab-content.active {
    display: block;
}

.chars-table {
    width: 100%;
    border-collapse: collapse;
}

.chars-table td {
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
}

.chars-table td:first-child {
    font-weight: 600;
    color: #666;
    width: 200px;
    font-size: 0.95em;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО
   ============================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    max-width: 460px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal .close {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    transition: all 0.2s;
    border: none;
    line-height: 1;
}

.modal .close:hover {
    background: #e0e0e0;
    color: #333;
}

.modal h2 {
    margin: 0 0 24px;
    font-size: 1.5em;
    color: #1a1a1a;
}

.modal .form-group {
    margin-bottom: 16px;
}

.modal input,
.modal textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1em;
    transition: all 0.3s;
    background: #fafafa;
}

.modal input:focus,
.modal textarea:focus {
    border-color: #d1005c;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(209, 0, 92, 0.06);
    outline: none;
}

.modal textarea {
    resize: vertical;
    min-height: 90px;
}

.modal .btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #d1005c, #e91e63);
    color: #fff;
    font-weight: 700;
    font-size: 1.05em;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal .btn:hover {
    box-shadow: 0 8px 24px rgba(209, 0, 92, 0.3);
    transform: translateY(-2px);
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 1024px) {
    .product-detail {
        gap: 30px;
    }
    
    .product-gallery {
        flex: 0 0 420px;
        max-width: 420px;
    }
    
    .product-info h1 {
        font-size: 1.8em;
    }
    
    .price {
        font-size: 2em;
    }
}

@media (max-width: 768px) {
    .product-detail {
        flex-direction: column;
        gap: 24px;
        margin: 20px auto;
        padding: 0 16px;
    }
    
    .product-gallery {
        flex: none;
        max-width: 100%;
        position: static;
    }
    
    .main-image-container {
        aspect-ratio: 4 / 3;
        max-height: 400px;
        border-radius: 12px;
    }
    
    .thumbnail-item {
        width: 70px;
        height: 70px;
    }
    
    .product-info h1 {
        font-size: 1.6em;
    }
    
    .price {
        font-size: 1.8em;
    }
    
    .buy-button {
        max-width: 100%;
    }
    
    .variants select {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .main-image-container {
        aspect-ratio: 1 / 1;
        max-height: 350px;
    }
    
    .thumbnail-item {
        width: 60px;
        height: 60px;
    }
    
    .tab-btn {
        padding: 10px 14px;
        font-size: 0.9em;
    }
    
    .product-info h1 {
        font-size: 1.4em;
    }
    
    .price {
        font-size: 1.6em;
    }
    
    .modal-content {
        padding: 24px;
    }
}
/* Секция с табами внизу */
.product-tabs {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Выбор количества */
.quantity-selector {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.quantity-selector label {
    font-weight: 600;
    color: #444;
}
.quantity-control {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}
.qty-btn {
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border: none;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
}
.qty-btn:hover {
    background: #e0e0e0;
}
#productQuantity {
    width: 60px;
    text-align: center;
    border: none;
    font-size: 1.1em;
    font-weight: 600;
    padding: 0;
    -moz-appearance: textfield;
}
#productQuantity::-webkit-outer-spin-button,
#productQuantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}