/* AI Chatbot Agent - Frontend Widget Styles */

#aica-chatbot-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    z-index: 999999;
}

/* Chat Button */
.aica-chat-button {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

.aica-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

.aica-chat-button svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Position variants */
.aica-position-bottom-right .aica-chat-button {
    bottom: 20px;
    right: 20px;
}

.aica-position-bottom-left .aica-chat-button {
    bottom: 20px;
    left: 20px;
}

.aica-position-top-right .aica-chat-button {
    top: 20px;
    right: 20px;
}

.aica-position-top-left .aica-chat-button {
    top: 20px;
    left: 20px;
}

/* Chat Window */
.aica-chat-window {
    position: fixed;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.aica-position-bottom-right .aica-chat-window {
    bottom: 90px;
    right: 20px;
}

.aica-position-bottom-left .aica-chat-window {
    bottom: 90px;
    left: 20px;
}

.aica-position-top-right .aica-chat-window {
    top: 90px;
    right: 20px;
}

.aica-position-top-left .aica-chat-window {
    top: 90px;
    left: 20px;
}

.aica-chat-window.open {
    display: flex;
}

/* Header */
.aica-chat-header {
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.aica-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aica-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.aica-bot-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aica-bot-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.aica-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.aica-close-btn:hover {
    background: rgba(255,255,255,0.3);
}

.aica-close-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

/* Messages Container */
.aica-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.aica-messages-container::-webkit-scrollbar {
    width: 6px;
}

.aica-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.aica-messages-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Message */
.aica-message {
    margin-bottom: 16px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aica-message.user {
    justify-content: flex-end;
}

.aica-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.5;
}

.aica-message.user .aica-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.aica-message.bot .aica-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.aica-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.aica-message.bot .aica-message-time {
    text-align: left;
}

/* Typing Indicator */
.aica-typing {
    display: none;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    max-width: 60px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.aica-typing.active {
    display: inline-block;
}

.aica-typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    margin: 0 2px;
    animation: bounce 1.4s infinite;
}

.aica-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.aica-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Input Area */
.aica-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.aica-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.aica-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.aica-input-wrapper input:focus {
    border-color: #667eea;
}

.aica-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.aica-send-btn:hover {
    transform: scale(1.1);
}

.aica-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

.aica-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Powered By */
.aica-powered-by {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: #999;
}

.aica-powered-by a {
    color: #667eea;
    text-decoration: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .aica-chat-window {
        width: 100%;
        height: 100%;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        border-radius: 0;
    }
    
    .aica-chat-button {
        width: 56px;
        height: 56px;
    }
    
    .aica-position-bottom-right .aica-chat-button,
    .aica-position-bottom-left .aica-chat-button {
        bottom: 16px;
    }
    
    .aica-position-bottom-right .aica-chat-button {
        right: 16px;
    }
    
    .aica-position-bottom-left .aica-chat-button {
        left: 16px;
    }
}

/* Welcome Message */
.aica-welcome {
    text-align: center;
    padding: 40px 20px;
}

.aica-welcome h3 {
    margin: 0 0 8px;
    color: #333;
    font-size: 18px;
}

.aica-welcome p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* Error State */
.aica-error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin: 10px;
    font-size: 13px;
    text-align: center;
}

/* Loading State */
.aica-loading {
    text-align: center;
    padding: 20px;
}

.aica-loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}