/* ---------------------------------------------
 SaronaDevs AI Chat Widget
 --------------------------------------------- */
#sd-chat-widget{
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: var(--font-global), arial, sans-serif;
}

/* Toggle button */
#sd-chat-toggle{
    display: flex;
    align-items: center;
    gap: 9px;
    height: 56px;
    padding: 0 20px 0 16px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff3b52 0%, #f1273c 45%, #c81030 100%);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(241, 39, 60, .4);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
#sd-chat-toggle:hover,
#sd-chat-toggle:focus{
    background: linear-gradient(135deg, #262626 0%, #151515 55%, #0a0a0a 100%);
    box-shadow: 0 12px 30px rgba(17, 17, 17, .35);
    transform: translateY(-2px);
    outline: none;
}
#sd-chat-toggle-icon{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}
.sd-chat-toggle-label{
    white-space: nowrap;
}
#sd-chat-widget.sd-chat-open #sd-chat-toggle{
    display: none;
}

/* Panel */
#sd-chat-panel{
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(17, 17, 17, .22);
    border: 1px solid rgba(17, 17, 17, .06);
}
#sd-chat-panel[hidden]{
    display: none;
}

/* Header */
#sd-chat-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: #151515;
    color: #fff;
    flex: 0 0 auto;
}
#sd-chat-header-text{
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
#sd-chat-title{
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
}
#sd-chat-title svg{
    flex: 0 0 auto;
    color: #ff4d5e;
}
#sd-chat-subtitle{
    font-size: 12px;
    color: rgba(255, 255, 255, .6);
}
#sd-chat-close{
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease;
}
#sd-chat-close:hover,
#sd-chat-close:focus{
    background: rgba(255, 255, 255, .24);
    outline: none;
}

/* Messages */
#sd-chat-messages{
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f7f8;
}
.sd-chat-msg{
    max-width: 84%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}
.sd-chat-msg-bot{
    align-self: flex-start;
    background: #fff;
    color: #222;
    border: 1px solid rgba(17, 17, 17, .06);
    border-bottom-left-radius: 4px;
}
.sd-chat-msg-user{
    align-self: flex-end;
    background: #f1273c;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.sd-chat-msg-error{
    align-self: center;
    background: rgba(228, 25, 25, .08);
    color: #b91c1c;
    border: 1px solid rgba(228, 25, 25, .18);
    font-size: 12.5px;
    text-align: center;
    max-width: 100%;
}
.sd-chat-msg-success{
    align-self: flex-start;
    background: rgba(16, 163, 74, .08);
    color: #15803d;
    border: 1px solid rgba(16, 163, 74, .2);
    font-size: 12.5px;
    max-width: 100%;
}

/* Lead capture form (shared by the quote-request and chat-summary flows) */
.sd-chat-lead-form{
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(17, 17, 17, .08);
}
.sd-chat-lead-form-title{
    font-size: 13px;
    font-weight: 700;
    color: #151515;
}
.sd-chat-lead-form input,
.sd-chat-lead-form textarea{
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(17, 17, 17, .14);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    color: #222;
    background: #f7f7f8;
    outline: none;
    transition: border-color .15s ease;
    resize: vertical;
}
.sd-chat-lead-form input:focus,
.sd-chat-lead-form textarea:focus{
    border-color: #f1273c;
}
.sd-chat-lead-hp{
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.sd-chat-lead-error{
    font-size: 11.5px;
    color: #b91c1c;
}
.sd-chat-lead-form-actions{
    display: flex;
    gap: 8px;
    margin-top: 2px;
}
.sd-chat-lead-submit{
    flex: 1 1 auto;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: #f1273c;
    color: #fff;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, opacity .15s ease;
}
.sd-chat-lead-submit:hover,
.sd-chat-lead-submit:focus{
    background: #151515;
    outline: none;
}
.sd-chat-lead-submit:disabled{
    opacity: .55;
    cursor: default;
}
.sd-chat-lead-cancel{
    flex: 0 0 auto;
    height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(17, 17, 17, .14);
    border-radius: 999px;
    background: #fff;
    color: #555;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease;
}
.sd-chat-lead-cancel:hover,
.sd-chat-lead-cancel:focus{
    background: #f7f7f8;
    outline: none;
}
.sd-chat-lead-cancel:disabled{
    opacity: .55;
    cursor: default;
}

/* Typing indicator */
.sd-chat-typing{
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}
.sd-chat-typing span{
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(17, 17, 17, .35);
    animation: sd-chat-bounce 1.1s infinite ease-in-out;
}
.sd-chat-typing span:nth-child(2){ animation-delay: .15s; }
.sd-chat-typing span:nth-child(3){ animation-delay: .3s; }
@keyframes sd-chat-bounce{
    0%, 60%, 100%{ transform: translateY(0); opacity: .5; }
    30%{ transform: translateY(-4px); opacity: 1; }
}

/* Suggestions */
#sd-chat-suggestions{
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    background: #f7f7f8;
    border-top: 1px solid rgba(17, 17, 17, .06);
}
.sd-chat-suggestion{
    border: 1px solid rgba(17, 17, 17, .12);
    background: #fff;
    color: #333;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.sd-chat-suggestion:hover,
.sd-chat-suggestion:focus{
    background: #151515;
    border-color: #151515;
    color: #fff;
    outline: none;
}

/* WhatsApp handoff */
#sd-chat-whatsapp{
    flex: 0 0 auto;
    padding: 8px 16px;
    text-align: center;
    background: #fff;
    border-top: 1px solid rgba(17, 17, 17, .06);
}
#sd-chat-whatsapp-link{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #128c4a;
    text-decoration: none;
}
#sd-chat-whatsapp-link:hover,
#sd-chat-whatsapp-link:focus{
    text-decoration: underline;
    outline: none;
}

/* Input row */
#sd-chat-form{
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid rgba(17, 17, 17, .06);
}
#sd-chat-input{
    flex: 1 1 auto;
    height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(17, 17, 17, .12);
    border-radius: 999px;
    font-family: inherit;
    font-size: 13.5px;
    color: #222;
    background: #f7f7f8;
    outline: none;
    transition: border-color .15s ease;
}
#sd-chat-input:focus{
    border-color: #f1273c;
}
#sd-chat-send{
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f1273c;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: background-color .15s ease, opacity .15s ease;
}
#sd-chat-send:hover,
#sd-chat-send:focus{
    background: #151515;
    outline: none;
}
#sd-chat-send:disabled{
    opacity: .5;
    cursor: default;
}

/* Mobile responsiveness */
@media (max-width: 480px){
    #sd-chat-widget{
        right: 16px;
        bottom: 16px;
    }
    #sd-chat-toggle{
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
    }
    .sd-chat-toggle-label{
        display: none;
    }
    #sd-chat-panel{
        position: fixed;
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
        height: min(70vh, 560px);
        max-height: calc(100vh - 24px);
    }
}

/* ── Job results (premium chat job search) ───────────────────────────────
   Rendered by addJobResults() in js/chat-widget.js. Matches the widget's
   existing bot-message styling rather than introducing a second look. */
.sd-chat-jobs { display: flex; flex-direction: column; gap: 8px; }
.sd-chat-jobs-total { margin: 0 0 2px; font-size: 12px; opacity: .7; }
.sd-chat-job {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 12px; border-radius: 10px;
    background: rgba(17, 17, 17, .04); border: 1px solid rgba(17, 17, 17, .08);
    text-decoration: none; color: inherit;
}
.sd-chat-job:hover { background: rgba(17, 17, 17, .07); color: inherit; text-decoration: none; }
.sd-chat-job strong { font-size: 13px; line-height: 1.35; }
.sd-chat-job span { font-size: 12px; opacity: .75; }
.sd-chat-job em { font-size: 11px; opacity: .55; font-style: normal; margin-top: 2px; }
.sd-chat-jobs-all { font-size: 12px; font-weight: 600; margin-top: 2px; }
