/**
 * UK Accountancy Chatbot - Frontend Styles - Darko Consulting
 */

/* Container */
#ukac-chatbot-container {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#ukac-chatbot-container.ukac-position-bottom-right {
    bottom: var(--ukac-position-y, 20px);
    right: var(--ukac-position-x, 20px);
}

#ukac-chatbot-container.ukac-position-bottom-left {
    bottom: var(--ukac-position-y, 20px);
    left: var(--ukac-position-x, 20px);
}

#ukac-chatbot-container.ukac-position-top-right {
    top: var(--ukac-position-y, 20px);
    right: var(--ukac-position-x, 20px);
}

#ukac-chatbot-container.ukac-position-top-left {
    top: var(--ukac-position-y, 20px);
    left: var(--ukac-position-x, 20px);
}

/* Chat Button */
.ukac-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ukac-primary-color, #0066cc);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ukac-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ukac-chat-button svg {
    width: 28px;
    height: 28px;
}

/* Chat Window */
.ukac-chat-window {
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    
    /* Default fixed size */
    width: 380px;
    height: 600px;
    min-width: 300px; /* Minimum threshold */
    min-height: 400px; /* Minimum threshold */
}

.ukac-chat-window.ukac-responsive-size {
    width: 380px; /* Default desktop size */
    height: 600px; /* Default desktop size */
    max-width: 90vw; /* Allow it to be responsive on desktop too */
    max-height: 90vh;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ukac-chat-window.ukac-responsive-size {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-width: 380px; /* Max size on mobile */
        max-height: 600px; /* Max size on mobile */
    }
    
    .ukac-chat-window {
        /* Ensure fixed size respects mobile viewport */
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 100px);
    }
    
    .ukac-position-bottom-right .ukac-chat-window,
    .ukac-position-bottom-left .ukac-chat-window {
        bottom: 10px;
    }
    
    .ukac-position-top-right .ukac-chat-window,
    .ukac-position-top-left .ukac-chat-window {
        top: 10px;
    }
    
    .ukac-position-bottom-right .ukac-chat-window,
    .ukac-position-top-right .ukac-chat-window {
        right: 10px;
    }
    
    .ukac-position-bottom-left .ukac-chat-window,
    .ukac-position-top-left .ukac-chat-window {
        left: 10px;
    }
    
    .ukac-suggestions {
        max-height: 100px;
    }
    
    .ukac-cta-button {
        display: block;
        margin: 4px;
    }
}

/* Inline Chatbot (Shortcode) */
.ukac-inline-chatbot {
    max-width: 800px;
    margin: 20px auto;
}

.ukac-inline-chat-window {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 400px; /* Minimum threshold for inline */
}

.ukac-inline-messages {
    height: 500px;
}

/* Position chat window based on corner */
.ukac-position-bottom-right .ukac-chat-window,
.ukac-position-bottom-left .ukac-chat-window {
    bottom: 80px;
}

.ukac-position-top-right .ukac-chat-window,
.ukac-position-top-left .ukac-chat-window {
    top: 80px;
}

.ukac-position-bottom-right .ukac-chat-window,
.ukac-position-top-right .ukac-chat-window {
    right: 0;
}

.ukac-position-bottom-left .ukac-chat-window,
.ukac-position-top-left .ukac-chat-window {
    left: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.ukac-chat-header {
    background: var(--ukac-primary-color, #0066cc);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ukac-header-content h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ukac-header-content p {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.ukac-close-button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.ukac-close-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Lead Capture Form */
.ukac-lead-form {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.ukac-lead-form-content h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
}

.ukac-lead-form-content > p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.ukac-form-group {
    margin-bottom: 16px;
}

.ukac-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: #333;
}

.ukac-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.ukac-form-group input:focus {
    outline: none;
    border-color: var(--ukac-primary-color, #0066cc);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.ukac-submit-button {
    width: 100%;
    padding: 12px;
    background: var(--ukac-primary-color, #0066cc);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ukac-submit-button:hover {
    background: var(--ukac-primary-color-dark, #0052a3);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ukac-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ukac-privacy-note {
    margin-top: 12px;
    font-size: 11px;
    color: #999;
    text-align: center;
}

/* Messages Container */
.ukac-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

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

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

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

.ukac-message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.ukac-user .ukac-message-bubble {
    background: var(--ukac-primary-color, #0066cc);
    color: white;
    border-bottom-right-radius: 4px;
}

.ukac-bot .ukac-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ukac-message-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

/* Typing Indicator */
.ukac-typing-indicator {
    padding: 0 20px 12px 20px;
    background: #f8f9fa;
}

.ukac-typing-dots {
    display: inline-flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

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

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

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

/* Input Area */
.ukac-input-area {
    display: flex;
    align-items: flex-end;
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
}

.ukac-message-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
}

.ukac-message-input:focus {
    outline: none;
    border-color: var(--ukac-primary-color, #0066cc);
}

.ukac-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ukac-primary-color, #0066cc);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ukac-send-button:hover {
    background: var(--ukac-primary-color-dark, #0052a3);
    transform: scale(1.05);
}

.ukac-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Suggestions */
.ukac-suggestions {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.ukac-suggestion-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 12px; /* Slightly smaller radius */
    padding: 4px 8px; /* Reduced padding */
    font-size: 11px; /* Smaller font size */
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    white-space: nowrap;
}

.ukac-suggestion-btn:hover {
    background: var(--ukac-primary-color, #0066cc);
    color: white;
    border-color: var(--ukac-primary-color, #0066cc);
}

/* Contact CTA */
.ukac-contact-cta {
    padding: 16px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.ukac-contact-cta p {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.ukac-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--ukac-primary-color, #0066cc);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 4px;
}

.ukac-cta-button:hover {
    background: var(--ukac-primary-color-dark, #0052a3);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ukac-cta-button.ukac-cta-secondary {
    background: white;
    color: var(--ukac-primary-color, #0066cc);
    border: 1px solid var(--ukac-primary-color, #0066cc);
}

.ukac-cta-button.ukac-cta-secondary:hover {
    background: #f8f9fa;
}

/* Inline Chatbot (Shortcode) */
.ukac-inline-chatbot {
    max-width: 800px;
    margin: 20px auto;
}

.ukac-inline-chat-window {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ukac-inline-messages {
    height: 500px;
}



/* Scrollbar Styling */
.ukac-messages::-webkit-scrollbar,
.ukac-lead-form::-webkit-scrollbar,
.ukac-suggestions::-webkit-scrollbar {
    width: 6px;
}

.ukac-messages::-webkit-scrollbar-track,
.ukac-lead-form::-webkit-scrollbar-track,
.ukac-suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.ukac-messages::-webkit-scrollbar-thumb,
.ukac-lead-form::-webkit-scrollbar-thumb,
.ukac-suggestions::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.ukac-messages::-webkit-scrollbar-thumb:hover,
.ukac-lead-form::-webkit-scrollbar-thumb:hover,
.ukac-suggestions::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Error Message */
.ukac-error-message {
    background: #fee;
    color: #c33;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 0 20px 12px 20px;
    font-size: 13px;
    border-left: 3px solid #c33;
}

/* Success Message */
.ukac-success-message {
    background: #efe;
    color: #3c3;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 0 20px 12px 20px;
    font-size: 13px;
    border-left: 3px solid #3c3;
}
