/* ================================
   OVERLAY
=============================== */

#upsell-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(47, 38, 33, 0.6);
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ================================
   MODAL
=============================== */

.upsell-modal {
    background: #fff;
    max-width: 420px;
    width: 92%;
    margin: 5vh auto;
    padding: 24px;
    position: relative;
    border-radius: 16px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Nunito', sans-serif;
    box-shadow: 0 20px 60px rgba(47, 38, 33, 0.2);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { 
        transform: translateY(30px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* CLOSE */

#upsell-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    line-height: 1;
    padding: 0;
}

#upsell-close:hover {
    background: #fff;
    color: #2F2621;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* VIDEO */

.upsell-video {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: #FFF6E8;
    position: relative;
    margin-top: 0;
}

.upsell-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* TITLE */

.upsell-modal h3 {
    font-size: 22px;
    font-weight: 700;
    color: #2F2621;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

/* SUBTITLE - новый элемент */

.upsell-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0 0 12px 0;
    font-weight: 400;
}

/* PRICE */

.upsell-price {
    font-size: 24px;
    font-weight: 700;
    color: #2F2621;
    margin-bottom: 20px;
    line-height: 1.2;
}

.upsell-price-text {
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

.upsell-price-note {
    display: block;
    font-size: 14px;
    color: #2F8B6D;
    font-weight: 500;
    margin-top: 4px;
}

/* COLORS */

.upsell-colors {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.upsell-color {
    width: 48px;
    height: 48px;
    border: 2px solid #e5e5e5;
    background: #fff;
    cursor: pointer;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
}

.upsell-color::after {
    content: '';
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
}

.upsell-color[data-color="blue"]::after {
    background: #3b82f6;
}

.upsell-color[data-color="green"]::after {
    background: #10b981;
}

.upsell-color[data-color="red"]::after {
    background: #ef4444;
}

.upsell-color.active {
    border-color: #2F2621;
    transform: scale(1.1);
}

.upsell-color:hover {
    border-color: #2F8B6D;
    transform: scale(1.05);
}

/* CTA */

#upsell-add {
    width: 100%;
    padding: 16px 24px;
    background: #2F2621;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: auto;
}

#upsell-add:hover {
    background: #2F8B6D;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(47, 139, 109, 0.3);
}

#upsell-add:active {
    transform: translateY(0);
}

#upsell-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* FOOTNOTE - новый элемент */

.upsell-footnote {
    font-size: 12px;
    color: #999;
    margin: 12px 0 0 0;
    line-height: 1.4;
}

/* ================================
   CORNER NOTIFICATION (новый блок)
=============================== */

.corner-offer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 260px;
    background: #0f172a;
    color: #fff;
    border-radius: 12px;
    padding: 16px;
    font-size: 14px;
    z-index: 9998;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    animation: slideInRight 0.5s ease;
    border-left: 3px solid rgba(255, 255, 255, 0.12);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.corner-offer.hidden {
    display: none;
}

.corner-offer strong {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 15px;
    color: #e2e8f0;
}

.corner-offer p {
    margin: 0 0 8px 0;
    line-height: 1.4;
    color: #f0f0f0;
}

.corner-timer {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.9;
    color: #ddd;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.corner-timer b {
    color: #fff;
    font-size: 16px;
}

.corner-status {
    display: block;
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

/* ================================
   КНОПКА В УГЛУ КОРЗИНЫ (открыть upsell)
=============================== */

.upsell-corner-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9997;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #2F2621;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Nunito', sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(47, 38, 33, 0.35);
    transition: all 0.3s ease;
    text-align: center;
}

/* Состояние 1: Товар УЖЕ в корзине - спокойная, вторичная кнопка */
.upsell-corner-trigger-has-item {
    background: #6B7280;
    font-size: 14px;
    padding: 10px 14px;
    flex-direction: row;
    gap: 8px;
}

.upsell-corner-trigger-has-item:hover {
    background: #4B5563;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(107, 114, 128, 0.3);
}

/* Состояние 2: Увеличенная кнопка - когда окно было показано и закрыто */
.upsell-corner-trigger-prominent {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    font-size: 17px;
    padding: 16px 24px;
    min-width: 200px;
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4);
}

.upsell-corner-trigger-prominent:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5);
}

.upsell-corner-trigger:hover {
    background: #2F8B6D;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(47, 139, 109, 0.35);
}

.upsell-corner-trigger-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.upsell-corner-trigger-prominent .upsell-corner-trigger-icon {
    font-size: 22px;
}

.upsell-corner-trigger-text {
    line-height: 1.2;
    white-space: nowrap;
}

.upsell-corner-trigger-subtitle {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.9;
    line-height: 1.3;
    margin-top: 2px;
}

.upsell-corner-trigger-prominent .upsell-corner-trigger-subtitle {
    display: block !important;
    font-size: 12px;
}

/* Чтобы не перекрывать corner-offer — кнопка чуть выше, если нужно */
body:not(.upsell-notification-visible) .upsell-corner-trigger {
    bottom: 20px;
}

/* MOBILE UPDATES */

@media (max-width: 768px) {
    .upsell-modal {
        width: 94%;
        margin: 3vh auto;
        padding: 20px;
        max-height: 92vh;
    }
    
    .upsell-modal h3 {
        font-size: 20px;
    }
    
    .upsell-subtitle {
        font-size: 15px;
    }
    
    .upsell-price {
        font-size: 22px;
    }
    
    .upsell-video {
        margin-bottom: 16px;
    }
    
    .upsell-colors {
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .upsell-color {
        width: 44px;
        height: 44px;
    }
    
    .upsell-color::after {
        width: 32px;
        height: 32px;
    }
    
    .corner-offer {
        width: 220px;
        bottom: 15px;
        right: 15px;
        padding: 12px;
    }

    .upsell-corner-trigger {
        bottom: 16px;
        right: 16px;
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .upsell-corner-trigger-prominent {
        font-size: 15px;
        padding: 14px 20px;
        min-width: 180px;
    }
    
    .upsell-corner-trigger-has-item {
        font-size: 13px;
        padding: 10px 14px;
    }
}