.ats-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483000;
    font-family: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    pointer-events: none;
}
.ats-chat > * { pointer-events: auto; }

.ats-chat-toggle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #ff6b00 0%, #d55d34 100%);
    box-shadow: 0 6px 18px rgba(213, 93, 52, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ats-chat-toggle:hover { transform: scale(1.06); }
.ats-chat-toggle:focus-visible { outline: 3px solid #fff3e9; outline-offset: 3px; }

.ats-chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    padding: 0 5px;
}

.ats-chat-panel {
    display: none;
    flex-direction: column;
    position: absolute;
    right: 0;
    bottom: 74px;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: 580px;
    max-height: calc(100vh - 110px);
    background: #fffaf6;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(46, 24, 16, 0.22);
    border: 1px solid rgba(213, 93, 52, 0.12);
}
.ats-chat-panel.is-open { display: flex; }

.ats-chat-header {
    background: linear-gradient(135deg, #ff6b00 0%, #d55d34 100%);
    color: #fff;
    padding: 14px 14px 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.ats-chat-header img { width: 32px; height: 32px; }
.ats-chat-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}
.ats-chat-header p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.92;
}
.ats-chat-close {
    margin-left: auto;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.18);
    color: #fff;
    cursor: pointer;
}
.ats-chat-close:hover { background: rgba(255,255,255,0.28); }

.ats-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    background: #fff3e9;
}

.ats-chat-welcome,
.ats-chat-bubble {
    background: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    color: #3a2a24;
    line-height: 1.45;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(46, 24, 16, 0.06);
    word-break: break-word;
}
.ats-chat-bubble { white-space: pre-wrap; }
.ats-chat-welcome { border: 1px solid rgba(213, 93, 52, 0.12); white-space: normal; }

.ats-chat-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.ats-chat-prompts button {
    border: 1px solid rgba(213, 93, 52, 0.28);
    background: #fffaf6;
    color: #ae4d2f;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.ats-chat-prompts button:hover { background: #fff; }

.ats-chat-row { display: flex; gap: 8px; max-width: 92%; }
.ats-chat-row.user { align-self: flex-end; flex-direction: row-reverse; }
.ats-chat-row.assistant { align-self: flex-start; }
.ats-chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    object-fit: contain;
    flex-shrink: 0;
}
.ats-chat-row.user .ats-chat-bubble {
    background: linear-gradient(135deg, #ff6b00 0%, #d55d34 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.ats-chat-row.assistant .ats-chat-bubble a {
    color: #ae4d2f;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ats-chat-loading { display: flex; gap: 4px; align-items: center; }
.ats-chat-loading span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d27d60;
    animation: atsChatPulse 1s infinite ease-in-out;
}
.ats-chat-loading span:nth-child(2) { animation-delay: 0.15s; }
.ats-chat-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes atsChatPulse {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.ats-chat-error { color: #9a3412; font-size: 13px; padding: 0 16px 8px; display: none; }

.ats-chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid rgba(213, 93, 52, 0.12);
    flex-shrink: 0;
}
.ats-chat-input input {
    flex: 1;
    border: 1px solid #ead7cc;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 16px;
    font-family: inherit;
    background: #fffaf6;
    color: #3a2a24;
}
.ats-chat-input input:focus { outline: 2px solid #d27d60; border-color: #d27d60; }
.ats-chat-input button {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff6b00 0%, #d55d34 100%);
    color: #fff;
    cursor: pointer;
}
.ats-chat-input button:disabled { opacity: 0.55; cursor: default; }

@media (max-width: 768px) {
    .ats-chat-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        height: 82vh;
        max-height: 82vh;
        bottom: 78px;
    }
}
