/**
 * FAQ Chatbot Styles
 * 
 * Minimal, namespaced CSS for the FAQ chatbot widget.
 * All styles are prefixed with .faq-chatbot to avoid conflicts.
 */

/* Main widget container */
.faq-chatbot {
    max-width: 400px;
    margin: 20px 0;
    border: 1px solid #110372 !important;
    border-radius: 12px;
    background: #FFFFFF !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    height: 550px;
    overflow: auto;
}

/* Header */
.faq-chatbot__header {
    padding: 16px 20px;
    background: #110372 !important;
    border-radius: 12px 12px 0 0;
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.faq-chatbot__header::before {
    content: "🤖";
    font-size: 20px;
}

.faq-chatbot__header h3 {
    margin: 0;
    font-size: 22px !important;
    font-weight: 600;
    color: #FFFFFF !important;
}

/* Chat messages area */
.faq-chatbot__content {
    flex: 1;
    padding: 16px;
    overflow-y: scroll;
    overflow-x: hidden;
    background: #FFFFFF !important;
    position: relative;
    min-height: 0;
    height: 350px;
    -webkit-overflow-scrolling: touch;
}

/* Chat message bubbles */
.faq-chatbot__message {
    display: flex;
    margin-bottom: 12px;
}

.faq-chatbot__message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.faq-chatbot__message--bot .faq-chatbot__message-bubble {
    background: #FFFFFF !important;
    border: 1px solid #110372 !important;
    color: #110372 !important;
    border-bottom-left-radius: 4px;
}

.faq-chatbot__message--user .faq-chatbot__message-bubble {
    background: #EEAB2E !important;
    color: #110372 !important;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.faq-chatbot__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #FFFFFF !important;
    border: 1px solid #110372 !important;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
    margin-bottom: 12px;
}

.faq-chatbot__typing-dots {
    display: flex;
    gap: 4px;
}

.faq-chatbot__typing-dot {
    width: 6px;
    height: 6px;
    background: #110372 !important;
    border-radius: 50%;
}

/* Service and question buttons in chat */
.faq-chatbot__options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.faq-chatbot__option-btn {
    padding: 10px 14px;
    border: 1px solid #110372 !important;
    border-radius: 20px;
    background: #FFFFFF !important;
    color: #110372 !important;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

.faq-chatbot__option-btn:hover,
.faq-chatbot__option-btn:focus {
    background: #110372 !important;
    color: #FFFFFF !important;
    outline: none;
    transform: translateY(-1px);
}

/* Action buttons */
.faq-chatbot__action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.faq-chatbot__action-btn {
    padding: 8px 16px;
    border: 1px solid #EEAB2E !important;
    border-radius: 16px;
    background: #EEAB2E !important;
    color: #110372 !important;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 100px;
    text-align: center;
}

.faq-chatbot__action-btn:hover,
.faq-chatbot__action-btn:focus {
    background: #110372 !important;
    border-color: #110372 !important;
    color: #FFFFFF !important;
    outline: none;
    transform: translateY(-1px);
}

/* Contact form in chat */
.faq-chatbot__contact-form {
    background: #FFFFFF !important;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #110372 !important;
    margin-top: 8px;
}

.faq-chatbot__form-header {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #110372 !important;
}

.faq-chatbot__form-intro {
    margin: 0 0 16px 0;
    color: #110372 !important;
    font-size: 13px;
}

.faq-chatbot__form-group {
    margin-bottom: 12px;
}

.faq-chatbot__label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #110372 !important;
    font-size: 12px;
}

.faq-chatbot__label .required {
    color: #EEAB2E !important;
}

.faq-chatbot__input,
.faq-chatbot__select,
.faq-chatbot__textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #110372 !important;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.faq-chatbot__input:focus,
.faq-chatbot__select:focus,
.faq-chatbot__textarea:focus {
    outline: none;
    border-color: #EEAB2E !important;
}

.faq-chatbot__textarea {
    resize: vertical;
    min-height: 60px;
}

.faq-chatbot__form-actions {
    margin-top: 16px;
}

.faq-chatbot__submit-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background: #EEAB2E !important;
    color: #110372 !important;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.faq-chatbot__submit-btn:hover,
.faq-chatbot__submit-btn:focus {
    transform: translateY(-1px);
}

.faq-chatbot__submit-btn:disabled {
    background: #110372 !important;
    color: #FFFFFF !important;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

/* Form messages */
.faq-chatbot__form-message {
    padding: 10px 12px;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 14px;
}

.faq-chatbot__form-message--success {
    background: #FFFFFF !important;
    border: 1px solid #110372 !important;
    color: #110372 !important;
}

.faq-chatbot__form-message--error {
    background: #FFFFFF !important;
    border: 1px solid #110372 !important;
    color: #110372 !important;
}

/* Input area */
.faq-chatbot__input-area {
    padding: 12px 16px;
    border-top: 1px solid #110372 !important;
    background: #FFFFFF !important;
    border-radius: 0 0 12px 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.faq-chatbot__quick-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.faq-chatbot__quick-btn {
    padding: 6px 12px;
    border: 1px solid #110372 !important;
    border-radius: 16px;
    background: #FFFFFF !important;
    color: #110372 !important;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.faq-chatbot__quick-btn:hover,
.faq-chatbot__quick-btn:focus {
    background: #EEAB2E !important;
    color: #110372 !important;
    border-color: #EEAB2E !important;
    outline: none;
}

.faq-chatbot__restart-btn {
    padding: 6px 12px;
    border: 1px solid #EEAB2E !important;
    border-radius: 16px;
    background: #EEAB2E !important;
    color: #110372 !important;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.faq-chatbot__restart-btn:hover,
.faq-chatbot__restart-btn:focus {
    background: #110372 !important;
    border-color: #110372 !important;
    color: #FFFFFF !important;
    outline: none;
    transform: translateY(-1px);
}

/* Error state */
.faq-chatbot__error {
    text-align: center;
    color: #EEAB2E !important;
    padding: 20px;
    font-style: italic;
}

/* Responsive design */
@media (max-width: 600px) {
    .faq-chatbot {
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        height: 100vh;
        max-width: none;
    }

    .faq-chatbot__header {
        border-radius: 0;
    }

    .faq-chatbot__content {
        padding: 12px;
    }

    .faq-chatbot__input-area {
        padding: 12px;
        border-radius: 0;
    }

    .faq-chatbot__action-buttons {
        flex-direction: column;
    }

    .faq-chatbot__action-btn {
        flex: none;
        min-width: auto;
    }
}

/* Focus indicators for keyboard navigation */
.faq-chatbot button:focus-visible,
.faq-chatbot input:focus-visible,
.faq-chatbot select:focus-visible,
.faq-chatbot textarea:focus-visible {
    outline: 2px solid #EEAB2E !important;
    outline-offset: 2px;
}

/* Sticky Chatbot Button */
.faq-chatbot-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #EEAB2E !important;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: all 0.3s ease;
    border: none;
    overflow: hidden;
    color: #110372 !important;
}

.faq-chatbot-button:hover {
    transform: scale(1.1);
}

.faq-chatbot-button__icon {
    font-size: 24px;
    color: #110372 !important;
    transition: all 0.3s ease;
}

.faq-chatbot-button__text {
    position: absolute;
    right: 70px;
    color: #110372 !important;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.faq-chatbot-button:hover .faq-chatbot-button__text {
    opacity: 1;
    transform: translateX(0);
}

.faq-chatbot-button:hover .faq-chatbot-button__icon {
    transform: rotate(10deg);
}

/* Sticky Chatbot Widget */
.faq-chatbot--sticky {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 500px;
    z-index: 9998;
    margin: 0;
    animation: slideInUp 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
    overflow-y: scroll;
    overflow-x: hidden;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Close button in header */
.faq-chatbot__close-btn {
    position: absolute;
    top: -50px;
    right: 16px;
    background: #FFFFFF !important;
    border: 2px solid #110372 !important;
    color: #110372 !important;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10;
}

.faq-chatbot__close-btn:hover {
    background: #FFFFFF !important;
    border-color: #110372 !important;
    transform: scale(1.15) rotate(90deg);
}

.faq-chatbot__close-btn:focus {
    outline: none;
    background: #FFFFFF !important;
    border-color: #110372 !important;
    transform: scale(1.1);
}

.faq-chatbot__close-btn:active {
    transform: scale(0.95);
    background: #FFFFFF !important;
}

/* Responsive adjustments for sticky widget */
@media (max-width: 600px) {
    .faq-chatbot--sticky {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        animation: slideInUp 0.3s ease;
        max-height: 100vh;
    }

    .faq-chatbot__content {
        max-height: calc(100vh - 140px);
        min-height: 0;
    }

    .faq-chatbot-button {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
    }

    .faq-chatbot-button__icon {
        font-size: 22px;
    }

    .faq-chatbot-button__text {
        display: none;
    }
}

@media (max-width: 420px) {
    .faq-chatbot--sticky {
        width: 100vw;
        right: 0;
    }
}

/* Hide sticky elements when shortcode is present */
body.has-chatbot-shortcode .faq-chatbot-button,
body.has-chatbot-shortcode .faq-chatbot--sticky {
    display: none !important;
}