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

/* Chat Button */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0052A5 0%, #003d7a 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 82, 165, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 82, 165, 0.5);
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-toggle-btn .chat-close-icon {
    display: none;
}

.chat-toggle-btn.active .chat-icon {
    display: none;
}

.chat-toggle-btn.active .chat-close-icon {
    display: block;
}

/* Unread Badge */
.chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    display: none;
}

.chat-unread-badge.show {
    display: block;
    animation: bounce 0.5s ease;
}

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

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chat-window.show {
    display: flex;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #0052A5 0%, #003d7a 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-text p {
    margin: 2px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-minimize-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

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

.chat-minimize-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fa;
}

.chat-message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
    display: flex;
    justify-content: flex-end;
}

.chat-message.bot {
    display: flex;
    justify-content: flex-start;
}

.chat-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
}

.chat-message.user .chat-message-content {
    background: #0052A5;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot .chat-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

.chat-message.bot .chat-message-time {
    text-align: left;
}

/* Typing Indicator */
.chat-typing {
    display: none;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-typing.show {
    display: block;
}

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

.chat-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0052A5;
    animation: typing 1.4s infinite;
}

.chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #0052A5;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0052A5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: #003d7a;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.chat-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.chat-welcome h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
}

.chat-welcome p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        bottom: 0;
    }

    .chat-widget {
        bottom: 15px;
        right: 15px;
    }

    .chat-toggle-btn {
        width: 56px;
        height: 56px;
    }

    .chat-message-content {
        max-width: 85%;
    }
}
