/* Chat Widget Styles */
#mgdents-chat-widget {
    font-family: 'Inter', sans-serif;
    z-index: 9999;
    position: fixed;
    bottom: 25px;
    right: 25px;
}

/* Toggle Button */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1B3A6B 0%, #4A7BA7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(27, 58, 107, 0.4);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 10001;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FF4757;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }

    60% {
        transform: translateY(-3px);
    }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-window.active {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #1B3A6B 0%, #295394 100%);
    color: white;
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.agent-name {
    font-weight: 700;
    font-size: 1rem;
}

.agent-status {
    font-size: 0.75rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.agent-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #2ECC71;
    border-radius: 50%;
    display: block;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close-chat:hover {
    opacity: 1;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 1.2rem;
    background: #F5F8FC;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: slideIn 0.3s ease;
}

.bot-message {
    align-self: flex-start;
}

.bot-message .message-content {
    background: white;
    color: #333;
    padding: 0.8rem 1rem;
    border-radius: 12px 12px 12px 2px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background: #4A7BA7;
    color: white;
    padding: 0.8rem 1rem;
    border-radius: 12px 12px 2px 12px;
    box-shadow: 0 2px 10px rgba(74, 123, 167, 0.2);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quick Replies */
.quick-replies {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.quick-replies button {
    background: white;
    border: 1px solid #4A7BA7;
    color: #4A7BA7;
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-replies button:hover {
    background: #4A7BA7;
    color: white;
}

/* Input Area */
.chat-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #E8EEF5;
    display: flex;
    gap: 0.8rem;
}

.chat-input-area input {
    flex: 1;
    border: 1px solid #E8EEF5;
    padding: 0.8rem;
    border-radius: 20px;
    outline: none;
    transition: border 0.2s;
}

.chat-input-area input:focus {
    border-color: #4A7BA7;
}

.chat-input-area button {
    background: #1B3A6B;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.chat-input-area button:hover {
    background: #295394;
}

/* Typing Indicator */
.typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    margin-right: 3px;
    animation: typing 1s infinite;
}

.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        bottom: 90px;
        right: 20px;
        max-height: 70vh;
    }
}