.chat-widget-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

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

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.chat-toggle-btn.active svg {
    transform: rotate(180deg);
}

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

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

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

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

.chat-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 16px 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;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar svg {
    width: 24px;
    height: 24px;
}

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

.chat-header-text span {
    font-size: 12px;
    opacity: 0.9;
}

.chat-status-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

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

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: messageIn 0.3s ease;
}

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

.chat-message.user {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.ai {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-message.ai .message-content {
    white-space: pre-wrap;
}

.chat-message-feedback {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.feedback-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.feedback-btn:hover {
    background: #f0f0f0;
}

.feedback-btn.helpful:hover {
    border-color: #28a745;
    color: #28a745;
}

.feedback-btn.not-helpful:hover {
    border-color: #dc3545;
    color: #dc3545;
}

.feedback-btn.selected {
    background: #e9ecef;
}

.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-6px);
    }
}

.chat-suggestions {
    padding: 8px 16px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-suggestions-title {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.chat-suggestion-btn {
    background: #f0f7ff;
    border: 1px solid #d0e3ff;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    color: #0056b3;
    cursor: pointer;
    margin: 4px 4px 4px 0;
    transition: all 0.2s;
}

.chat-suggestion-btn:hover {
    background: #d0e3ff;
}

.chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

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

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

.chat-welcome {
    text-align: center;
    padding: 30px 20px;
}

.chat-welcome-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
}

.chat-welcome-icon svg {
    width: 32px;
    height: 32px;
}

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

.chat-welcome p {
    margin: 0 0 20px;
    font-size: 14px;
    color: #666;
}

.chat-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-action-btn {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quick-action-btn:hover {
    border-color: #007bff;
    background: #f0f7ff;
}

.quick-action-btn svg {
    width: 20px;
    height: 20px;
    color: #007bff;
}

.quick-action-btn span {
    font-size: 13px;
    color: #333;
}

.chat-end-session {
    padding: 16px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.chat-end-session p {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.chat-rating {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.rating-star {
    font-size: 28px;
    cursor: pointer;
    color: #ddd;
    transition: all 0.2s;
}

.rating-star:hover,
.rating-star.active {
    color: #ffc107;
    transform: scale(1.1);
}

.chat-end-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-end-btn:hover {
    background: #c82333;
}

@media (max-width: 480px) {
    .chat-widget-container {
        bottom: 80px;
    }
    
    .chat-window {
        width: 100%;
        height: calc(100vh - 160px);
        max-height: none;
        bottom: 70px;
        right: 0;
        border-radius: 16px 16px 0 0;
    }
    
    .chat-toggle-btn {
        width: 54px;
        height: 54px;
    }
}

[data-theme="dark"] .chat-window {
    background: #1a1a2e;
}

[data-theme="dark"] .chat-messages {
    background: #16213e;
}

[data-theme="dark"] .chat-message.ai {
    background: #1a1a2e;
    color: #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .chat-input-container {
    background: #1a1a2e;
    border-top-color: #333;
}

[data-theme="dark"] .chat-input-wrapper {
    background: #16213e;
    border-color: #333;
}

[data-theme="dark"] .chat-input {
    color: #e0e0e0;
}

[data-theme="dark"] .chat-suggestions {
    background: #1a1a2e;
    border-top-color: #333;
}

[data-theme="dark"] .chat-suggestion-btn {
    background: #16213e;
    border-color: #333;
    color: #60a5fa;
}

[data-theme="dark"] .chat-welcome h3 {
    color: #e0e0e0;
}

[data-theme="dark"] .chat-welcome p {
    color: #a0a0a0;
}

[data-theme="dark"] .quick-action-btn {
    background: #16213e;
    border-color: #333;
}

[data-theme="dark"] .quick-action-btn span {
    color: #e0e0e0;
}
