/**
 * Shop AI Agent - Widget Styles
 * Version: 1.0.0
 */

/* Widget Container */
.shop-ai-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Position Classes */
.shop-ai-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.shop-ai-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.shop-ai-position-top-right {
    top: 20px;
    right: 20px;
}

.shop-ai-position-top-left {
    top: 20px;
    left: 20px;
}

/* Toggle Button */
.shop-ai-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.shop-ai-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.shop-ai-toggle:active {
    transform: scale(0.95);
}

.shop-ai-toggle-icon,
.shop-ai-toggle-close {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Window */
.shop-ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

.shop-ai-position-bottom-left .shop-ai-chat-window {
    right: auto;
    left: 0;
}

.shop-ai-position-top-right .shop-ai-chat-window {
    bottom: auto;
    top: 80px;
}

.shop-ai-position-top-left .shop-ai-chat-window {
    bottom: auto;
    top: 80px;
    right: auto;
    left: 0;
}

/* Chat Header */
.shop-ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.shop-ai-chat-title {
    display: flex;
    align-items: center;
}

.shop-ai-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.shop-ai-chat-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.shop-ai-status {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

.shop-ai-chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-ai-minimize {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.shop-ai-minimize:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages */
.shop-ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.shop-ai-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.shop-ai-message-user {
    align-items: flex-end;
}

.shop-ai-message-bot {
    align-items: flex-start;
}

.shop-ai-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.shop-ai-message-user .shop-ai-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.shop-ai-message-bot .shop-ai-message-content {
    background: white;
    color: #2c3e50;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 4px;
}

.shop-ai-message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.shop-ai-message-time {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 4px;
    padding: 0 4px;
}

/* Welcome Message */
.shop-ai-welcome-message {
    margin-bottom: 20px;
}

/* Typing Indicator */
.shop-ai-typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 18px;
    margin-bottom: 16px;
    max-width: 80%;
}

.shop-ai-typing-dots {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.shop-ai-typing-dots span {
    width: 6px;
    height: 6px;
    background: #95a5a6;
    border-radius: 50%;
    margin: 0 2px;
    animation: shop-ai-typing 1.4s infinite ease-in-out;
}

.shop-ai-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.shop-ai-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes shop-ai-typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input */
.shop-ai-chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
    flex-shrink: 0;
}

.shop-ai-chat-input {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 24px;
    padding: 8px 16px;
    transition: border-color 0.2s ease;
}

.shop-ai-chat-input:focus-within {
    border-color: #667eea;
}

.shop-ai-chat-input input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: #2c3e50;
    padding: 4px 0;
}

.shop-ai-chat-input input::placeholder {
    color: #95a5a6;
}

.shop-ai-chat-input input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.shop-ai-send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.shop-ai-send-button:hover:not(:disabled) {
    transform: scale(1.1);
}

.shop-ai-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Dark Theme */
.shop-ai-theme-dark .shop-ai-chat-window {
    background: #2c3e50;
    border-color: #34495e;
}

.shop-ai-theme-dark .shop-ai-chat-messages {
    background: #34495e;
}

.shop-ai-theme-dark .shop-ai-message-bot .shop-ai-message-content {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a5f7a;
}

.shop-ai-theme-dark .shop-ai-chat-input-container {
    background: #2c3e50;
    border-color: #34495e;
}

.shop-ai-theme-dark .shop-ai-chat-input {
    background: #34495e;
    border-color: #4a5f7a;
}

.shop-ai-theme-dark .shop-ai-chat-input input {
    color: #ecf0f1;
}

.shop-ai-theme-dark .shop-ai-chat-input input::placeholder {
    color: #7f8c8d;
}

.shop-ai-theme-dark .shop-ai-typing-indicator {
    background: #34495e;
    border-color: #4a5f7a;
    color: #ecf0f1;
}

/* Auto Theme (follows system preference) */
@media (prefers-color-scheme: dark) {
    .shop-ai-theme-auto .shop-ai-chat-window {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .shop-ai-theme-auto .shop-ai-chat-messages {
        background: #34495e;
    }
    
    .shop-ai-theme-auto .shop-ai-message-bot .shop-ai-message-content {
        background: #34495e;
        color: #ecf0f1;
        border-color: #4a5f7a;
    }
    
    .shop-ai-theme-auto .shop-ai-chat-input-container {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .shop-ai-theme-auto .shop-ai-chat-input {
        background: #34495e;
        border-color: #4a5f7a;
    }
    
    .shop-ai-theme-auto .shop-ai-chat-input input {
        color: #ecf0f1;
    }
    
    .shop-ai-theme-auto .shop-ai-chat-input input::placeholder {
        color: #7f8c8d;
    }
    
    .shop-ai-theme-auto .shop-ai-typing-indicator {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .shop-ai-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .shop-ai-position-bottom-left .shop-ai-chat-window,
    .shop-ai-position-top-left .shop-ai-chat-window {
        right: 10px;
        left: 10px;
    }
    
    .shop-ai-position-top-right .shop-ai-chat-window,
    .shop-ai-position-top-left .shop-ai-chat-window {
        bottom: 10px;
        top: 10px;
    }
    
    .shop-ai-toggle {
        width: 50px;
        height: 50px;
    }
    
    .shop-ai-chat-window {
        bottom: 70px;
    }
    
    .shop-ai-position-top-right .shop-ai-chat-window,
    .shop-ai-position-top-left .shop-ai-chat-window {
        bottom: auto;
        top: 70px;
    }
}

/* Scrollbar Styling */
.shop-ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.shop-ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

.shop-ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Animation for new messages */
.shop-ai-message {
    animation: shop-ai-message-appear 0.3s ease-out;
}

@keyframes shop-ai-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
