/* ===== AI Shop Assistant Chat Styles ===== */

:root {
    --aisa-primary-color: #6366f1;
    --aisa-primary-hover: #4f46e5;
    --aisa-bg-light: #ffffff;
    --aisa-bg-dark: #1f2937;
    --aisa-text-primary: #111827;
    --aisa-text-secondary: #6b7280;
    --aisa-border: #e5e7eb;
    --aisa-shadow: rgba(0, 0, 0, 0.1);
    --aisa-shadow-lg: rgba(0, 0, 0, 0.2);
    --aisa-radius: 16px;
    --aisa-radius-sm: 12px;
}

/* ===== FLOATING WIDGET ===== */

#aisa-widget {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#aisa-widget.aisa-widget-right {
    right: 20px;
}

#aisa-widget.aisa-widget-left {
    left: 20px;
}

/* Toggle Button */
.aisa-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aisa-primary-color) 0%, var(--aisa-primary-hover) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.aisa-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

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

.aisa-toggle-icon {
    width: 28px;
    height: 28px;
    color: white;
    transition: all 0.3s;
}

.aisa-icon-close {
    display: none;
}

.aisa-widget-open .aisa-icon-chat {
    display: none;
}

.aisa-widget-open .aisa-icon-close {
    display: block;
}

.aisa-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Chat Window */
.aisa-chat-window {
    position: fixed;
    bottom: 100px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: var(--aisa-radius);
    box-shadow: 0 20px 60px var(--aisa-shadow-lg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#aisa-widget.aisa-widget-right .aisa-chat-window {
    right: 0;
}

#aisa-widget.aisa-widget-left .aisa-chat-window {
    left: 0;
}

#aisa-widget.aisa-widget-open .aisa-chat-window {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Header */
.aisa-header {
    background: linear-gradient(135deg, var(--aisa-primary-color) 0%, var(--aisa-primary-hover) 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.aisa-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.aisa-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aisa-avatar svg {
    width: 22px;
    height: 22px;
    color: white;
}

.aisa-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.aisa-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.aisa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: aisa-pulse 2s infinite;
}

@keyframes aisa-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.aisa-minimize {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.aisa-minimize:hover {
    background: rgba(255, 255, 255, 0.25);
}

.aisa-minimize svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Messages Container */
.aisa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    scroll-behavior: smooth;
}

.aisa-messages::-webkit-scrollbar {
    width: 6px;
}

.aisa-messages::-webkit-scrollbar-track {
    background: transparent;
}

.aisa-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.aisa-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Message */
.aisa-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: aisa-message-in 0.3s ease-out;
}

@keyframes aisa-message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aisa-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--aisa-primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aisa-message-avatar svg {
    width: 16px;
    height: 16px;
    color: white;
}

.aisa-message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aisa-message-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: var(--aisa-radius-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    font-size: 14px;
    line-height: 1.6;
    color: var(--aisa-text-primary);
    word-wrap: break-word;
}

.aisa-message-user {
    flex-direction: row-reverse;
}

.aisa-message-user .aisa-message-avatar {
    background: var(--aisa-text-secondary);
}

.aisa-message-user .aisa-message-bubble {
    background: var(--aisa-primary-color);
    color: white;
}

/* Typing Indicator */
.aisa-typing-bubble {
    width: fit-content;
    padding: 16px 20px;
    display: flex;
    gap: 6px;
}

.aisa-typing-bubble span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aisa-text-secondary);
    animation: aisa-typing 1.4s infinite;
}

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

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

@keyframes aisa-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Container */
.aisa-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--aisa-border);
}

.aisa-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aisa-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.aisa-input {
    flex: 1;
    border: 1px solid var(--aisa-border);
    border-radius: var(--aisa-radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: border-color 0.2s;
}

.aisa-input:focus {
    outline: none;
    border-color: var(--aisa-primary-color);
}

.aisa-send {
    width: 44px;
    height: 44px;
    border-radius: var(--aisa-radius-sm);
    background: var(--aisa-primary-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.aisa-send:hover {
    background: var(--aisa-primary-hover);
    transform: scale(1.05);
}

.aisa-send:active {
    transform: scale(0.95);
}

.aisa-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.aisa-send svg {
    width: 20px;
    height: 20px;
    color: white;
}

.aisa-powered-by {
    text-align: center;
    font-size: 11px;
    color: var(--aisa-text-secondary);
}

.aisa-powered-by strong {
    color: var(--aisa-primary-color);
}

/* ===== FULLPAGE CHAT ===== */

.aisa-fullpage-chat {
    background: white;
    border-radius: var(--aisa-radius);
    box-shadow: 0 4px 16px var(--aisa-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.aisa-fullpage-header {
    background: linear-gradient(135deg, var(--aisa-primary-color) 0%, var(--aisa-primary-hover) 100%);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.aisa-clear-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.aisa-clear-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.aisa-clear-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

.aisa-fullpage-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f9fafb;
}

.aisa-fullpage-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--aisa-border);
}

/* ===== MOBILE RESPONSIVE ===== */

@media (max-width: 768px) {
    .aisa-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        bottom: 90px;
    }
    
    #aisa-widget.aisa-widget-right .aisa-chat-window {
        right: 10px;
    }
    
    #aisa-widget.aisa-widget-left .aisa-chat-window {
        left: 10px;
    }
}

@media (max-width: 480px) {
    #aisa-widget {
        bottom: 10px;
    }
    
    #aisa-widget.aisa-widget-right {
        right: 10px;
    }
    
    #aisa-widget.aisa-widget-left {
        left: 10px;
    }
    
    .aisa-toggle {
        width: 56px;
        height: 56px;
    }
    
    .aisa-toggle-icon {
        width: 24px;
        height: 24px;
    }
}
