/* Cash Box Pawn — Roxy AI Agent Widget v1.2 */

#cbp-root, #cbp-root * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* ── FLOATING CONTAINER ── */
#cbp-root {
    position: fixed;
    bottom: 128px;
    right: 56px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* ── PANEL ── */
#cbp-panel {
    width: min(400px, calc(100vw - 28px));
    background: #fff;
    border-radius: 18px;
    border: 1px solid #d4b896;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 60px rgba(61,31,10,0.28);
    transform-origin: bottom right;
    animation: cbpPanelIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
    max-height: 680px;
}
#cbp-panel.cbp-hidden { display: none; }

@keyframes cbpPanelIn {
    from { opacity: 0; transform: scale(0.88) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── HEADER ── */
.cbp-header {
    background: linear-gradient(135deg, #6B3A1F 0%, #8B4A25 100%) !important;
    padding: 12px 14px 12px 16px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
    min-height: 72px !important;
    box-sizing: border-box !important;
    width: 100% !important;
}
.cbp-header-logo {
    height: 38px !important;
    width: auto !important;
    max-width: 130px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
    display: block !important;
}
.cbp-header-info {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}
.cbp-header-info h3 {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: #fff !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 0 !important;
    margin: 0 !important;
}
.cbp-header-info p {
    font-size: 11px !important;
    color: rgba(255,255,255,0.75) !important;
    margin-top: 2px !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 0 !important;
}
.cbp-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    display: inline-block;
    flex-shrink: 0;
    animation: cbpBlink 1.4s infinite;
}
@keyframes cbpBlink { 0%,100%{opacity:1} 50%{opacity:0.3} }

.cbp-close-btn {
    background: rgba(255,255,255,0.15) !important;
    border: none !important;
    cursor: pointer !important;
    color: #fff !important;
    font-size: 16px !important;
    line-height: 1 !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: background 0.15s !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}
.cbp-close-btn:hover { background: rgba(255,255,255,0.3); }

/* ── MESSAGES ── */
.cbp-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 16px 12px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    min-height: 240px !important;
    max-height: 380px !important;
    background: #fdf9f5 !important;
    scroll-behavior: smooth !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
.cbp-messages::-webkit-scrollbar { width: 4px; }
.cbp-messages::-webkit-scrollbar-thumb { background: #c4a882; border-radius: 4px; }

/* ── MESSAGE ROWS ── */
.cbp-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: cbpFadeUp 0.22s ease;
    width: 100%;
}
@keyframes cbpFadeUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.cbp-agent { justify-content: flex-start; }
.cbp-user  { justify-content: flex-end; }

/* Roxy avatar — full PNG no crop */
.cbp-av {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
}
.cbp-av img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    object-position: bottom center;
}

.cbp-msg-body {
    max-width: 78%;
    min-width: 0;
    overflow: hidden;
}

.cbp-bubble {
    padding: 12px 14px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.55 !important;
    border-radius: 18px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: auto !important;
    white-space: normal !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}
.cbp-agent .cbp-bubble {
    background: #fff !important;
    color: #1a0e05 !important;
    border: 1.5px solid #d4b896 !important;
    border-bottom-left-radius: 4px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07) !important;
}
.cbp-user .cbp-bubble {
    background: linear-gradient(135deg, #E8640A, #c54e00) !important;
    color: #fff !important;
    border-bottom-right-radius: 4px !important;
    font-weight: 600 !important;
    border: none !important;
}
.cbp-bubble strong { font-weight: 800; }

.cbp-msg-time {
    font-size: 11px;
    font-weight: 400;
    color: #9a7a5a;
    margin-top: 5px;
    padding: 0 2px;
}
.cbp-agent .cbp-msg-time { text-align: left; }
.cbp-user  .cbp-msg-time { text-align: right; }

.cbp-msg-img {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 6px;
    display: block;
}

/* ── TYPING DOTS ── */
.cbp-typing-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.cbp-typing {
    display: flex;
    gap: 5px;
    padding: 12px 15px;
    background: #fff;
    border: 1.5px solid #d4b896;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}
.cbp-typing span {
    width: 7px;
    height: 7px;
    background: #c4a882;
    border-radius: 50%;
    animation: cbpBounce 1s infinite;
}
.cbp-typing span:nth-child(2) { animation-delay: 0.15s; }
.cbp-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes cbpBounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* ── QUICK REPLIES ── */
.cbp-qr {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 6px 14px 10px;
    background: #fdf9f5;
    flex-shrink: 0;
}
.cbp-qr-btn {
    background: #f0ebe4 !important;
    border: 1.5px solid #c4a882 !important;
    color: #3d1f0a !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    white-space: nowrap !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}
.cbp-qr-btn:hover { background: #5C2E0F; color: #fff; border-color: #5C2E0F; }

/* ── PHOTO BAR ── */
.cbp-photo-bar {
    display: none;
    padding: 7px 14px;
    background: #fdf9f5;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    border-top: 1px solid #ecddc8;
}
.cbp-photo-bar img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; border: 1px solid #d4b896; }
.cbp-photo-bar span { font-size: 12px; font-weight: 500; color: #6a4a2a; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbp-photo-bar button { background: none; border: none; cursor: pointer; color: #c54e00; font-size: 18px; line-height: 1; padding: 2px; }

/* ── INPUT AREA ── */
.cbp-input-area {
    padding: 10px 14px !important;
    border-top: 1.5px solid #ecddc8 !important;
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
    background: #fff !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}
.cbp-input {
    flex: 1 !important;
    padding: 10px 16px !important;
    border-radius: 22px !important;
    border: 1.5px solid #c4a882 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1a0e05 !important;
    background: #fdf9f5 !important;
    outline: none !important;
    transition: border-color 0.15s !important;
    resize: none !important;
    max-height: 80px !important;
    line-height: 1.45 !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}
.cbp-input:focus { border-color: #E8640A; }
.cbp-input::placeholder { color: #a08060; font-weight: 400; }
.cbp-input:disabled { opacity: 0.5; }

.cbp-photo-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0ebe4;
    border: 1.5px solid #c4a882;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #6a4a2a;
    transition: all 0.15s;
}
.cbp-photo-btn:hover { background: #5C2E0F; color: #fff; border-color: #5C2E0F; }
.cbp-photo-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cbp-photo-btn svg { display: block; }

.cbp-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #E8640A;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}
.cbp-send-btn:hover { background: #c54e00; transform: scale(1.06); }
.cbp-send-btn:disabled { background: #c4a882; cursor: not-allowed; transform: none; }
.cbp-send-btn svg { width: 15px; height: 15px; fill: white; display: block; }

/* ── RESET BUTTON ── */
.cbp-reset-btn {
    display: none;
    background: none;
    border: 1.5px solid #c4a882;
    color: #6a4a2a;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    margin: 0 14px 10px;
    transition: all 0.15s;
    width: calc(100% - 28px);
    text-align: center;
}
.cbp-reset-btn:hover { background: #6a4a2a; color: #fff; }

/* ── DISCLAIMER ── */
.cbp-disclaimer {
    padding: 7px 14px 9px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: #5C2E0F !important;
    text-align: center !important;
    background: #fff !important;
    line-height: 1.5 !important;
    border-top: 1px solid #ecddc8 !important;
    flex-shrink: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* ── PROMO BUBBLE ── */
.cbp-promo {
    background: linear-gradient(135deg, #6B3A1F 0%, #8B4A25 100%) !important;
    color: #fff !important;
    padding: 12px 36px 12px 15px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    max-width: 240px !important;
    line-height: 1.5 !important;
    box-shadow: 0 4px 20px rgba(61,31,10,0.4) !important;
    cursor: pointer !important;
    position: relative !important;
    animation: cbpFadeUp 0.4s ease !important;
    box-sizing: border-box !important;
}
.cbp-promo strong { color: #F4A123 !important; font-weight: 800 !important; }
.cbp-promo-close {
    position: absolute !important;
    top: 10px !important;
    right: 12px !important;
    background: none !important;
    border: none !important;
    color: rgba(255,255,255,0.7) !important;
    cursor: pointer !important;
    font-size: 16px !important;
    line-height: 1 !important;
    padding: 4px !important;
}
.cbp-promo-close:hover { color: #fff; }
.cbp-promo.cbp-hidden { display: none; }

/* ── LAUNCHER — full PNG, no circle ── */
.cbp-launcher {
    width: 82px;
    height: 82px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 16px rgba(232,100,10,0.5));
    transition: transform 0.2s, filter 0.2s;
    padding: 0;
}
.cbp-launcher:hover {
    transform: scale(1.08) translateY(-3px);
    filter: drop-shadow(0 6px 22px rgba(232,100,10,0.65));
}
.cbp-launcher img {
    width: 82px;
    height: 82px;
    object-fit: contain;
    object-position: bottom center;
    display: block;
}
.cbp-launcher-badge {
    position: absolute;
    top: 4px;
    right: 2px;
    background: #c0392b;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    letter-spacing: -0.5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ── MOBILE ── */


/* ══════════════════════════════════════════════════════════
   THEME OVERRIDE BLOCK — uses #cbp-root specificity to beat
   any WordPress theme CSS that strips our padding/layout
══════════════════════════════════════════════════════════ */

#cbp-root .cbp-bubble {
    padding: 12px 14px !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
    display: block !important;
    margin: 0 !important;
}
#cbp-root .cbp-agent .cbp-bubble {
    background: #fff !important;
    color: #1a0e05 !important;
    border: 1.5px solid #d4b896 !important;
    border-bottom-left-radius: 4px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07) !important;
}
#cbp-root .cbp-user .cbp-bubble {
    background: linear-gradient(135deg, #E8640A, #c54e00) !important;
    color: #fff !important;
    border: none !important;
    border-bottom-right-radius: 4px !important;
    font-weight: 600 !important;
}
#cbp-root .cbp-messages {
    padding: 16px 12px 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
}
#cbp-root .cbp-qr {
    padding: 6px 14px 10px !important;
    justify-content: center !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 7px !important;
    box-sizing: border-box !important;
    width: 100% !important;
}
#cbp-root .cbp-qr-btn {
    padding: 6px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 20px !important;
    border: 1.5px solid #c4a882 !important;
    background: #f0ebe4 !important;
    color: #3d1f0a !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    display: inline-block !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}
#cbp-root .cbp-qr-btn:hover {
    background: #5C2E0F !important;
    color: #fff !important;
    border-color: #5C2E0F !important;
}
#cbp-root .cbp-input-area {
    padding: 10px 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    background: #fff !important;
}
#cbp-root .cbp-input {
    padding: 10px 16px !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
    color: #1a0e05 !important;
}
#cbp-root .cbp-disclaimer {
    padding: 8px 16px 10px !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #5C2E0F !important;
    line-height: 1.5 !important;
    text-align: center !important;
    box-sizing: border-box !important;
    display: block !important;
    width: 100% !important;
    background: #fff !important;
}
#cbp-root .cbp-header {
    padding: 12px 14px 12px 16px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-height: 72px !important;
    box-sizing: border-box !important;
    background: linear-gradient(135deg, #6B3A1F 0%, #8B4A25 100%) !important;
}
#cbp-root .cbp-header-logo {
    height: 38px !important;
    width: auto !important;
    max-width: 130px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}
#cbp-root .cbp-header-info {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}
#cbp-root .cbp-header-info h3 {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #fff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1.3 !important;
}
#cbp-root .cbp-header-info p {
    font-size: 11px !important;
    color: rgba(255,255,255,0.75) !important;
    margin-top: 2px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}
#cbp-root .cbp-close-btn {
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,0.15) !important;
    border: none !important;
    color: #fff !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
}
#cbp-root .cbp-reset-btn {
    padding: 7px 14px !important;
    box-sizing: border-box !important;
    width: calc(100% - 28px) !important;
    margin: 0 14px 10px !important;
}
#cbp-root .cbp-promo {
    padding: 12px 36px 12px 15px !important;
    box-sizing: border-box !important;
    color: #fff !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    font-weight: 500 !important;
}
#cbp-root .cbp-promo strong {
    color: #F4A123 !important;
    font-weight: 800 !important;
}

/* Mobile overrides with #cbp-root specificity */
@media (max-width: 560px) {
    #cbp-root { bottom: 110px !important; right: 10px !important; }
    #cbp-root #cbp-panel { width: calc(100vw - 20px) !important; max-width: calc(100vw - 20px) !important; }
    #cbp-root .cbp-messages { max-height: 48vh !important; }
    #cbp-root .cbp-bubble { padding: 10px 12px !important; font-size: 13.5px !important; }
    #cbp-root .cbp-input-area { padding: 8px 10px !important; gap: 8px !important; }
    #cbp-root .cbp-input { padding: 9px 12px !important; font-size: 13px !important; }
    #cbp-root .cbp-header { padding: 10px 12px 10px 13px !important; gap: 8px !important; min-height: 68px !important; }
    #cbp-root .cbp-header-logo { height: 34px !important; max-width: 110px !important; }
    #cbp-root .cbp-header-info h3 { font-size: 13px !important; }
    #cbp-root .cbp-header-info p { font-size: 10.5px !important; }
    #cbp-root .cbp-close-btn { width: 28px !important; height: 28px !important; font-size: 14px !important; }
    #cbp-root .cbp-launcher { width: 70px !important; height: 70px !important; }
    #cbp-root .cbp-launcher img { width: 70px !important; height: 70px !important; }
    #cbp-root .cbp-qr-btn { font-size: 12px !important; padding: 5px 12px !important; }
    #cbp-root .cbp-disclaimer { font-size: 11px !important; }
}
