/* product.css — улучшенная версия */

/* Основные переменные */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --border-color: #eef2f7;
    --text-light: #7f8c8d;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 10px 25px rgba(0,0,0,0.15);
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.product-page {
    padding: 40px 0 80px;
    background: #f9fafc;
}

/* Хлебные крошки */
.breadcrumbs {
    margin-bottom: 30px;
    font-size: 14px;
    color: var(--text-light);
}
.breadcrumbs a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: var(--transition-smooth);
}
.breadcrumbs a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}
.breadcrumbs span {
    color: var(--primary-color);
    font-weight: 500;
}

/* Верхний блок с товаром (галерея + основная инфа) */
.product-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: white;
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

/* Галерея */
.product-gallery {
    display: flex;
    flex-direction: column;
}
.main-image {
    width: 100%;
    height: 450px;
    overflow: hidden;
    border-radius: 16px;
    margin-bottom: 20px;
    background: #f5f7fa;
    cursor: crosshair;
    position: relative;
}
.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s;
}
.thumbnails {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    background: #f5f7fa;
    flex-shrink: 0;
}
.thumbnail.active {
    border-color: var(--secondary-color);
}
.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Основная информация */
.product-info {
    display: flex;
    flex-direction: column;
}
.product-info h1 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    line-height: 1.2;
}
.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.sku {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Гарантия и оригинальность */
.badges {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.badge i {
    font-size: 0.9rem;
}

/* Цена */
.price-block {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.current-price {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--accent-color);
    line-height: 1;
}
.old-price {
    font-size: 1.3rem;
    color: var(--text-light);
    text-decoration: line-through;
}
.discount-badge {
    background: var(--accent-color);
    color: white;
    padding: 4px 12px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Доставка и наличие */
.delivery-short {
    background: #f8fafc;
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.delivery-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary-color);
}
.delivery-item i {
    width: 24px;
    color: var(--secondary-color);
    font-size: 1.1rem;
}
.delivery-item span {
    font-size: 0.95rem;
}
.delivery-item .free {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
}
.stock-status {
    display: flex;
    align-items: center;
    gap: 8px;
}
.in-stock {
    color: #27ae60;
    font-weight: 600;
}
.out-of-stock {
    color: #e74c3c;
    font-weight: 600;
}
.low-stock {
    color: #e67e22;
    font-size: 0.85rem;
    margin-left: 10px;
}

/* Социальное доказательство */
.social-proof {
    background: #f0f7ff;
    border-left: 4px solid var(--secondary-color);
    padding: 12px 18px;
    border-radius: 8px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}
.social-proof i {
    color: var(--secondary-color);
    font-size: 1.2rem;
}

/* Таймер скидки */
.sale-timer {
    background: #fff3e0;
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.timer-label {
    font-weight: 600;
    color: #bf5e00;
}
.timer-display {
    font-size: 1.3rem;
    font-weight: 700;
    color: #d97706;
    background: white;
    padding: 5px 15px;
    border-radius: 30px;
    font-family: monospace;
}

/* Кнопки действий */
.product-actions {
    display: flex;
    gap: 15px;
    margin: 25px 0;
}
.quantity {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}
.quantity button {
    width: 45px;
    height: 45px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.quantity button:hover {
    background: #f0f0f0;
}
.quantity input {
    width: 60px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    height: 45px;
    font-size: 1rem;
}
.add-to-cart-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 8px 20px rgba(52,152,219,0.3);
}
.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(52,152,219,0.5);
}
.wishlist-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-light);
    transition: var(--transition-smooth);
}
.wishlist-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.wishlist-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}
.wishlist-text-btn {
    background: white;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(52,152,219,0.2);
}
.wishlist-text-btn:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52,152,219,0.4);
}
.wishlist-text-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    box-shadow: 0 8px 20px rgba(231,76,60,0.3);
}
.wishlist-text-btn.active:hover {
    background: #c0392b;
    border-color: #c0392b;
}

/* Характеристики (краткие, под ценой) */
.specs-mini {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 25px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.spec-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
}
.spec-item i {
    color: var(--secondary-color);
    width: 20px;
}

/* ===== СЕКЦИИ НА ВСЮ ШИРИНУ ===== */
.full-width-section {
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}
.section-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 15px;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 60px;
    height: 3px;
    background: var(--accent-color);
}

/* Описание */
.product-description {
    line-height: 1.8;
    color: #2c3e50;
}
.product-description p {
    margin-bottom: 20px;
}

/* Характеристики (подробно) */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.spec-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px dashed #ecf0f1;
}
.spec-name {
    flex: 0 0 40%;
    font-weight: 600;
    color: var(--primary-color);
}
.spec-value {
    flex: 1;
    color: var(--text-light);
}

/* Доставка и возврат (полная версия) */
.delivery-full {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}
.delivery-block {
    background: #f8fafc;
    border-radius: 16px;
    padding: 25px;
}
.delivery-block h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}
.delivery-block ul {
    list-style: none;
    padding: 0;
}
.delivery-block li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}
.delivery-block li:last-child {
    border-bottom: none;
}
.delivery-block i {
    width: 20px;
    color: var(--secondary-color);
}

/* Также покупают */
.also-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}
.also-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: var(--transition-smooth);
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
}
.also-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}
.also-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.also-info {
    padding: 15px;
}
.also-name {
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
}
.also-price {
    font-weight: 700;
    color: var(--accent-color);
}

/* Недавно просмотренные */
.recently-viewed-section {
    margin-top: 60px;
    padding: 40px 0;
    background: #f9fafc;
}
.recently-viewed-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-top: 30px;
}
@media (max-width: 1200px) {
    .recently-viewed-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 992px) {
    .recently-viewed-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .recently-viewed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .recently-viewed-grid {
        grid-template-columns: 1fr;
    }
}
.recently-viewed-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}
.recently-viewed-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.recently-viewed-image {
    height: 150px;
    overflow: hidden;
    background: #f0f0f0;
}
.recently-viewed-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.recently-viewed-item:hover .recently-viewed-image img {
    transform: scale(1.05);
}
.recently-viewed-info {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.recently-viewed-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.3;
    height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}
.recently-viewed-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 8px;
}
.recently-viewed-old-price {
    font-size: 0.8rem;
    color: #999;
    text-decoration: line-through;
    margin-left: 5px;
}
.recently-viewed-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}
.recently-viewed-actions button {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}
.recently-viewed-add-to-cart {
    background: var(--secondary-color);
    color: white;
}
.recently-viewed-add-to-cart:hover {
    background: #2980b9;
}
.recently-viewed-wishlist {
    background: #f0f0f0;
    color: #666;
}
.recently-viewed-wishlist:hover {
    background: #e0e0e0;
    color: var(--accent-color);
}
.recently-viewed-title-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.recently-viewed-title-link:hover .recently-viewed-title {
    color: var(--secondary-color);
}
.recently-viewed-image a {
    display: block;
    line-height: 0;
}
.recently-viewed-image a:hover img {
    opacity: 0.9;
}

/* Доступность */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.thumbnail:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
}
@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;
    }
}
@media (prefers-contrast: high) {
    .product-top,
    .full-width-section,
    .delivery-block,
    .also-card {
        border: 2px solid currentColor;
    }
    .add-to-cart-btn,
    .wishlist-btn,
    .wishlist-text-btn {
        border: 2px solid currentColor;
    }
}

/* Адаптивность */
@media (max-width: 992px) {
    .product-top {
        grid-template-columns: 1fr;
    }
    .main-image {
        height: 350px;
    }
    .full-width-section {
        padding: 30px 20px;
    }
}
@media (max-width: 768px) {
    .product-actions {
        flex-wrap: wrap;
    }
    .add-to-cart-btn {
        order: 2;
        width: 100%;
    }
    .wishlist-btn {
        order: 1;
    }
    .quantity {
        order: 3;
        width: 100%;
    }
    .specs-mini {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 576px) {
    .product-info h1 {
        font-size: 1.8rem;
    }
    .current-price {
        font-size: 2rem;
    }
    .thumbnails {
        gap: 8px;
    }
    .thumbnail {
        width: 60px;
        height: 60px;
    }
}