/* AIConverse Standalone Chat Widget Styles */
.aiconverse-chat-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 9999;
    font-size: 24px;
    border: 5px solid #dadadad6;
}

.aiconverse-chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.aiconverse-chat-trigger img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.aiconverse-chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 350px;
    height: 550px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    transition: all 0.3s ease;
    transform: scale(0.8);
    opacity: 0;
    transform-origin: bottom right;
}

.aiconverse-chat-window.active {
    display: flex;
    transform: scale(1);
    opacity: 1;
}

.aiconverse-chat-header {
    background: linear-gradient(90deg,rgba(0, 136, 255, 1) 0%, rgba(0, 111, 255, 1) 50%, rgba(90, 39, 230, 1) 100%);
    color: #ffffff;
    border-bottom: 1px solid #ebebeb;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aiconverse-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aiconverse-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.aiconverse-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.aiconverse-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.aiconverse-message {
    margin-bottom: 15px;
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.aiconverse-message.user {
    justify-content: flex-end;
}

.aiconverse-message.ai {
    justify-content: flex-start;
}

.aiconverse-message-content {
    max-width: 88%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.8px;
    line-height: 1.5;
    word-wrap: break-word;
    transition: all 0.2s ease;
}

.aiconverse-message.user .aiconverse-message-content {
    background: linear-gradient(90deg, rgb(40 116 255) 0%, rgb(0 100 255) 18%, rgb(65 27 255) 100%);
    color: white;
    animation: slideInRight 0.4s ease-out;
}

.aiconverse-message.ai .aiconverse-message-content {
    background: white;
    color: #333;
    animation: slideInLeft 0.4s ease-out;
}

.aiconverse-chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
}

.aiconverse-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.aiconverse-chat-input:focus {
    border-color: #667eea78;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.aiconverse-send-btn {
    background: linear-gradient(90deg, rgb(51 123 255) 0%, rgb(0 112 255) 18%, rgb(65 27 255) 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.aiconverse-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.aiconverse-send-btn:active {
    transform: scale(0.95);
}

.aiconverse-send-btn svg {
    width: 18px;
    height: 18px;
}

.aiconverse-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.aiconverse-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.aiconverse-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.aiconverse-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .aiconverse-chat-trigger {
        bottom: 15px;
        right: 15px;
        width: 70px;
        height: 70px;
    }
    
    .aiconverse-chat-window {
        bottom: 90px;
        right: 15px;
        width: calc(100vw - 30px);
        height: 550px;
        max-height: 550px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .aiconverse-chat-window {
        background: #1a1a1a;
    }
    
    .aiconverse-chat-messages {
        background: rgb(255 255 255);
    }
    
    .aiconverse-message.ai .aiconverse-message-content {
        background: rgb(243 244 246);
        color: #000000;
        border: 1px solid #f1f1f1;
    }
    
    .aiconverse-chat-input {
        background: #ffffff;
        color: #1c1c1c;
        border-color: #dddddd;
    }
    
    .aiconverse-chat-input-container {
        background: #ffffff;
        border-top-color: #ebebeb;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .aiconverse-message,
    .aiconverse-typing-indicator {
        animation: none;
    }
    
    .aiconverse-chat-messages {
        scroll-behavior: auto;
    }
}

/* Focus styles for accessibility */
.aiconverse-chat-trigger:focus,
.aiconverse-close-btn:focus,
.aiconverse-send-btn:focus,
.aiconverse-chat-input:focus {
    outline: 1px solid #667eea78;
    outline-offset: 1px;
}

/* Loading state */
.aiconverse-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
}

/* URL Preview Styles */
.aiconverse-url-preview {
    margin: 10px 0;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
}

.aiconverse-url-preview:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.aiconverse-preview-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.aiconverse-preview-image {
    width: 100%;
    height: 150px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aiconverse-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aiconverse-preview-no-image {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.aiconverse-preview-no-image img {
    width: 60px;
    height: 60px;
    opacity: 0.5;
}

.aiconverse-preview-content {
    padding: 12px;
}

.aiconverse-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    line-height: 1.3;
}

.aiconverse-preview-description {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 8px;
}

.aiconverse-preview-site {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #888;
}

.aiconverse-preview-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

/* URL preview loading state */
.aiconverse-preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
    font-size: 12px;
}

.aiconverse-preview-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e1e5e9;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive URL preview */
@media (max-width: 480px) {
    .aiconverse-preview-image {
        height: 120px;
    }
    
    .aiconverse-preview-title {
        font-size: 13px;
    }
    
    .aiconverse-preview-description {
        font-size: 11px;
    }
}