/* ==========================================
   СТРАНИЦА ТОВАРА — WB-стиль
========================================== */

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
}

/* ==========================================
   ОСНОВНОЙ КОНТЕЙНЕР
========================================== */

.wb-container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

/* ==========================================
   ГАЛЕРЕЯ (левая часть)
========================================== */

.wb-gallery {
    flex: 0 0 50%;
    position: sticky;
    top: 100px;
}

.wb-gallery .main-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: 0.3s;
}

.wb-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.wb-thumbs img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
    background: var(--bg-secondary);
}

.wb-thumbs img:hover,
.wb-thumbs img.active {
    border-color: var(--accent);
}

/* ==========================================
   ГАЛЕРЕЯ — СТРЕЛКИ
========================================== */

.wb-gallery-wrapper {
    position: relative;
    width: 100%;
}

.wb-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
}

.wb-gallery-wrapper:hover .wb-gallery-arrow {
    opacity: 1;
    pointer-events: auto;
}

.wb-gallery-arrow:hover {
    background: var(--accent);
    color: var(--accent-text);
    transform: translateY(-50%) scale(1.08);
}

.wb-gallery-arrow.left {
    left: 12px;
}

.wb-gallery-arrow.right {
    right: 12px;
}

/* Стрелки всегда видны на мобильных */
@media (max-width: 768px) {
    .wb-gallery-arrow {
        opacity: 0.7;
        pointer-events: auto;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .wb-gallery-arrow.left {
        left: 8px;
    }
    
    .wb-gallery-arrow.right {
        right: 8px;
    }
}

@media (max-width: 480px) {
    .wb-gallery-arrow {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    
    .wb-gallery-arrow.left {
        left: 4px;
    }
    
    .wb-gallery-arrow.right {
        right: 4px;
    }
}

/* ==========================================
   ИНФОРМАЦИЯ (правая часть)
========================================== */

.wb-info {
    flex: 1;
}

.wb-info h1 {
    font-size: 36px;
    margin: 0 0 10px;
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
}

/* ==========================================
   АРТИКУЛ С КОПИРОВАНИЕМ (по центру)
========================================== */

.wb-artikul {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.wb-copy-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wb-copy-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    transform: scale(1.1);
}

.wb-copy-btn:active {
    transform: scale(0.9);
}

.wb-copy-feedback {
    font-size: 13px;
    color: #51cf66;
    opacity: 0;
    transition: 0.3s;
    margin-left: 4px;
}

.wb-copy-feedback.show {
    opacity: 1;
}

/* ==========================================
   ЦЕНА
========================================== */

.wb-price-block {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.wb-price {
    font-size: 42px;
    font-weight: 700;
    color: var(--accent);
}

/* ==========================================
   ПОХОЖИЕ ТОВАРЫ
========================================== */

.wb-similar {
    margin: 25px 0;
}

.wb-similar h4 {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wb-similar-grid {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.wb-sim-item {
    width: 80px;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: 0.2s;
}

.wb-sim-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: 0.2s;
}

.wb-sim-item:hover img {
    border-color: var(--accent);
    transform: scale(1.05);
}

.wb-sim-item span {
    font-size: 12px;
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
}

.wb-sim-item .sim-price {
    color: var(--accent);
    font-weight: 700;
    font-size: 12px;
}

/* ==========================================
   ХАРАКТЕРИСТИКИ
========================================== */

.wb-chars {
    margin: 20px 0;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.wb-chars .char-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 15px;
}

.wb-chars .char-label {
    width: 120px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.wb-chars .char-value {
    color: var(--text-primary);
}

/* ==========================================
   ОПИСАНИЕ (аккордеон)
========================================== */

.wb-desc-toggle {
    margin: 15px 0;
}

.wb-desc-toggle button {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    padding: 10px 0;
    font-weight: 600;
    transition: 0.3s;
}

.wb-desc-toggle button:hover {
    color: var(--accent-hover);
}

.wb-desc-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: var(--bg-secondary);
    padding: 0 15px;
    border-radius: 12px;
    border: 1px solid transparent;
}

.wb-desc-content.open {
    max-height: 500px;
    padding: 20px 15px;
    border: 1px solid var(--border-color);
}

.wb-desc-content p {
    color: var(--text-muted);
    line-height: 1.8;
    margin: 0;
}

/* ==========================================
   КНОПКИ ДЕЙСТВИЙ
========================================== */

.wb-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.wb-actions .btn-cart {
    background: var(--accent-gradient);
    color: var(--accent-text);
    padding: 16px 40px;
    border: none;
    border-radius: 16px;
    font-weight: 700;
    font-size: 18px;
    cursor: pointer;
    flex: 1;
    transition: 0.3s;
}

.wb-actions .btn-cart:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--accent-glow);
}

.wb-actions .btn-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.wb-actions .btn-ask {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px 30px;
    border-radius: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.wb-actions .btn-ask:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ==========================================
   ТОСТ-УВЕДОМЛЕНИЕ
========================================== */

#cartToast {
    position: fixed;
    right: 30px;
    bottom: 100px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    padding: 18px 28px;
    border-radius: 15px;
    font-size: 17px;
    font-weight: 600;
    box-shadow: 0 15px 40px var(--shadow-color);
    opacity: 0;
    transform: translateY(30px);
    transition: 0.35s;
    pointer-events: none;
    z-index: 9999;
}

#cartToast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   МОДАЛЬНОЕ ОКНО "ЗАДАТЬ ВОПРОС"
========================================== */

#askModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

#askModal .modal-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border-color);
    position: relative;
}

#askModal .modal-box h2 {
    color: var(--text-primary);
    margin-top: 0;
}

#askModal .modal-box input,
#askModal .modal-box textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: 0.3s;
}

#askModal .modal-box input:focus,
#askModal .modal-box textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-light);
}

#askModal .modal-box textarea {
    min-height: 100px;
    resize: vertical;
}

#askModal .modal-box .btn-submit {
    background: var(--accent-gradient);
    color: var(--accent-text);
    padding: 14px;
    border: none;
    border-radius: 12px;
    width: 100%;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

#askModal .modal-box .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--accent-glow);
}

#askModal .modal-box .btn-close-modal {
    margin-top: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
}

#askModal .modal-box .btn-close-modal:hover {
    color: var(--accent);
}

#askModal .modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    transition: 0.3s;
    line-height: 1;
}

#askModal .modal-close-btn:hover {
    color: var(--accent);
}

/* ==========================================
   МОДАЛЬНОЕ ОКНО ДЛЯ КАРТИНОК
========================================== */

.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.image-modal img {
    width: 80vw;
    max-height: 80vh;
    border-radius: 20px;
    object-fit: contain;
}

.modal-left,
.modal-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 60px;
    cursor: pointer;
    transition: 0.3s;
}

.modal-left:hover,
.modal-right:hover {
    color: var(--accent);
}

.modal-left {
    left: 30px;
}

.modal-right {
    right: 30px;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 50px;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 10000;
    background: none;
    border: none;
    transition: 0.3s;
}

.close-modal:hover {
    color: var(--accent);
}

/* ==========================================
   ССЫЛКА НАЗАД
========================================== */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 40px auto;
    padding: 16px 30px;
    border-radius: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--accent);
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.3s;
}

.back-link:hover {
    background: var(--bg-secondary);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px var(--accent-glow);
}

/* ==========================================
   ПЛАВАЮЩАЯ ПАНЕЛЬ — ПК (правый верхний угол)
========================================== */

@media (min-width: 769px) {
    .wb-sticky-bar {
        position: fixed;
        top: 120px;
        right: 30px;
        bottom: auto;
        left: auto;
        width: auto;
        min-width: 240px;
        max-width: 320px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        padding: 20px 24px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        z-index: 999;
        backdrop-filter: blur(12px);
        box-shadow: 0 15px 40px var(--shadow-color);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .wb-sticky-bar.show {
        display: flex;
        animation: slideInRight 0.3s ease;
    }

    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    .wb-sticky-bar .sticky-price {
        font-size: 26px;
        font-weight: 700;
        color: var(--accent);
        text-align: center;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border-color);
    }

    .wb-sticky-bar .sticky-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .wb-sticky-bar .sticky-actions .btn-cart {
        background: var(--accent-gradient);
        color: var(--accent-text);
        padding: 12px 20px;
        border: none;
        border-radius: 12px;
        font-weight: 700;
        font-size: 15px;
        cursor: pointer;
        width: 100%;
        transition: 0.3s;
    }

    .wb-sticky-bar .sticky-actions .btn-cart:hover {
        opacity: 0.9;
        transform: translateY(-2px);
        box-shadow: 0 10px 25px var(--accent-glow);
    }

    .wb-sticky-bar .sticky-actions .btn-cart:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none !important;
    }

    .wb-sticky-bar .sticky-actions .btn-ask {
        background: transparent;
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        padding: 12px 20px;
        border-radius: 12px;
        font-weight: 600;
        font-size: 15px;
        cursor: pointer;
        width: 100%;
        transition: 0.2s;
    }

    .wb-sticky-bar .sticky-actions .btn-ask:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

    .wb-sticky-bar .sticky-close {
        position: absolute;
        top: 8px;
        right: 12px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 20px;
        cursor: pointer;
        transition: 0.3s;
        padding: 0;
        line-height: 1;
    }

    .wb-sticky-bar .sticky-close:hover {
        color: var(--accent);
    }
}

/* ==========================================
   ПЛАВАЮЩАЯ ПАНЕЛЬ — МОБИЛЬНЫЕ (внизу)
========================================== */

@media (max-width: 768px) {
    .wb-sticky-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        padding: 12px 16px;
        display: none;
        align-items: center;
        justify-content: space-between;
        z-index: 999;
        backdrop-filter: blur(12px);
        box-shadow: 0 -10px 30px var(--shadow-color);
    }

    .wb-sticky-bar.show {
        display: flex;
    }

    .wb-sticky-bar .sticky-price {
        font-size: 22px;
        font-weight: 700;
        color: var(--accent);
        white-space: nowrap;
    }

    .wb-sticky-bar .sticky-actions {
        display: flex;
        gap: 10px;
        flex: 1;
        justify-content: flex-end;
    }

    .wb-sticky-bar .sticky-actions .btn-cart {
        background: var(--accent-gradient);
        color: var(--accent-text);
        padding: 10px 18px;
        border: none;
        border-radius: 12px;
        font-weight: 700;
        font-size: 14px;
        cursor: pointer;
        flex: 1;
        max-width: 180px;
        transition: 0.3s;
        white-space: nowrap;
    }

    .wb-sticky-bar .sticky-actions .btn-cart:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none !important;
    }

    .wb-sticky-bar .sticky-actions .btn-ask {
        background: transparent;
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        padding: 10px 14px;
        border-radius: 12px;
        font-weight: 600;
        font-size: 14px;
        cursor: pointer;
        transition: 0.2s;
        white-space: nowrap;
    }

    .wb-sticky-bar .sticky-actions .btn-ask:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

    .wb-sticky-bar .sticky-close {
        display: none;
    }
}

/* ==========================================
   АДАПТИВ
========================================== */

@media (max-width: 992px) {
    .wb-container {
        flex-direction: column;
    }

    .wb-gallery {
        position: relative;
        top: 0;
        width: 100%;
        flex: 1;
    }

    .wb-info {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .wb-container {
        margin: 15px auto;
        padding: 0 15px;
        gap: 20px;
    }

    .wb-info h1 {
        font-size: 28px;
    }

    .wb-price {
        font-size: 32px;
    }

    .wb-thumbs img {
        width: 55px;
        height: 55px;
    }

    .wb-sim-item {
        width: 65px;
    }

    .wb-sim-item img {
        width: 65px;
        height: 65px;
    }

    .wb-chars .char-row {
        font-size: 14px;
        padding: 6px 0;
    }

    .wb-chars .char-label {
        width: 100px;
    }

    .wb-actions {
        flex-direction: column;
    }

    .wb-actions .btn-cart {
        padding: 14px 20px;
        font-size: 16px;
    }

    .wb-actions .btn-ask {
        padding: 14px 20px;
        font-size: 16px;
    }

    #cartToast {
        right: 15px;
        bottom: 120px;
        left: 15px;
        text-align: center;
        font-size: 15px;
        padding: 14px 20px;
    }

    #askModal .modal-box {
        padding: 25px;
        margin: 10px;
    }

    .modal-left,
    .modal-right {
        font-size: 30px;
    }

    .modal-left {
        left: 10px;
    }

    .modal-right {
        right: 10px;
    }

    .close-modal {
        top: 10px;
        right: 15px;
        font-size: 35px;
    }

    .back-link {
        font-size: 15px;
        padding: 12px 20px;
        margin: 20px auto;
    }
}

@media (max-width: 480px) {
    .wb-info h1 {
        font-size: 22px;
    }

    .wb-price {
        font-size: 26px;
    }

    .wb-thumbs img {
        width: 45px;
        height: 45px;
    }

    .wb-sim-item {
        width: 55px;
    }

    .wb-sim-item img {
        width: 55px;
        height: 55px;
    }

    .wb-sim-item span {
        font-size: 10px;
    }

    .wb-chars .char-row {
        font-size: 13px;
        flex-direction: column;
        padding: 4px 0;
    }

    .wb-chars .char-label {
        width: auto;
        font-size: 12px;
    }

    #askModal .modal-box h2 {
        font-size: 22px;
    }

    #askModal .modal-box input,
    #askModal .modal-box textarea {
        font-size: 15px;
        padding: 10px;
    }

    .image-modal img {
        width: 95vw;
        max-height: 70vh;
    }
}