/* AI Chatbot Pro - Frontend Styles */

:root {
    --aicp-primary-color: #0084ff;
    --aicp-bg-color: #ffffff;
    --aicp-text-color: #333333;
    --aicp-border-color: #e0e0e0;
    --aicp-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    --aicp-radius: 12px;
}

/* Chat Button */
#aicp-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--aicp-primary-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--aicp-shadow);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#aicp-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 50px rgba(0, 0, 0, 0.2);
}

#aicp-chat-button.aicp-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

#aicp-chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

#aicp-chat-button.aicp-position-bottom-left {
    left: 20px;
    right: auto;
}

#aicp-chat-button.aicp-position-top-right {
    top: 20px;
    bottom: auto;
}

#aicp-chat-button.aicp-position-top-left {
    top: 20px;
    left: 20px;
    bottom: auto;
    right: auto;
}

/* Chat Window */
#aicp-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background-color: var(--aicp-bg-color);
    border-radius: var(--aicp-radius);
    box-shadow: var(--aicp-shadow);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* Chat Header */
#aicp-chat-header {
    background-color: var(--aicp-primary-color);
    color: white;
    padding: 20px;
    border-radius: var(--aicp-radius) var(--aicp-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#aicp-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

#aicp-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

#aicp-bot-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#aicp-bot-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#aicp-bot-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.aicp-status-online {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #4caf50;
    margin-right: 5px;
}

#aicp-header-actions {
    display: flex;
    gap: 10px;
}

#aicp-minimize-btn,
#aicp-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#aicp-minimize-btn:hover,
#aicp-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
#aicp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8f9fa;
}

#aicp-messages::-webkit-scrollbar {
    width: 6px;
}

#aicp-messages::-webkit-scrollbar-track {
    background: transparent;
}

#aicp-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#aicp-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Message */
.aicp-message {
    display: flex;
    margin-bottom: 16px;
    animation: aicp-fadeInUp 0.3s ease;
}

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

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

.aicp-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.aicp-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.aicp-message-content {
    max-width: 75%;
    margin: 0 10px;
}

.aicp-message-bot .aicp-message-content {
    background-color: white;
    border-radius: 18px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.aicp-message-user .aicp-message-content {
    background-color: var(--aicp-primary-color);
    color: white;
    border-radius: 18px;
    padding: 12px 16px;
}

.aicp-message-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.aicp-message-text a {
    color: inherit;
    text-decoration: underline;
}

.aicp-message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

/* Typing Indicator */
.aicp-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.aicp-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    animation: aicp-typing 1.4s infinite;
}

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

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

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

/* Preset Questions */
.aicp-preset-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.aicp-preset-question {
    background: white;
    border: 1px solid var(--aicp-border-color);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--aicp-text-color);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.aicp-preset-question:hover {
    border-color: var(--aicp-primary-color);
    color: var(--aicp-primary-color);
    transform: translateX(4px);
}

/* Error Message */
.aicp-message-error .aicp-message-content {
    background-color: #ffebee;
    color: #c62828;
    border-radius: 8px;
    padding: 12px 16px;
}

/* Input Area */
#aicp-input-area {
    border-top: 1px solid var(--aicp-border-color);
    padding: 16px;
    background-color: white;
    border-radius: 0 0 var(--aicp-radius) var(--aicp-radius);
}

#aicp-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#aicp-message-input {
    flex: 1;
    border: 1px solid var(--aicp-border-color);
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
}

#aicp-message-input:focus {
    border-color: var(--aicp-primary-color);
}

#aicp-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--aicp-primary-color);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

#aicp-send-btn:hover {
    transform: scale(1.05);
}

#aicp-send-btn:active {
    transform: scale(0.95);
}

#aicp-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Email Capture */
#aicp-email-capture {
    padding: 16px;
    background-color: #f5f5f5;
    border-radius: 8px;
    margin: 12px 16px;
}

#aicp-email-capture h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
}

#aicp-email-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--aicp-border-color);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
}

#aicp-submit-email {
    width: 100%;
    padding: 10px;
    background-color: var(--aicp-primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#aicp-submit-email:hover {
    opacity: 0.9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #aicp-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    #aicp-chat-header {
        border-radius: 0;
    }

    #aicp-input-area {
        border-radius: 0;
    }

    #aicp-chat-button {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .aicp-message-content {
        max-width: 85%;
    }

    #aicp-messages {
        padding: 15px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --aicp-bg-color: #1e1e1e;
        --aicp-text-color: #ffffff;
        --aicp-border-color: #333333;
    }

    #aicp-messages {
        background-color: #121212;
    }

    .aicp-message-bot .aicp-message-content {
        background-color: #2a2a2a;
        color: #ffffff;
    }

    #aicp-input-area,
    #aicp-message-input {
        background-color: #1e1e1e;
        color: #ffffff;
    }

    .aicp-preset-question {
        background-color: #2a2a2a;
        border-color: #333333;
        color: #ffffff;
    }
}

/* Accessibility */
.aicp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--aicp-primary-color);
    outline-offset: 2px;
}

/* Animations */
@keyframes aicp-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.aicp-pulse {
    animation: aicp-pulse 2s infinite;
}