/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #0d47a1, #1976d2, #42a5f5, #90caf9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(30, 136, 229, 0.3);
    transition: all 0.3s ease;
    position: relative;
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    border: none;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(30, 136, 229, 0.4);
    animation-duration: 1.5s;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.chat-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: scale(0);
    opacity: 0;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e8ed;
}

.chat-window.open {
    transform: scale(1);
    opacity: 1;
}

.chat-header {
    padding: 20px;
    background: linear-gradient(45deg, #0d47a1, #1976d2);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-title h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chat-status {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    display: flex;
    margin-bottom: 16px;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

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

.message-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(45deg, #0d47a1, #1976d2);
    color: white;
    margin-left: 40px;
}

.bot-message .message-content {
    background: white;
    color: #333;
    margin-right: 40px;
    border: 1px solid #e1e8ed;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 250px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message-content p {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.4;
}

.message-content p:last-of-type {
    margin-bottom: 0;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

.quick-replies {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e1e8ed;
    flex-shrink: 0;
}

.quick-reply-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-reply-btn {
    background: #f1f3f4;
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    margin: 4px 6px 4px 0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.quick-reply-btn:hover {
    background: #e8eaed;
    transform: translateY(-1px);
}

.chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e1e8ed;
    flex-shrink: 0;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d9e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #1976d2;
}

#send-button {
    width: 40px;
    height: 40px;
    background: #c41e3a;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#send-button:hover {
    background: #a31717;
    transform: scale(1.05);
}

.typing-indicator {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    align-items: flex-start;
}

.typing-dots {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e8ed;
}

.typing-dots span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1s infinite;
}

.typing-dots span:nth-of-type(1) { animation-delay: 0s; }
.typing-dots span:nth-of-type(2) { animation-delay: 0.2s; }
.typing-dots span:nth-of-type(3) { animation-delay: 0.4s; }

@keyframes typing {
    0% { transform: translateY(0px); opacity: 0.4; }
    50% { transform: translateY(-10px); opacity: 1; }
    100% { transform: translateY(0px); opacity: 0.4; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: -10px;
    }
    
    .chat-button {
        width: 55px;
        height: 55px;
    }
    
    .message-content {
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -5px;
    }
    
    .message-content {
        max-width: 180px;
    }
}