/* Demo page styles */
.demo-page {
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.demo-page h1 {
    color: #1a73e8;
    margin-bottom: 20px;
}

.info-block {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.info-block ul {
    margin: 10px 0;
    padding-left: 20px;
}

.info-block li {
    margin: 8px 0;
}

.embed-code {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.embed-code h3 {
    color: #fff;
    margin-bottom: 10px;
}

.embed-code pre {
    background: #2d2d2d;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 13px;
}

/* Chat Widget Styles */
.ais-chat-widget {
    position: fixed;
    z-index: 10000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.ais-chat-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.ais-chat-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Toggle Button */
.ais-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.ais-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(26, 115, 232, 0.5);
}

.ais-chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.ais-chat-toggle.active svg.chat-icon {
    display: none;
}

.ais-chat-toggle:not(.active) svg.close-icon {
    display: none;
}

/* Chat Window */
.ais-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.ais-chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.ais-chat-header {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ais-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ais-chat-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.ais-chat-title {
    flex: 1;
}

.ais-chat-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ais-chat-title span {
    font-size: 12px;
    opacity: 0.8;
}

.ais-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ais-chat-close:hover {
    opacity: 1;
}

/* Chat Messages */
.ais-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.ais-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ais-message.bot {
    align-self: flex-start;
    background: white;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 4px;
}

.ais-message.user {
    align-self: flex-end;
    background: #1a73e8;
    color: white;
    border-bottom-right-radius: 4px;
}

.ais-message.bot pre {
    background: #f5f5f5;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 12px;
}

/* Typing Indicator */
.ais-typing {
    display: flex;
    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);
}

.ais-typing span {
    width: 8px;
    height: 8px;
    background: #1a73e8;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ais-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.ais-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Suggestions */
.ais-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.ais-suggestion {
    padding: 8px 14px;
    background: #e8f0fe;
    color: #1a73e8;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.ais-suggestion:hover {
    background: #d2e3fc;
}

/* Chat Input */
.ais-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.ais-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ais-chat-input input:focus {
    border-color: #1a73e8;
}

.ais-chat-input input::placeholder {
    color: #9e9e9e;
}

/* Voice Button */
.ais-voice-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ais-voice-btn:hover {
    background: #e0e0e0;
}

.ais-voice-btn.recording {
    background: #ff4444;
    animation: pulse 1s infinite;
}

.ais-voice-btn svg {
    width: 20px;
    height: 20px;
    fill: #666;
}

.ais-voice-btn.recording svg {
    fill: white;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Send Button */
.ais-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a73e8;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.ais-send-btn:hover {
    background: #1557b0;
    transform: scale(1.05);
}

.ais-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.ais-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ais-chat-window {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        height: calc(100vh - 120px) !important;
        bottom: 80px !important;
        right: 10px !important;
        left: auto !important;
        border-radius: 12px;
    }
    .ais-widget-container {
        right: 10px !important;
    }
}

/* Scrollbar */
.ais-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ais-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ais-chat-messages::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.ais-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Voice Recognition Indicator */
.ais-recognizing {
    padding: 12px 16px;
    margin: 8px 48px 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ais-recognizing .dots span {
    animation: dotPulse 1.4s infinite;
    opacity: 0;
}

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

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

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

/* Voice button recognizing state */
.ais-voice-btn.recognizing {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: pulse 1s infinite;
}

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


/* Operator Button */
.ais-operator-btn {
    background: #10b981;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ais-operator-btn:hover {
    background: #059669;
    transform: scale(1.05);
}

.ais-operator-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}
