/* Samm X Assistant - Modern Chatbot Widget */
.sammx-chatbot-root {
    --sx-primary: var(--color-primary, #0D26E0);
    --sx-navy: var(--color-navy-blue, #291D89);
    --sx-light-blue: var(--color-light-blue, #F0F4FF);
    --sx-border: #E2E8F0;
    --sx-text: #0F172A;
    --sx-muted: #64748B;
    font-family: 'Inter', sans-serif;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9990;
}

.sammx-chat-launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 20px 0 16px;
    border-radius: 9999px;
    border: 1px solid var(--sx-primary);
    background-color: var(--sx-primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(13, 38, 224, 0.24), 0 2px 8px rgba(15, 23, 42, 0.10);
    transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sammx-chat-launcher:hover {
    background-color: var(--sx-navy);
    border-color: var(--sx-navy);
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(13, 38, 224, 0.30), 0 4px 12px rgba(15, 23, 42, 0.12);
}

.sammx-chat-launcher:focus-visible {
    outline: 3px solid #8f92ff;
    outline-offset: 3px;
}

.sammx-chat-launcher .sx-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 9999px;
    background: #22C55E;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.28);
}

.sammx-chat-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 392px;
    max-width: calc(100vw - 24px);
    height: 560px;
    max-height: calc(100vh - 110px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--sx-border);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22), 0 4px 16px rgba(13, 38, 224, 0.08);
    overflow: hidden;
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.sammx-chat-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.sammx-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    background-color: var(--sx-primary);
    color: #ffffff;
    flex-shrink: 0;
}

.sammx-chat-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.sammx-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #ffffff;
    padding: 5px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.sammx-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sammx-chat-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.sammx-chat-subtitle {
    margin: 2px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.84);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sammx-chat-subtitle-dot {
    width: 7px;
    height: 7px;
    border-radius: 9999px;
    background: #4ADE80;
    display: inline-block;
}

.sammx-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sammx-agent-pill {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 9999px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease;
    white-space: nowrap;
}

.sammx-agent-pill:hover {
    background: rgba(255, 255, 255, 0.26);
}

.sammx-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease;
}

.sammx-close-btn:hover {
    background: rgba(255, 255, 255, 0.24);
}

.sammx-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #F8FAFC;
}

.sammx-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.sammx-msg-row {
    display: flex;
    flex-direction: column;
    max-width: 86%;
}

.sammx-msg-row.is-bot {
    align-self: flex-start;
}

.sammx-msg-row.is-user {
    align-self: flex-end;
}

.sammx-msg-bubble {
    padding: 11px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-line;
    word-break: break-word;
}

.sammx-msg-row.is-bot .sammx-msg-bubble {
    background: #ffffff;
    color: var(--sx-text);
    border: 1px solid var(--sx-border);
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.sammx-msg-row.is-user .sammx-msg-bubble {
    background-color: var(--sx-primary);
    color: #ffffff;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 8px rgba(13, 38, 224, 0.18);
}

.sammx-msg-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.sammx-msg-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 9999px;
    background: var(--sx-light-blue);
    color: var(--sx-primary);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(13, 38, 224, 0.16);
    text-decoration: none;
    transition: background 0.16s ease, color 0.16s ease;
}

.sammx-msg-link:hover {
    background: var(--sx-primary);
    color: #ffffff;
}

.sammx-inline-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 4px;
    max-width: 94%;
    align-self: flex-start;
}

.sammx-suggestion-chip {
    background-color: #ffffff;
    color: var(--sx-primary);
    border: 1px solid rgba(13, 38, 224, 0.24);
    border-radius: 9999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
    text-align: left;
}

.sammx-suggestion-chip:hover {
    background-color: var(--sx-primary);
    color: #ffffff;
    border-color: var(--sx-primary);
}

.sammx-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 12px;
    background: #ffffff;
    border-top: 1px solid #EEF2F7;
    flex-shrink: 0;
}

.sammx-chat-input {
    flex: 1;
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--sx-border);
    background: #F8FAFC;
    color: var(--sx-text);
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.sammx-chat-input:focus {
    border-color: var(--sx-primary);
    background: #ffffff;
}

.sammx-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background-color: var(--sx-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.18s ease, opacity 0.18s ease;
}

.sammx-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.sammx-send-btn:not(:disabled):hover {
    background-color: var(--sx-navy);
}

/* Typing indicator */
.sammx-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}

.sammx-typing span {
    width: 7px;
    height: 7px;
    border-radius: 9999px;
    background: #94A3B8;
    animation: sxTyping 1.2s infinite ease-in-out;
}

.sammx-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.sammx-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes sxTyping {
    0%, 80%, 100% {
        transform: scale(0.75);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Inline Talk to Real Agent / Inquiry View */
.sammx-inquiry-panel {
    flex: 1;
    display: none;
    flex-direction: column;
    padding: 16px;
    background: #F8FAFC;
    overflow-y: auto;
    gap: 12px;
}

.sammx-inquiry-panel.is-active {
    display: flex;
}

.sammx-chat-body.is-hidden {
    display: none;
}

.sammx-inquiry-back {
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--sx-primary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sammx-inquiry-card {
    background: #ffffff;
    border: 1px solid var(--sx-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.sammx-inquiry-card h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--sx-text);
}

.sammx-inquiry-card p {
    margin: 0;
    font-size: 12.5px;
    color: var(--sx-muted);
    line-height: 1.45;
}

.sammx-field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.sammx-field-control {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--sx-border);
    background: #F8FAFC;
    font-size: 13px;
    color: var(--sx-text);
    font-family: inherit;
    outline: none;
}

.sammx-field-control:focus {
    border-color: var(--sx-primary);
    background: #ffffff;
}

.sammx-inquiry-submit {
    width: 100%;
    height: 42px;
    border-radius: 11px;
    border: none;
    background-color: var(--sx-primary);
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, opacity 0.18s ease;
}

.sammx-inquiry-submit:hover:not(:disabled) {
    background-color: var(--sx-navy);
}

.sammx-inquiry-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.sammx-inquiry-error {
    color: #DC2626;
    font-size: 12px;
    margin: 0;
    display: none;
}

.sammx-inquiry-error.is-visible {
    display: block;
}

@media (max-width: 480px) {
    .sammx-chatbot-root {
        right: 12px;
        bottom: 12px;
    }

    .sammx-chat-launcher span.sx-launcher-label,
    .sammx-chat-launcher .sx-status-dot {
        display: none;
    }

    .sammx-chat-launcher {
        width: 52px;
        height: 52px;
        padding: 0;
        justify-content: center;
    }

    .sammx-chat-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 96px);
        bottom: 68px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sammx-chat-panel,
    .sammx-chat-launcher,
    .sammx-typing span {
        transition: none;
        animation: none;
    }
}
