#chat-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#chat-widget * {
    box-sizing: border-box;
}

#chat-button {
    transition: all 0.3s ease;
    animation: gentleWiggle 9s ease-in-out infinite;
    position: relative;
}

#chat-button:hover {
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

/* Периодическое легкое шевеление кнопки каждые 9 секунд */
@keyframes gentleWiggle {
    0%, 90%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    91% {
        transform: translateX(-2px) rotate(-3deg);
    }
    93% {
        transform: translateX(2px) rotate(3deg);
    }
    95% {
        transform: translateX(-2px) rotate(-3deg);
    }
    97% {
        transform: translateX(2px) rotate(3deg);
    }
    99% {
        transform: translateX(0) rotate(0deg);
    }
}

/* Активное мигание при непрочитанных сообщениях */
#chat-button.has-unread {
    animation: wiggleAndPulse 2s ease-in-out infinite;
}

@keyframes wiggleAndPulse {
    0%, 100% {
        transform: translateX(0) scale(1);
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
    10% {
        transform: translateX(-3px) rotate(-5deg) scale(1.05);
    }
    20% {
        transform: translateX(3px) rotate(5deg) scale(1.05);
    }
    30% {
        transform: translateX(-3px) rotate(-5deg) scale(1.05);
    }
    40% {
        transform: translateX(0) rotate(0deg) scale(1);
    }
    50% {
        box-shadow: 0 4px 30px rgba(255, 68, 68, 0.6);
    }
}

/* Бейдж с количеством непрочитанных сообщений */
#unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
    animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

#chat-window {
    animation: slideUp 0.3s ease;
}

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

#messages::-webkit-scrollbar {
    width: 6px;
}

#messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#message-input:focus {
    outline: none;
    border-color: #667eea !important;
}

#user-email:focus,
#user-name:focus {
    outline: none;
    border-color: #667eea !important;
}

#send-button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

#close-button:hover {
    transform: scale(1.2);
}

#typing-indicator {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
