.chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: var(--gradient-primary);
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(0, 102, 204, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 3px solid white;
}

.chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 35px rgba(0, 102, 204, 0.5);
}

.chat-toggle i {
    font-size: 30px;
    color: white;
}

.chat-toggle .chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    padding: 0 4px;
}

.chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 480px;
    height: 700px;
    background: var(--bg-white);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.chat-window.active {
    transform: scale(1);
}

.chat-header {
    background: var(--gradient-primary);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 52px;
    height: 52px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.chat-avatar i {
    font-size: 28px;
    color: var(--primary-color);
}

.chat-info h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-clear {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    color: white;
}

.chat-clear:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(15deg);
}

.chat-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    color: white;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.chat-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-body::-webkit-scrollbar {
    width: 5px;
}

.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-bot {
    align-self: flex-start;
}

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-bot .message-avatar {
    background: var(--primary-color);
    color: white;
}

.message-user .message-avatar {
    background: var(--accent-color);
    color: white;
}

.message-content {
    max-width: 320px;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.message-bot .message-content {
    background: white;
    border: 1px solid var(--border-color);
    border-top-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.message-user .message-content {
    background: var(--primary-color);
    color: white;
    border-top-right-radius: 5px;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-line;
}

.message-user .message-text {
    color: white;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}

.message-text strong {
    color: var(--primary-color);
}

.message-user .message-text strong {
    color: white;
}

.message-text a {
    color: var(--primary-color);
    text-decoration: underline;
}

.message-text a:hover {
    color: var(--primary-dark);
}

.message-user .message-text a {
    color: white;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-top-left-radius: 5px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--medium-gray);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.typing-text {
    margin-left: 8px;
    font-size: 12px;
    color: var(--medium-gray);
}

.quick-replies-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    margin-bottom: 5px;
}

.quick-reply-chip {
    padding: 8px 14px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-size: 12px;
    color: var(--dark-color);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.quick-reply-chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.2);
}

.chip-icon {
    font-size: 14px;
    display: inline-block;
}

.chat-footer {
    padding: 15px 18px;
    background: white;
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-light);
    border-radius: 30px;
    padding: 5px 5px 5px 18px;
    border: 1px solid var(--border-color);
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-size: 15px;
    outline: none;
}

.chat-send {
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-footer-hint {
    text-align: center;
    font-size: 10px;
    color: var(--medium-gray);
    margin-top: 8px;
    opacity: 0.7;
}

.chat-footer-hint i {
    margin-right: 4px;
}

.welcome-message {
    text-align: center;
    padding: 20px 0;
}

.welcome-icon {
    width: 70px;
    height: 70px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 32px;
}

.welcome-message h4 {
    color: var(--dark-color);
    margin-bottom: 8px;
}

.welcome-message p {
    color: var(--medium-gray);
    font-size: 14px;
    margin-bottom: 15px;
}

@media (max-width: 520px) {
    .chat-window {
        width: calc(100vw - 30px);
        height: 650px;
        bottom: 100px;
        right: 15px;
    }
}

@media (max-width: 380px) {
    .chat-window {
        height: 600px;
        bottom: 90px;
    }
    
    .chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .chat-toggle i {
        font-size: 26px;
    }
    
    .message-content {
        max-width: 220px;
    }
    
    .quick-reply-chip {
        white-space: normal;
    }
}