/* Social Proof Widget - NeuroBack Style - Оптимизированная версия */

/* Глобальные стили для виджета */
.social-proof-container,
.social-proof-container * {
    box-sizing: border-box;
}

/* CSS переменные для легкой настройки */
:root {
    --sp-bg-color: #0f1b2e;
    --sp-border-color: #1e3a5f;
    --sp-border-hover: #2196f3;
    --sp-text-primary: #ffffff;
    --sp-text-secondary: #94a3b8;
    --sp-text-accent: #64b5f6;
    --sp-primary-color: #2196f3;
    --sp-success-color: #34a853;
    --sp-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    --sp-shadow-hover: 0 8px 30px rgba(33, 150, 243, 0.2);
    --sp-animation-duration: 0.5s;
    --sp-animation-easing: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --sp-mobile-padding: 8px;
    --sp-desktop-padding: 20px;
}

/* Контейнер */
.social-proof-container {
    position: fixed;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: max-content;
    pointer-events: none;
    padding: var(--sp-desktop-padding);
    box-sizing: border-box;
}

/* Позиционирование */
.social-proof-container.bottom-left {
    bottom: 0;
    left: 0;
}

.social-proof-container.bottom-right {
    bottom: 0;
    right: 0;
}

.social-proof-container.top-left {
    top: 60px;
    left: 0;
}

.social-proof-container.top-right {
    top: 60px;
    right: 0;
}

/* Уведомление */
.social-proof-notification {
    background: var(--sp-bg-color);
    border: 1px solid var(--sp-border-color);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--sp-shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all var(--sp-animation-duration) var(--sp-animation-easing);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    pointer-events: all;
    min-width: 300px;
    max-width: 380px;
    width: 100%;
    opacity: 0;
    transform: translateX(-100%);
    contain: layout style paint;
}

/* Анимация появления */
.social-proof-container.bottom-right .social-proof-notification,
.social-proof-container.top-right .social-proof-notification {
    transform: translateX(100%);
}

.social-proof-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Hover эффекты */
.social-proof-notification:hover {
    transform: translateX(0) scale(1.02);
    box-shadow: var(--sp-shadow-hover);
    border-color: var(--sp-border-hover);
}

/* Градиентная анимация */
.social-proof-notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent, 
        rgba(33, 150, 243, 0.1), 
        transparent
    );
    transition: left 0.6s ease;
}

.social-proof-notification:hover::before {
    left: 100%;
}

/* Иконка */
.notification-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    position: relative;
    background: var(--sp-primary-color);
}

/* Цветовые варианты иконок */
.notification-icon.purchase {
    background: linear-gradient(135deg, #2196f3, #00bcd4);
}

.notification-icon.review {
    background: linear-gradient(135deg, #00bcd4, #64b5f6);
}

.notification-icon.signup {
    background: linear-gradient(135deg, #34a853, #4caf50);
}

.notification-icon.view {
    background: linear-gradient(135deg, #ff6b6b, #f06292);
}

.notification-icon.success {
    background: linear-gradient(135deg, #34a853, #4caf50);
}

/* Контент */
.notification-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    padding-right: 25px; /* Место для кнопки закрытия */
}

.notification-title {
    font-weight: 600;
    color: var(--sp-text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Текст уведомления */
.notification-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Анимированные числа */
.animated-number {
    display: inline-block;
    font-weight: 700;
    color: var(--sp-primary-color);
    min-width: 1.5ch;
    text-align: center;
    position: relative;
}

/* Галочка верификации */
.verified-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(52, 168, 83, 0.2);
    color: var(--sp-success-color);
    font-size: 10px;
    font-weight: bold;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: auto;
    position: relative;
    top: -1px;
}

.notification-time {
    color: var(--sp-text-accent);
    font-size: 11px;
    opacity: 0.8;
}

/* Кнопка закрытия */
.close-notification {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 14px;
    line-height: 1;
    color: var(--sp-text-secondary);
}

.social-proof-notification:hover .close-notification {
    opacity: 1;
}

.close-notification:hover {
    background: rgba(33, 150, 243, 0.2);
    border-color: var(--sp-primary-color);
    color: var(--sp-primary-color);
    transform: scale(1.1);
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .social-proof-container {
        padding: var(--sp-mobile-padding);
        max-width: calc(100vw - 16px);
        width: auto;
    }
    
    .social-proof-notification {
        padding: 12px;
        min-width: unset;
        max-width: 100%;
        font-size: 0.9rem;
        gap: 10px;
    }
    
    .notification-content {
        padding-right: 0;
    }
    
    .notification-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 18px;
    }
    
    .notification-title {
        font-size: 13px;
    }
    
    .notification-text {
        /* На мобильных разрешаем более гибкое отображение */
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .notification-time {
        font-size: 10px;
    }
    
    .verified-icon {
        width: 14px;
        height: 14px;
        font-size: 8px;
    }
}

/* Ультра-компактный режим для маленьких экранов */
@media (max-width: 400px) {
    .social-proof-notification {
        padding: 10px;
        gap: 8px;
        min-width: unset;
        max-width: 100%;
        white-space: normal;
    }
    
    .notification-content {
        padding-right: 0;
    }
    
    .notification-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 16px;
    }
    
    .notification-title {
        font-size: 12px;
        line-height: 1.2;
        flex-wrap: wrap;
    }
    
    .notification-text {
        /* Для очень маленьких экранов ограничиваем 1 строкой */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .verified-icon {
        display: none; /* Скрываем на очень маленьких экранах */
    }
}

/* Специальные правила для десктопа - предотвращение переноса */
@media (min-width: 481px) {
    .social-proof-notification {
        white-space: nowrap;
        width: auto;
    }
    
    .notification-title {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .notification-text {
        display: block;
        max-width: 260px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Глобальный запрет переноса для десктопа */
@media (min-width: 769px) {
    .notification-title,
    .notification-text {
        white-space: nowrap !important;
    }
}

/* Анимация для уменьшения motion sickness */
@media (prefers-reduced-motion: reduce) {
    .social-proof-notification {
        transition: opacity 0.3s ease;
    }
    
    .social-proof-notification::before {
        display: none;
    }
    
    .social-proof-notification:hover {
        transform: none;
    }
    
    .animated-number {
        transition: none;
    }
}

/* Темная тема поддержка */
@media (prefers-color-scheme: dark) {
    :root {
        --sp-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
        --sp-shadow-hover: 0 8px 35px rgba(33, 150, 243, 0.3);
    }
}

/* Print стили - скрываем виджет при печати */
@media print {
    .social-proof-container {
        display: none !important;
    }
}