/**
 * OcarinAlpes Claude AI Assistant - Chatbot Styles
 *
 * @package OcarinAlpes_Claude_Assistant
 */

/* Variables */
:root {
    --ocai-chat-primary: #2563eb;
    --ocai-chat-primary-dark: #1d4ed8;
    --ocai-chat-bg: #ffffff;
    --ocai-chat-text: #1f2937;
    --ocai-chat-text-light: #6b7280;
    --ocai-chat-border: #e5e7eb;
    --ocai-chat-user-bg: #2563eb;
    --ocai-chat-user-text: #ffffff;
    --ocai-chat-bot-bg: #f3f4f6;
    --ocai-chat-bot-text: #1f2937;
    --ocai-chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --ocai-chat-radius: 16px;
    --ocai-chat-width: 380px;
    --ocai-chat-height: 550px;
}

/* Dark theme */
.ocai-theme-dark {
    --ocai-chat-bg: #1f2937;
    --ocai-chat-text: #f9fafb;
    --ocai-chat-text-light: #9ca3af;
    --ocai-chat-border: #374151;
    --ocai-chat-bot-bg: #374151;
    --ocai-chat-bot-text: #f9fafb;
}

/* Base */
.ocai-chatbot {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

.ocai-chatbot *,
.ocai-chatbot *::before,
.ocai-chatbot *::after {
    box-sizing: inherit;
}

/* Position Fixed */
.ocai-chatbot-fixed-right,
.ocai-chatbot-fixed-left {
    position: fixed;
    bottom: 20px;
    z-index: 99999;
}

.ocai-chatbot-fixed-right {
    right: 20px;
}

.ocai-chatbot-fixed-left {
    left: 20px;
}

/* Toggle Button */
.ocai-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ocai-chat-primary), var(--ocai-chat-primary-dark));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.ocai-chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(37, 99, 235, 0.5);
}

.ocai-chatbot-toggle svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

.ocai-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Container */
.ocai-chatbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: var(--ocai-chat-width);
    height: var(--ocai-chat-height);
    background: var(--ocai-chat-bg);
    border-radius: var(--ocai-chat-radius);
    box-shadow: var(--ocai-chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}

.ocai-chatbot-fixed-left .ocai-chatbot-container {
    right: auto;
    left: 0;
}

.ocai-chatbot-container.ocai-chatbot-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Inline mode */
.ocai-chatbot-inline .ocai-chatbot-container {
    position: relative;
    bottom: auto;
    right: auto;
    width: 100%;
    max-width: 600px;
    height: 500px;
    margin: 0 auto;
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* Header */
.ocai-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--ocai-chat-primary), var(--ocai-chat-primary-dark));
    color: #fff;
}

.ocai-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.ocai-chatbot-avatar svg {
    width: 24px;
    height: 24px;
}

.ocai-chatbot-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ocai-chatbot-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    opacity: 0.9;
}

.ocai-status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: ocai-pulse 2s infinite;
}

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

.ocai-chatbot-header-actions {
    display: flex;
    gap: 5px;
}

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

.ocai-chatbot-minimize:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ocai-chatbot-minimize svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

/* Messages */
.ocai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ocai-chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    animation: ocai-fadeIn 0.3s ease;
}

@keyframes ocai-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ocai-chat-message-user {
    align-self: flex-end;
    background: var(--ocai-chat-user-bg);
    color: var(--ocai-chat-user-text);
    border-bottom-right-radius: 4px;
}

.ocai-chat-message-assistant {
    align-self: flex-start;
    background: var(--ocai-chat-bot-bg);
    color: var(--ocai-chat-bot-text);
    border-bottom-left-radius: 4px;
}

.ocai-chat-message-content {
    word-wrap: break-word;
}

.ocai-chat-message-content p {
    margin: 0 0 10px 0;
}

.ocai-chat-message-content p:last-child {
    margin-bottom: 0;
}

.ocai-chat-message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.ocai-chat-message-content pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.ocai-chat-message-content pre code {
    background: none;
    padding: 0;
}

/* Typing indicator */
.ocai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--ocai-chat-bot-bg);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.ocai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--ocai-chat-text-light);
    border-radius: 50%;
    animation: ocai-typing 1.4s infinite;
}

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

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

@keyframes ocai-typing {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

/* Input */
.ocai-chatbot-input-container {
    padding: 15px 20px;
    border-top: 1px solid var(--ocai-chat-border);
    background: var(--ocai-chat-bg);
}

.ocai-chatbot-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--ocai-chat-bot-bg);
    border-radius: 12px;
    padding: 8px 12px;
}

.ocai-chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ocai-chat-text);
    max-height: 100px;
    outline: none;
}

.ocai-chatbot-input::placeholder {
    color: var(--ocai-chat-text-light);
}

.ocai-chatbot-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--ocai-chat-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
}

.ocai-chatbot-send:hover:not(:disabled) {
    background: var(--ocai-chat-primary-dark);
    transform: scale(1.05);
}

.ocai-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ocai-chatbot-send svg {
    width: 18px;
    height: 18px;
}

/* Footer */
.ocai-chatbot-footer {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    color: var(--ocai-chat-text-light);
}

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

/* Error message */
.ocai-chat-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
    .ocai-chatbot-fixed-right,
    .ocai-chatbot-fixed-left {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .ocai-chatbot-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: none;
    }
    
    .ocai-chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .ocai-chatbot-fixed-left .ocai-chatbot-container {
        left: 0;
    }
}

/* Scrollbar */
.ocai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.ocai-chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--ocai-chat-border);
    border-radius: 3px;
}

.ocai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--ocai-chat-text-light);
}
