/* WP AI Chatbot Styles */

/* CSS Variables */
:root {
    --chatbot-color: #007cba;
    --chatbot-color-hover: #005a87;
    --chatbot-bg: #ffffff;
    --chatbot-text: #333333;
    --chatbot-border: #e1e5e9;
    --chatbot-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --chatbot-radius: 12px;
    --chatbot-transition: all 0.3s ease;
}

/* Widget Container */
.wp-ai-chatbot-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--chatbot-text);
}

/* Toggle Button */
.wp-ai-chatbot-toggle {
    width: auto;
    height: auto;
    background: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: var(--chatbot-transition);
    color: inherit;
    border: none;
    outline: none;
    padding: 0;
}

.wp-ai-chatbot-toggle img {
    width: 64px;
    height: 64px;
    display: block;
}

.wp-ai-chatbot-toggle:hover {
    background: var(--chatbot-color-hover);
    transform: scale(1.05);
}

.wp-ai-chatbot-toggle:active {
    transform: scale(0.95);
}

/* Chat Window */
.wp-ai-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--chatbot-bg);
    border-radius: var(--chatbot-radius);
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wp-ai-chatbot-slide-in 0.3s ease;
}

@keyframes wp-ai-chatbot-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Position Variants */
.wp-ai-chatbot-bottom-left .wp-ai-chatbot-window {
    bottom: 80px;
    left: 0;
    right: auto;
}

.wp-ai-chatbot-top-right .wp-ai-chatbot-window {
    bottom: auto;
    top: 80px;
    right: 0;
}

.wp-ai-chatbot-top-left .wp-ai-chatbot-window {
    bottom: auto;
    top: 80px;
    left: 0;
    right: auto;
}

/* Chat Header */
.wp-ai-chatbot-header {
    background: var(--chatbot-color);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--chatbot-radius) var(--chatbot-radius) 0 0;
}

.wp-ai-chatbot-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

.wp-ai-chatbot-controls {
    display: flex;
    gap: 8px;
}

.wp-ai-chatbot-minimize,
.wp-ai-chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--chatbot-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-ai-chatbot-minimize:hover,
.wp-ai-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Container */
.wp-ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
}

.wp-ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.wp-ai-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wp-ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.wp-ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Individual Messages */
.wp-ai-chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.wp-ai-chatbot-user {
    align-self: flex-end;
}

.wp-ai-chatbot-ai {
    align-self: flex-start;
}

.wp-ai-chatbot-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.wp-ai-chatbot-user .wp-ai-chatbot-message-content {
    background: var(--chatbot-color);
    color: white;
    border-bottom-right-radius: 6px;
}

.wp-ai-chatbot-ai .wp-ai-chatbot-message-content {
    background: white;
    color: var(--chatbot-text);
    border: 1px solid var(--chatbot-border);
    border-bottom-left-radius: 6px;
}

.wp-ai-chatbot-message-text {
    margin-bottom: 8px;
}

.wp-ai-chatbot-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.wp-ai-chatbot-user .wp-ai-chatbot-message-time {
    text-align: right;
}

.wp-ai-chatbot-ai .wp-ai-chatbot-message-time {
    text-align: left;
}

/* Source Link */
.wp-ai-chatbot-message-source {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.wp-ai-chatbot-message-source a {
    color: var(--chatbot-color);
    text-decoration: none;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--chatbot-transition);
}

.wp-ai-chatbot-message-source a:hover {
    text-decoration: underline;
}

/* Input Container */
.wp-ai-chatbot-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
}

.wp-ai-chatbot-form {
    margin: 0;
}

.wp-ai-chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.wp-ai-chatbot-input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: var(--chatbot-transition);
    font-family: inherit;
    max-height: 100px;
    min-height: 44px;
}

.wp-ai-chatbot-input:focus {
    border-color: var(--chatbot-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.wp-ai-chatbot-send {
    background: var(--chatbot-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--chatbot-transition);
    flex-shrink: 0;
}

.wp-ai-chatbot-send:hover {
    background: var(--chatbot-color-hover);
    transform: scale(1.05);
}

.wp-ai-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Typing Indicator */
.wp-ai-chatbot-typing {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--chatbot-border);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    max-width: 80%;
    margin-top: 8px;
}

.wp-ai-chatbot-typing-dots {
    display: flex;
    gap: 4px;
}

.wp-ai-chatbot-typing-dots span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: wp-ai-chatbot-typing 1.4s infinite ease-in-out;
}

.wp-ai-chatbot-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.wp-ai-chatbot-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes wp-ai-chatbot-typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.wp-ai-chatbot-typing-text {
    font-size: 12px;
    color: #666;
}

/* Minimized State */
.wp-ai-chatbot-widget.minimized .wp-ai-chatbot-window {
    display: none;
}

.wp-ai-chatbot-widget.minimized .wp-ai-chatbot-toggle {
    transform: rotate(180deg);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wp-ai-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .wp-ai-chatbot-bottom-left .wp-ai-chatbot-window {
        right: 20px;
        left: 20px;
    }
    
    .wp-ai-chatbot-top-right .wp-ai-chatbot-window,
    .wp-ai-chatbot-top-left .wp-ai-chatbot-window {
        top: 80px;
        right: 20px;
        left: 20px;
    }
    
    .wp-ai-chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .wp-ai-chatbot-message {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .wp-ai-chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
    }
    
    .wp-ai-chatbot-bottom-left .wp-ai-chatbot-window,
    .wp-ai-chatbot-top-right .wp-ai-chatbot-window,
    .wp-ai-chatbot-top-left .wp-ai-chatbot-window {
        right: 10px;
        left: 10px;
    }
    
    .wp-ai-chatbot-header {
        padding: 12px 16px;
    }
    
    .wp-ai-chatbot-messages {
        padding: 16px;
    }
    
    .wp-ai-chatbot-input-container {
        padding: 12px 16px;
    }
}

/* Accessibility */
.wp-ai-chatbot-widget:focus-within {
    outline: 2px solid var(--chatbot-color);
    outline-offset: 2px;
}

.wp-ai-chatbot-toggle:focus,
.wp-ai-chatbot-minimize:focus,
.wp-ai-chatbot-close:focus,
.wp-ai-chatbot-send:focus {
    outline: 2px solid var(--chatbot-color);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .wp-ai-chatbot-widget {
        --chatbot-border: #000000;
        --chatbot-text: #000000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .wp-ai-chatbot-widget * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wp-ai-chatbot-widget {
        --chatbot-bg: #1a1a1a;
        --chatbot-text: #ffffff;
        --chatbot-border: #333333;
    }
    
    .wp-ai-chatbot-messages {
        background: #0f0f0f;
    }
    
    .wp-ai-chatbot-ai .wp-ai-chatbot-message-content {
        background: #2a2a2a;
        border-color: #444444;
    }
    
    .wp-ai-chatbot-input {
        background: #2a2a2a;
        color: #ffffff;
        border-color: #444444;
    }
    
    .wp-ai-chatbot-typing {
        background: #2a2a2a;
        border-color: #444444;
    }
} 