/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e8594f;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(232, 89, 79, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(232, 89, 79, 0.5);
}

.chat-toggle:focus-visible {
    outline: 3px solid #f5a623;
    outline-offset: 2px;
}

.chat-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.3s ease;
}

.chat-panel.hidden {
    display: none;
}

@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-header {
    background: #e8594f;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.chat-close:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.4;
    font-size: 0.9rem;
    word-wrap: break-word;
}

.chat-msg p { margin: 0; }

.chat-msg-user {
    align-self: flex-end;
    background: #e8594f;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg-bot {
    align-self: flex-start;
    background: #f1f3f5;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
}

.chat-typing {
    align-self: flex-start;
    background: #f1f3f5;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.chat-typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #aaa;
    border-radius: 50%;
    margin: 0 2px;
    animation: chatBounce 1.4s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

.chat-input-area {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    gap: 8px;
}

.chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: #e8594f;
}

.chat-input-area button {
    background: #e8594f;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-input-area button:hover { background: #d04a40; }
.chat-input-area button:disabled { background: #f5a6a1; cursor: not-allowed; }
.chat-input-area button:focus-visible { outline: 3px solid #f5a623; outline-offset: 2px; }

.chat-status {
    text-align: center;
    padding: 4px;
    font-size: 0.75rem;
    color: #666;
}
.chat-status.connected { color: #16a34a; }
.chat-status.disconnected { color: #dc2626; }
.chat-status.connecting { color: #ca8a04; }
