/* Плавающая кнопка связи - Минималистичный дизайн 2026 */

.floating-contact-wrapper {
    position: fixed;
    bottom: 40px;
    right: 20px;
    z-index: 1500;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
    font-family: var(--font-family-base);
}

/* Основная плавающая кнопка */
.floating-contact-btn {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, 
        #6D28D9 0%, 
        #7C3AED 50%,
        #8B5CF6 100%);
    background-size: 200% 200%;
    border: none;
    cursor: pointer;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 4px 8px rgba(109, 40, 217, 0.2),
        0 6px 12px rgba(109, 40, 217, 0.15),
        0 8px 16px rgba(109, 40, 217, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: floatingPulse 3s ease-in-out infinite;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.floating-contact-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transition: left 0.5s ease;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.floating-contact-btn .contact-icon,
.floating-contact-btn .close-icon {
    position: absolute;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

.floating-contact-btn .close-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

.floating-contact-btn.active {
    animation: none;
    background-position: 100% 0%;
    transform: rotate(90deg);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.35),
        0 4px 10px rgba(109, 40, 217, 0.25),
        0 8px 16px rgba(109, 40, 217, 0.2),
        0 12px 24px rgba(109, 40, 217, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.floating-contact-btn.active .contact-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

.floating-contact-btn.active .close-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.floating-contact-btn:hover {
    transform: translateY(-3px) scale(1.08);
    background-position: 100% 0%;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.4),
        0 4px 10px rgba(109, 40, 217, 0.3),
        0 8px 16px rgba(109, 40, 217, 0.2),
        0 12px 24px rgba(109, 40, 217, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.floating-contact-btn.active:hover {
    transform: rotate(90deg) scale(1.08);
}

.floating-contact-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.floating-contact-btn.active:active {
    transform: rotate(90deg) scale(1.02);
}

/* Анимация пульсации */
@keyframes floatingPulse {
    0%, 100% {
        box-shadow: 
            0 2px 4px rgba(0, 0, 0, 0.3),
            0 4px 8px rgba(109, 40, 217, 0.2),
            0 6px 12px rgba(109, 40, 217, 0.15),
            0 8px 16px rgba(109, 40, 217, 0.1),
            inset 0 0 0 1px rgba(255, 255, 255, 0.1),
            inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 
            0 2px 4px rgba(0, 0, 0, 0.35),
            0 4px 8px rgba(109, 40, 217, 0.25),
            0 6px 12px rgba(109, 40, 217, 0.2),
            0 8px 16px rgba(109, 40, 217, 0.15),
            0 10px 20px rgba(109, 40, 217, 0.1),
            0 0 20px rgba(109, 40, 217, 0.2),
            inset 0 0 0 1px rgba(255, 255, 255, 0.15),
            inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Меню с кнопками */
.floating-contact-menu {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px) scale(0.85);
    transform-origin: bottom center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-contact-menu.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Элементы меню */
.floating-contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    background: linear-gradient(135deg, 
        rgba(26, 26, 46, 0.98) 0%,
        rgba(22, 16, 48, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: var(--color-text);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.25),
        0 6px 12px rgba(139, 92, 246, 0.15),
        0 8px 16px rgba(139, 92, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 2px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    flex-shrink: 0;
}

.floating-contact-menu.active .floating-contact-item {
    animation: menuItemSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.floating-contact-menu.active .floating-contact-item:nth-child(1) {
    animation-delay: 0.05s;
}

.floating-contact-menu.active .floating-contact-item:nth-child(2) {
    animation-delay: 0.1s;
}

@keyframes menuItemSlideIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.floating-contact-item::before {
    display: none;
}

.floating-contact-item:hover {
    transform: translateX(-4px) scale(1.05);
    border-color: rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, 
        rgba(26, 26, 46, 1) 0%,
        rgba(22, 16, 48, 1) 100%);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.35),
        0 4px 10px rgba(0, 0, 0, 0.28),
        0 6px 14px rgba(139, 92, 246, 0.2),
        0 8px 20px rgba(139, 92, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 2px rgba(0, 0, 0, 0.15);
}

.floating-contact-item:active {
    transform: translateX(-2px) scale(1.02);
}

/* Иконка элемента */
.item-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.telegram-bot {
    border-color: rgba(41, 169, 225, 0.4);
}

.telegram-bot .item-icon {
    color: #29A9E1;
}

.telegram-bot .item-icon svg {
    filter: drop-shadow(0 0 8px rgba(41, 169, 225, 0.4));
}

.telegram-bot:hover {
    border-color: rgba(41, 169, 225, 0.6);
}

.live-support {
    border-color: rgba(16, 185, 129, 0.4);
}

.live-support .item-icon {
    color: #10b981;
}

.live-support:hover {
    border-color: rgba(16, 185, 129, 0.6);
}

.floating-contact-item:hover .item-icon {
    transform: scale(1.1);
}

/* Скрываем контент */
.item-content {
    display: none;
}

.item-title,
.item-subtitle {
    display: none;
}

/* Зеленый анимированный кружок для живой поддержки */
.live-support-circle {
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    box-shadow: 
        0 0 0 0 rgba(16, 185, 129, 0.7),
        0 0 12px rgba(16, 185, 129, 0.4);
    animation: greenCirclePulse 2s ease-in-out infinite;
}

@keyframes greenCirclePulse {
    0%, 100% {
        box-shadow: 
            0 0 0 0 rgba(16, 185, 129, 0.7),
            0 0 12px rgba(16, 185, 129, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 
            0 0 0 10px rgba(16, 185, 129, 0),
            0 0 20px rgba(16, 185, 129, 0.6);
        transform: scale(1.15);
    }
}

/* Индикатор статуса - скрыт */
.status-indicator {
    display: none;
}

/* Виджет чата */
.chat-widget {
    position: fixed;
    bottom: 110px;
    right: 20px;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: linear-gradient(135deg, 
        rgba(26, 26, 46, 0.98) 0%,
        rgba(22, 16, 48, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.4),
        0 8px 16px rgba(0, 0, 0, 0.3),
        0 12px 24px rgba(0, 0, 0, 0.25),
        0 16px 32px rgba(139, 92, 246, 0.15),
        0 20px 40px rgba(139, 92, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px) scale(0.92);
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1499;
    overflow: hidden;
}

.chat-widget.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.45),
        0 8px 18px rgba(0, 0, 0, 0.35),
        0 12px 28px rgba(0, 0, 0, 0.3),
        0 16px 36px rgba(139, 92, 246, 0.2),
        0 20px 48px rgba(139, 92, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);
}

/* Заголовок чата */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.15) 0%,
        rgba(168, 85, 247, 0.15) 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

.chat-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6 0%, #A855F7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
    letter-spacing: 0.3px;
}

.chat-header-status {
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: statusPulse 2s ease-in-out infinite;
}

.chat-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-close-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    color: var(--color-text);
    transform: rotate(90deg);
}

/* Область сообщений */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(139, 92, 246, 0.05);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Сообщения */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6 0%, #A855F7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.chat-message.user .chat-message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.user .chat-message-bubble {
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.2) 0%,
        rgba(5, 150, 105, 0.2) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.chat-message-time {
    font-size: 11px;
    color: var(--color-text-muted);
    padding: 0 4px;
}

/* Системное сообщение */
.chat-message.system {
    align-self: flex-start;
    max-width: 85%;
}

.chat-message.system .chat-message-bubble {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.2);
    font-size: 14px;
    text-align: left;
    color: var(--color-text);
}

/* Форма ввода */
.chat-input-wrapper {
    padding: 16px 20px;
    background: rgba(139, 92, 246, 0.05);
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

.chat-input-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    color: var(--color-text);
    font-size: 14px;
    font-family: var(--font-family-base);
    resize: none;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.chat-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(26, 26, 46, 0.8);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.chat-input::placeholder {
    color: var(--color-text-muted);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #8B5CF6 0%, #A855F7 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.chat-send-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

.chat-send-btn:active {
    transform: translateY(0) scale(1);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Typing индикатор */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    max-width: fit-content;
    font-size: 10px;
    margin-left: 8px;
    margin-bottom: 6px;
}

.typing-indicator.active {
    display: flex;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dot {
    width: 5px;
    height: 5px;
    background: var(--color-text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .floating-contact-wrapper {
        bottom: 20px;
        right: 16px;
    }
    
    .floating-contact-btn {
        width: 52px;
        height: 52px;
    }
    
    .floating-contact-btn .contact-icon,
    .floating-contact-btn .close-icon {
        width: 26px;
        height: 26px;
    }
    
    .floating-contact-item {
        width: 52px;
        height: 52px;
    }
    
    .item-icon {
        width: 24px;
        height: 24px;
    }
    
    .live-support-circle {
        width: 20px;
        height: 20px;
    }
    
    .chat-widget {
        bottom: 85px;
        right: 16px;
        width: calc(100vw - 80px);
        height: 480px;
        max-height: calc(100vh - 140px);
    }
}

@media (max-width: 480px) {
    .floating-contact-wrapper {
        bottom: 16px;
        right: 12px;
    }
    
    .floating-contact-btn {
        width: 48px;
        height: 48px;
    }
    
    .floating-contact-btn .contact-icon,
    .floating-contact-btn .close-icon {
        width: 24px;
        height: 24px;
    }
    
    .floating-contact-item {
        width: 48px;
        height: 48px;
    }
    
    .item-icon {
        width: 22px;
        height: 22px;
    }
    
    .live-support-circle {
        width: 18px;
        height: 18px;
    }
    
    .chat-widget {
        bottom: 70px;
        right: 12px;
        width: calc(100vw - 70px);
        height: 420px;
        max-height: calc(100vh - 110px);
        border-radius: 16px;
    }
    
    .chat-header {
        padding: 14px 16px;
    }
    
    .chat-messages {
        padding: 14px;
    }
}
