/* AMCOB AI chat widget — everything scoped under #amcob-chat-widget to stay clear of Bootstrap/site styles. */
#amcob-chat-widget {
    --acw-navy: #2d3c69;
    --acw-navy-dark: #222e52;
    --acw-gold: #d5c28b;
    --acw-bg: #ffffff;
    --acw-muted: #6b7280;
    --acw-border: #e5e7eb;
    --acw-bubble-bot: #f3f4f6;
    --acw-danger: #b42318;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: #1f2937;
}

#amcob-chat-widget *,
#amcob-chat-widget *::before,
#amcob-chat-widget *::after {
    box-sizing: border-box;
}

#amcob-chat-widget button {
    font-family: inherit;
    cursor: pointer;
}

#amcob-chat-widget .acw-ico {
    width: 1em;
    height: 1em;
    display: block;
}

#amcob-chat-widget [hidden] {
    display: none !important;
}

/* Launcher bubble */
#amcob-chat-widget .acw-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99990;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--acw-navy);
    color: #fff;
    box-shadow: 0 8px 24px rgba(45, 60, 105, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

#amcob-chat-widget .acw-launcher:hover {
    background: var(--acw-navy-dark);
    transform: scale(1.05);
}

#amcob-chat-widget .acw-launcher:focus-visible,
#amcob-chat-widget .acw-icon-btn:focus-visible,
#amcob-chat-widget .acw-primary-btn:focus-visible {
    outline: 3px solid var(--acw-gold);
    outline-offset: 2px;
}

/* Panel */
#amcob-chat-widget .acw-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 99991;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 120px);
    background: var(--acw-bg);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#amcob-chat-widget .acw-header {
    background: var(--acw-navy);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#amcob-chat-widget .acw-header img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
}

#amcob-chat-widget .acw-header-text {
    flex: 1;
    min-width: 0;
}

#amcob-chat-widget .acw-title {
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    font-size: 15px;
    margin: 0;
    color: #fff;
}

#amcob-chat-widget .acw-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin: 0;
}

#amcob-chat-widget .acw-icon-btn {
    background: transparent;
    border: none;
    color: inherit;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 0;
    flex-shrink: 0;
}

#amcob-chat-widget .acw-header .acw-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

#amcob-chat-widget .acw-header .acw-icon-btn[aria-pressed="true"] {
    color: var(--acw-gold);
}

#amcob-chat-widget .acw-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#amcob-chat-widget .acw-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Lead form */
#amcob-chat-widget .acw-form {
    padding: 20px 18px;
    overflow-y: auto;
}

#amcob-chat-widget .acw-form p {
    margin: 0 0 16px;
    color: var(--acw-muted);
}

#amcob-chat-widget .acw-row {
    display: flex;
    gap: 10px;
}

#amcob-chat-widget .acw-field {
    margin-bottom: 12px;
    flex: 1;
    min-width: 0;
}

#amcob-chat-widget .acw-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--acw-navy);
}

#amcob-chat-widget .acw-field input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--acw-border);
    border-radius: 8px;
    font: inherit;
    color: inherit;
    background: #fff;
}

#amcob-chat-widget .acw-field input:focus,
#amcob-chat-widget .acw-composer textarea:focus {
    outline: none;
    border-color: var(--acw-navy);
    box-shadow: 0 0 0 3px rgba(45, 60, 105, 0.15);
}

#amcob-chat-widget .acw-field input[aria-invalid="true"] {
    border-color: var(--acw-danger);
}

#amcob-chat-widget .acw-primary-btn {
    width: 100%;
    border: none;
    border-radius: 25px;
    background: var(--acw-gold);
    color: var(--acw-navy);
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    padding: 11px 20px;
    margin-top: 4px;
    transition: opacity 0.2s ease;
}

#amcob-chat-widget .acw-primary-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

#amcob-chat-widget .acw-error {
    color: var(--acw-danger);
    font-size: 13px;
    margin: 8px 0 0;
}

/* Messages */
#amcob-chat-widget .acw-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#amcob-chat-widget .acw-msg {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

#amcob-chat-widget .acw-msg a {
    color: inherit;
    text-decoration: underline;
}

#amcob-chat-widget .acw-msg-user {
    align-self: flex-end;
    background: var(--acw-navy);
    color: #fff;
    border-bottom-right-radius: 4px;
}

#amcob-chat-widget .acw-msg-assistant {
    align-self: flex-start;
    background: var(--acw-bubble-bot);
    border-bottom-left-radius: 4px;
}

#amcob-chat-widget .acw-msg-interim {
    opacity: 0.6;
    font-style: italic;
}

#amcob-chat-widget .acw-msg-system {
    align-self: center;
    max-width: 100%;
    text-align: center;
    font-size: 12px;
    color: var(--acw-muted);
    background: none;
    padding: 2px 8px;
}

#amcob-chat-widget .acw-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

#amcob-chat-widget .acw-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--acw-muted);
    animation: acw-bounce 1.2s infinite ease-in-out;
}

#amcob-chat-widget .acw-typing span:nth-child(2) { animation-delay: 0.15s; }
#amcob-chat-widget .acw-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes acw-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

#amcob-chat-widget .acw-restart {
    align-self: center;
    border: 1px solid var(--acw-navy);
    background: #fff;
    color: var(--acw-navy);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
}

/* Voice bar */
#amcob-chat-widget .acw-voice-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #f8f6ee;
    border-top: 1px solid var(--acw-border);
    font-size: 13px;
    color: var(--acw-navy);
}

#amcob-chat-widget .acw-voice-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--acw-gold);
    flex-shrink: 0;
}

#amcob-chat-widget .acw-voice-dot.acw-active {
    background: #16a34a;
    animation: acw-pulse 1s infinite ease-in-out;
}

@keyframes acw-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
}

#amcob-chat-widget .acw-voice-bar span {
    flex: 1;
}

#amcob-chat-widget .acw-voice-end {
    border: none;
    background: var(--acw-danger);
    color: #fff;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Composer */
#amcob-chat-widget .acw-composer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid var(--acw-border);
    flex-shrink: 0;
}

#amcob-chat-widget .acw-composer textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--acw-border);
    border-radius: 18px;
    padding: 8px 14px;
    font: inherit;
    max-height: 110px;
    min-height: 38px;
    line-height: 1.4;
}

#amcob-chat-widget .acw-composer .acw-icon-btn {
    width: 38px;
    height: 38px;
    color: var(--acw-navy);
}

#amcob-chat-widget .acw-composer .acw-icon-btn:hover:not(:disabled) {
    background: #eef0f6;
}

#amcob-chat-widget .acw-composer .acw-icon-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

#amcob-chat-widget .acw-composer .acw-mic[aria-pressed="true"] {
    background: var(--acw-danger);
    color: #fff;
}

#amcob-chat-widget .acw-footnote {
    text-align: center;
    font-size: 11px;
    color: var(--acw-muted);
    padding: 0 12px 8px;
}

@media (max-width: 480px) {
    #amcob-chat-widget .acw-launcher {
        right: 16px;
        bottom: 16px;
    }

    #amcob-chat-widget .acw-panel {
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100%;
        max-height: 100dvh;
        border-radius: 0;
    }

    #amcob-chat-widget .acw-row {
        flex-direction: column;
        gap: 0;
    }
}
