/* SEO Agent — Catalog Chat Widget */

:root {
    --seo-chat-primary: #5a9a1f;
    --seo-chat-primary-dark: #3d7a0f;
    --seo-chat-primary-light: #7cb82f;
    --seo-chat-secondary: #2a9bb0;
    --seo-chat-secondary-dark: #1e7a8a;
    --seo-chat-radius: 16px;
}

#seo-catalog-chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--seo-chat-primary) 0%, var(--seo-chat-secondary) 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(90, 154, 31, 0.45);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
#seo-catalog-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(90, 154, 31, 0.55);
}
#seo-catalog-chat-fab svg {
    transition: transform 0.3s ease;
}
#seo-catalog-chat-fab.open svg {
    transform: rotate(90deg) scale(0);
}
#seo-catalog-chat-fab .fab-close {
    position: absolute;
    transform: rotate(-90deg) scale(0);
    transition: transform 0.3s ease;
}
#seo-catalog-chat-fab.open .fab-close {
    transform: rotate(0deg) scale(1);
}

/* Position: left */
#seo-catalog-chat-wrap.seo-chat-left #seo-catalog-chat-fab {
    right: auto;
    left: 20px;
}
#seo-catalog-chat-wrap.seo-chat-left #seo-catalog-chat-window {
    right: auto;
    left: 20px;
}

#seo-catalog-chat-window {
    position: fixed;
    bottom: 86px;
    right: 20px;
    width: 370px;
    max-height: 520px;
    background: #fff;
    border-radius: var(--seo-chat-radius);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 100000;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    display: flex;
}
#seo-catalog-chat-window.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
#seo-catalog-chat-header {
    background: linear-gradient(135deg, var(--seo-chat-primary) 0%, var(--seo-chat-secondary) 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#seo-catalog-chat-header h6 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
#seo-catalog-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}
#seo-catalog-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}
#seo-catalog-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    min-height: 280px;
    max-height: 340px;
    background: #f8fafc;
    scroll-behavior: smooth;
}
.seo-cat-msg {
    margin-bottom: 10px;
    display: flex;
    animation: seo-msg-in 0.25s ease;
}
@keyframes seo-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.seo-cat-msg.user {
    justify-content: flex-end;
}
.seo-cat-msg .bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.seo-cat-msg.user .bubble {
    background: linear-gradient(135deg, var(--seo-chat-primary) 0%, var(--seo-chat-secondary) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.seo-cat-msg.assistant .bubble {
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.seo-cat-msg.assistant .bubble strong {
    color: #0f172a;
}
.seo-cat-msg.assistant .bubble a {
    color: var(--seo-chat-primary-dark);
    text-decoration: none;
}
.seo-cat-msg.assistant .bubble a:hover {
    text-decoration: underline;
}
.seo-typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}
.seo-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: seo-dot-bounce 1.4s infinite ease-in-out;
}
.seo-typing-dots span:nth-child(2) {
    animation-delay: 0.16s;
}
.seo-typing-dots span:nth-child(3) {
    animation-delay: 0.32s;
}
@keyframes seo-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}
.seo-contact-card {
    margin-top: 6px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
    border: 1px solid #d1e7dd;
    border-radius: 14px;
    padding: 12px 14px;
    animation: seo-msg-in 0.3s ease;
}
.seo-contact-card-title {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}
.seo-contact-card a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin-bottom: 4px;
    border-radius: 10px;
    font-size: 13px;
    color: #334155;
    text-decoration: none;
    transition: background 0.15s;
}
.seo-contact-card a:last-child {
    margin-bottom: 0;
}
.seo-contact-card a:hover {
    background: rgba(124, 184, 47, 0.1);
    color: var(--seo-chat-primary-dark);
}
.seo-contact-card a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--seo-chat-primary);
}
#seo-catalog-chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    background: #fff;
    flex-shrink: 0;
}
#seo-catalog-chat-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
#seo-catalog-chat-input:focus {
    border-color: var(--seo-chat-primary);
}
#seo-catalog-chat-input:disabled {
    background: #f8fafc;
    color: #94a3b8;
}
#seo-catalog-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--seo-chat-primary) 0%, var(--seo-chat-secondary) 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s;
}
#seo-catalog-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
}
#seo-catalog-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
#seo-catalog-chat-footer {
    padding: 4px 12px 6px;
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
#seo-catalog-chat-footer a {
    color: #94a3b8;
    text-decoration: none;
}
#seo-catalog-chat-footer a:hover {
    color: var(--seo-chat-primary-dark);
    text-decoration: underline;
}
#seo-catalog-chat-footer-contact {
    color: var(--seo-chat-primary-dark);
    cursor: pointer;
    font-weight: 500;
    border: none;
    background: none;
    font-size: 10px;
    padding: 0;
    text-decoration: none;
}
#seo-catalog-chat-footer-contact:hover {
    text-decoration: underline;
}
@media (max-width: 480px) {
    #seo-catalog-chat-window {
        width: calc(100vw - 16px);
        right: 8px;
        left: 8px;
        bottom: 8px;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 12px;
    }
    #seo-catalog-chat-messages {
        max-height: none;
        min-height: 0;
        flex: 1;
    }
    #seo-catalog-chat-fab {
        bottom: 16px;
        right: 16px;
    }
    #seo-catalog-chat-wrap.seo-chat-left #seo-catalog-chat-fab {
        right: auto;
        left: 16px;
    }
    #seo-catalog-chat-window.visible ~ #seo-catalog-chat-fab {
        display: none;
    }
}
