/* Floating Widget Button */
.chat-widget-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0041BA;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 65, 186, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 65, 186, 0.4);
}

.chat-widget-button:active {
    transform: scale(0.95);
}

.chat-widget-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Chat Panel */
.chat-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 420px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 998;
}

.chat-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Header */
.chat-header {
    background: #0041BA;
    color: white;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: white;
}

.chat-header p {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 0.8;
}

/* Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafafa;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

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

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

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.message.assistant .message-content {
    background: white;
    color: #222;
    border: 1px solid #e0e0e0;
}

.message.user .message-content {
    background: #0041BA;
    color: white;
}

.message.error .message-content {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.message.loading .message-content {
    background: white;
    color: #666;
    border: 1px solid #e0e0e0;
    font-style: italic;
}

/* Input Area */
.chat-input-area {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    background: white;
    border-radius: 0 0 12px 12px;
}

.chat-input-field {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-input-field:focus {
    outline: none;
    border-color: #0041BA;
}

.chat-send-btn {
    background: #0041BA;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-send-btn:hover:not(:disabled) {
    background: #0032a0;
}

.chat-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-panel {
        width: calc(100vw - 32px);
        max-height: 70vh;
        bottom: 80px;
    }

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

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
