/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 350px;
    height: 60px;
    background: white;
    border-radius: 10px 0 0 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-widget-hidden {
    display: none !important;
}

.chat-widget-open {
    height: 500px;
    width: 350px;
}

.chat-widget-closed {
    width: 60px;
    height: 60px;
}

.chat-header {
    padding: 15px 20px;
    background: #007bff;
    color: white;
    border-radius: 10px 0 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    min-height: 60px;
}

.chat-widget-closed .chat-header {
    padding: 0;
    justify-content: center;
    border-radius: 10px 0 0 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-widget-closed .chat-header-content {
    display: none;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
}

.chat-status {
    font-size: 12px;
    margin-left: 10px;
}

.chat-status-connected {
    color: #28a745;
}

.chat-status-disconnected {
    color: #dc3545;
}

.chat-toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-widget-closed .chat-toggle-btn {
    width: 60px;
    height: 60px;
    font-size: 28px;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
}

.chat-widget-closed .chat-icon-close {
    display: none;
}

.chat-widget-open .chat-icon-open {
    display: none;
}

.chat-body {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.chat-widget-open .chat-body {
    display: flex;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.chat-message-user {
    background: #e9ecef;
    align-self: flex-end;
    margin-left: auto;
}

.chat-message-owner {
    background: #007bff;
    color: white;
    align-self: flex-start;
}

.chat-message-system {
    background: #fff3cd;
    color: #856404;
    align-self: center;
    text-align: center;
    font-size: 12px;
    font-style: italic;
    max-width: 90%;
}

.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: 1px solid #ced4da;
    border-radius: 5px;
    padding: 10px;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 100px;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: #007bff;
}

.chat-send-btn {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

.chat-send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

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

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

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

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

/* Mobile responsive */
@media (max-width: 768px) {
    .chat-widget-open {
        width: 100%;
        right: 0;
        left: 0;
        height: calc(100vh - 100px);
        max-height: 600px;
        border-radius: 10px 10px 0 0;
    }

    .chat-widget-closed {
        width: 60px;
        height: 60px;
        right: 0;
        bottom: 0;
    }
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message {
    animation: slideIn 0.3s ease;
}
