/* Chat Widget Container */
.waa-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Toggle Button */
.waa-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0073aa;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.waa-chat-toggle:hover {
    transform: scale(1.1);
    background: #006291;
}

.waa-chat-toggle-icon {
    font-size: 24px;
    color: white;
}

/* Chat Interface */
.waa-chat-interface {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.waa-chat-widget.position-left .waa-chat-interface {
    right: auto;
    left: 0;
}

.waa-chat-interface.active {
    display: flex;
}

/* Chat Header */
.waa-chat-header {
    padding: 15px 20px;
    background: #0073aa;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.waa-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.waa-chat-close .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waa-chat-close:hover {
    opacity: 0.8;
}

.waa-chat-header .dashicons {
    opacity: 1;
    visibility: visible !important;
}

/* Chat Messages */
.waa-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.waa-message {
    max-width: 80%;
    margin-bottom: 10px;
}

.waa-user-message {
    align-self: flex-end;
}

.waa-assistant-message {
    align-self: flex-start;
}

.waa-message-content {
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.waa-message-content > *:first-child {
    margin-top: 0;
}

.waa-message-content > *:last-child {
    margin-bottom: 0;
}

.waa-user-message .waa-message-content {
    background: #0073aa;
    color: white;
}

.waa-assistant-message .waa-message-content {
    background: #f0f0f0;
    color: #333;
}

/* Chat Input */
.waa-chat-input-container {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.waa-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 40px;
}

.waa-chat-input:focus {
    outline: none;
    border-color: #0073aa;
}

.waa-chat-send {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.waa-chat-send:hover {
    background: #006291;
}

.waa-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading Animation */
.waa-typing-indicator {
    padding: 10px 15px;
    background: #f0f0f0;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.waa-typing-dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.waa-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.waa-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.waa-message-content a {
    color: #0073aa;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.waa-message-content a:hover {
    border-bottom-color: #0073aa;
}

.waa-related-articles {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.waa-related-articles h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.waa-related-articles ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.waa-related-articles li {
    margin: 5px 0;
    padding-left: 15px;
    position: relative;
}

.waa-related-articles li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #0073aa;
}

.waa-related-articles a {
    color: #0073aa;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.waa-related-articles a:hover {
    border-bottom-color: #0073aa;
}

.waa-message-content a:visited {
    color: #005177;
}

/* Style for the article emoji */
.waa-message-content {
    line-height: 1.5;
}

/* Markdown styles */
.waa-message-content h1,
.waa-message-content h2,
.waa-message-content h3,
.waa-message-content h4 {
    margin: 1em 0 0.5em;
    font-weight: 600;
    line-height: 1.3;
}

.waa-message-content h1 { font-size: 1.4em; }
.waa-message-content h2 { font-size: 1.3em; }
.waa-message-content h3 { font-size: 1.2em; }
.waa-message-content h4 { font-size: 1.1em; }

.waa-message-content p {
    margin: 0.8em 0;
}

.waa-message-content ul,
.waa-message-content ol {
    margin: 0.8em 0;
    padding-left: 2em;
}

.waa-message-content ul {
    list-style-type: disc;
}

.waa-message-content ol {
    list-style-type: decimal;
}

.waa-message-content li {
    margin: 0.3em 0;
    padding-left: 0.3em;
}

.waa-message-content li > ul,
.waa-message-content li > ol {
    margin: 0.2em 0 0.2em 1em;
}

.waa-message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.waa-message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.waa-message-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.waa-message-content strong {
    font-weight: 600;
}

.waa-message-content em {
    font-style: italic;
}

.waa-contact-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.waa-contact-form-inner {
    width: 100%;
    max-width: 300px;
    text-align: center;
}

.waa-contact-form h4 {
    margin-bottom: 15px;
    color: #333;
}

.waa-contact-form input {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.waa-contact-submit {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

.waa-contact-submit:hover {
    background: #006291;
}

.waa-contact-description {
    margin-bottom: 15px;
    color: #666;
    font-size: 0.9em;
}

.waa-privacy-notice {
    margin-top: 10px;
    font-size: 0.8em;
    color: #666;
    text-align: center;
}

.waa-privacy-notice a {
    color: #0073aa;
    text-decoration: none;
}

.waa-privacy-notice a:hover {
    text-decoration: underline;
}

.waa-contact-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.waa-contact-skip {
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
}

.waa-contact-skip:hover {
    background: #f5f5f5;
}

.waa-contact-submit {
    flex: 2;
}

/* Custom Position Overrides */
.waa-chat-widget.position-right {
    bottom: 20px;
    right: 20px;
    left: auto;
}
.waa-chat-widget.position-left {
    bottom: 20px;
    left: 20px !important;
    right: auto !important;
}
.waa-chat-widget.position-bottom-right {
    bottom: 20px;
    right: 20px;
    left: auto;
}
.waa-chat-widget.position-bottom-left {
    bottom: 20px;
    left: 20px;
    right: auto;
}

/* Chat Toggle Icon Image Style */
.waa-chat-toggle-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}