/*--------------------------------------------------------------
# White Pebble Global - floating chat widget
--------------------------------------------------------------*/
.wpgc {
    --wpgc-navy: #0d2c47;
    --wpgc-navy-2: #164a73;
    --wpgc-accent: #feb900;
    --wpgc-accent-dark: #e5a600;
    --wpgc-bg: #f3f6fa;
    --wpgc-text: #1e2f3d;
    --wpgc-muted: #6b7c8c;
    --wpgc-border: #dde4ec;
    --wpgc-danger: #c0392b;
    font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--wpgc-text);
}

.wpgc *, .wpgc *::before, .wpgc *::after { box-sizing: border-box; }
.wpgc [hidden] { display: none !important; }
.wpgc svg { fill: currentColor; }

/* Keep the site's "back to top" button clear of the chat button */
.scroll-top.active { bottom: 98px !important; inset-inline-end: 24px !important; }

/* ---------- Launcher ---------- */
.wpgc-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100000;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--wpgc-accent) 0%, #ffcf4a 100%);
    color: var(--wpgc-navy);
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 28px rgba(13, 44, 71, .35), 0 2px 6px rgba(0, 0, 0, .15);
    transition: transform .25s ease, box-shadow .25s ease;
}
.wpgc-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 32px rgba(13, 44, 71, .4), 0 2px 8px rgba(0, 0, 0, .18); }
.wpgc-launcher:focus-visible { outline: 3px solid var(--wpgc-navy); outline-offset: 3px; }
.wpgc-launcher svg { width: 30px; height: 30px; grid-area: 1 / 1; transition: transform .3s ease, opacity .25s ease; }
.wpgc-launcher .wpgc-i-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.wpgc.is-open .wpgc-launcher .wpgc-i-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.wpgc.is-open .wpgc-launcher .wpgc-i-close { opacity: 1; transform: none; }
.wpgc:not(.is-open) .wpgc-launcher::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--wpgc-accent);
    animation: wpgc-pulse 2.8s ease-out infinite;
}

@keyframes wpgc-pulse {
    0% { transform: scale(1); opacity: .7; }
    70%, 100% { transform: scale(1.55); opacity: 0; }
}

/* ---------- Teaser bubble ---------- */
.wpgc-teaser {
    position: fixed;
    right: 24px;
    bottom: 100px;
    z-index: 100000;
    max-width: 240px;
    padding: 12px 34px 12px 16px;
    background: #fff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 10px 30px rgba(13, 44, 71, .22);
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: wpgc-rise .45s ease both;
}
.wpgc-teaser strong { color: var(--wpgc-navy); font-size: 14px; }
.wpgc-teaser span { color: var(--wpgc-muted); font-size: 13px; }
.wpgc-teaser-close { position: absolute; top: 4px; right: 8px; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--wpgc-muted); cursor: pointer; }

/* ---------- Panel ---------- */
.wpgc-panel {
    position: fixed;
    right: 24px;
    bottom: 100px;
    z-index: 100000;
    width: 392px;
    max-width: calc(100vw - 32px);
    height: 620px;
    max-height: calc(100vh - 124px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(13, 44, 71, .35), 0 4px 14px rgba(0, 0, 0, .12);
    padding: 0;
    margin: 0;
    transform-origin: bottom right;
    animation: wpgc-open .28s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes wpgc-open {
    from { opacity: 0; transform: translateY(16px) scale(.96); }
    to { opacity: 1; transform: none; }
}
@keyframes wpgc-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* Header */
.wpgc-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 16px 18px;
    color: #fff;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(254, 185, 0, .22) 0%, rgba(254, 185, 0, 0) 55%),
        linear-gradient(135deg, var(--wpgc-navy) 0%, var(--wpgc-navy-2) 100%);
}
.wpgc-avatar { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px rgba(254, 185, 0, .85); }
.wpgc-avatar img { width: 30px; height: 30px; object-fit: contain; }
.wpgc-head-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.wpgc-head-text strong { font-family: "Poppins", sans-serif; font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.wpgc-status { font-size: 12px; color: rgba(255, 255, 255, .78); display: flex; align-items: center; gap: 6px; }
.wpgc-status i { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .25); }
.wpgc-head-actions { display: flex; align-items: center; gap: 6px; }
.wpgc-end-btn {
    border: 1px solid rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s;
}
.wpgc-end-btn:hover { background: rgba(255, 255, 255, .22); }
.wpgc-min-btn { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .2s; }
.wpgc-min-btn:hover { background: rgba(255, 255, 255, .25); }
.wpgc-min-btn svg { width: 20px; height: 20px; }
.wpgc button:focus-visible, .wpgc input:focus-visible, .wpgc textarea:focus-visible { outline: 3px solid rgba(254, 185, 0, .7); outline-offset: 1px; }

/* Body + views */
.wpgc-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: var(--wpgc-bg); }
.wpgc-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* Form view */
.wpgc-view-form { overflow-y: auto; }
.wpgc-form-wrap { padding: 26px 24px 22px; }
.wpgc-form-wrap h3 { margin: 0 0 6px; font-family: "Poppins", sans-serif; font-size: 19px; font-weight: 600; color: var(--wpgc-navy); }
.wpgc-form-wrap > p { margin: 0 0 18px; color: var(--wpgc-muted); }
.wpgc-field { margin-bottom: 14px; }
.wpgc-field label { display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 600; color: var(--wpgc-navy); }
.wpgc-field input,
.wpgc-field select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--wpgc-border);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    color: var(--wpgc-text);
    transition: border-color .2s, box-shadow .2s;
}
.wpgc-combo { position: relative; }
.wpgc-combo input[type="text"] {
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236b7c8c'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center / 22px;
    padding-right: 38px;
}
.wpgc-combo-list {
    position: absolute;
    z-index: 6;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 190px;
    margin: 0;
    padding: 6px;
    list-style: none;
    overflow-y: auto;
    background: #fff;
    border: 1.5px solid var(--wpgc-border);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(13, 44, 71, .18);
}
.wpgc-combo-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.wpgc-combo-list li.is-active, .wpgc-combo-list li:hover { background: #fff3cc; color: var(--wpgc-navy); }
.wpgc-combo-list .wpgc-combo-empty { color: var(--wpgc-muted); cursor: default; }
.wpgc-combo-list .wpgc-combo-empty:hover { background: none; }
.wpgc-field.has-error .wpgc-combo input[type="text"] { border-color: var(--wpgc-danger); }
.wpgc-field input::placeholder { color: #a3b0bd; }
.wpgc-field input:focus,
.wpgc-field select:focus { outline: none; border-color: var(--wpgc-navy-2); box-shadow: 0 0 0 4px rgba(22, 74, 115, .12); }
.wpgc-field.has-error input,
.wpgc-field.has-error select { border-color: var(--wpgc-danger); }
.wpgc-err { display: block; min-height: 0; margin-top: 4px; font-size: 12px; color: var(--wpgc-danger); }
.wpgc-err:empty { display: none; }
.wpgc-err-form { margin: 0 0 10px; text-align: center; }
.wpgc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.wpgc-note { margin: 14px 0 0; font-size: 11.5px; color: var(--wpgc-muted); text-align: center; }

.wpgc-primary {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--wpgc-navy) 0%, var(--wpgc-navy-2) 100%);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    transition: transform .15s, box-shadow .2s, opacity .2s;
    box-shadow: 0 6px 16px rgba(13, 44, 71, .25);
}
.wpgc-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(13, 44, 71, .3); }
.wpgc-primary:disabled { opacity: .65; cursor: wait; transform: none; }
.wpgc-primary.is-loading span::after,
.wpgc-spin::after { content: ""; }
.wpgc-primary.is-loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: wpgc-rotate .7s linear infinite; }
.wpgc-ghost { height: 46px; border: 1.5px solid var(--wpgc-border); background: #fff; color: var(--wpgc-navy); border-radius: 12px; font: inherit; font-weight: 600; padding: 0 16px; cursor: pointer; }
.wpgc-ghost:hover { background: var(--wpgc-bg); }

@keyframes wpgc-rotate { to { transform: rotate(360deg); } }

/* Conversation */
.wpgc-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.wpgc-messages::-webkit-scrollbar { width: 6px; }
.wpgc-messages::-webkit-scrollbar-thumb { background: #c5d0db; border-radius: 6px; }

.wpgc-msg { display: flex; gap: 8px; max-width: 100%; animation: wpgc-rise .25s ease both; }
.wpgc-msg .wpgc-mini { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(254, 185, 0, .8); align-self: flex-end; }
.wpgc-msg .wpgc-mini img { width: 18px; height: 18px; object-fit: contain; }
.wpgc-bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.wpgc-bubble p { margin: 0 0 8px; }
.wpgc-bubble p:last-child { margin-bottom: 0; }
.wpgc-bubble ul, .wpgc-bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.wpgc-bubble li { margin-bottom: 3px; }
.wpgc-bubble a { color: var(--wpgc-navy-2); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.wpgc-time { display: block; margin-top: 4px; font-size: 10.5px; opacity: .6; }

.wpgc-msg.bot .wpgc-bubble { background: #fff; border: 1px solid var(--wpgc-border); border-bottom-left-radius: 4px; box-shadow: 0 2px 6px rgba(13, 44, 71, .05); }
.wpgc-msg.user { justify-content: flex-end; }
.wpgc-msg.user .wpgc-bubble { background: linear-gradient(135deg, var(--wpgc-navy) 0%, var(--wpgc-navy-2) 100%); color: #fff; border-bottom-right-radius: 4px; }
.wpgc-msg.user .wpgc-bubble a { color: var(--wpgc-accent); }
.wpgc-msg.error .wpgc-bubble { background: #fff6f4; border-color: #f2c3bb; color: #7d2a20; }
.wpgc-retry { margin-top: 8px; border: 1px solid #e3a79d; background: #fff; color: #7d2a20; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.wpgc-retry:hover { background: #fdeceb; }

.wpgc-typing .wpgc-bubble { display: flex; gap: 4px; padding: 14px 16px; }
.wpgc-typing .wpgc-bubble i { width: 7px; height: 7px; border-radius: 50%; background: #9db0c2; animation: wpgc-bounce 1.2s infinite ease-in-out; }
.wpgc-typing .wpgc-bubble i:nth-child(2) { animation-delay: .15s; }
.wpgc-typing .wpgc-bubble i:nth-child(3) { animation-delay: .3s; }
@keyframes wpgc-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.wpgc-quick { flex: 0 0 auto; padding: 4px 16px 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.wpgc-chip { border: 1.5px solid #c9d6e3; background: #fff; color: var(--wpgc-navy); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .18s; }
.wpgc-chip:hover { border-color: var(--wpgc-accent); background: #fff8e0; transform: translateY(-1px); }

.wpgc-composer { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px 8px; background: #fff; border-top: 1px solid var(--wpgc-border); }
.wpgc-composer textarea {
    flex: 1 1 auto;
    resize: none;
    max-height: 110px;
    min-height: 44px;
    padding: 11px 14px;
    border: 1.5px solid var(--wpgc-border);
    border-radius: 14px;
    background: var(--wpgc-bg);
    font: inherit;
    color: var(--wpgc-text);
    line-height: 1.4;
}
.wpgc-composer textarea:focus { outline: none; border-color: var(--wpgc-navy-2); background: #fff; box-shadow: 0 0 0 4px rgba(22, 74, 115, .1); }
.wpgc-send { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--wpgc-accent); color: var(--wpgc-navy); display: grid; place-items: center; cursor: pointer; transition: transform .15s, background .2s; }
.wpgc-send:hover { background: var(--wpgc-accent-dark); transform: scale(1.06); }
.wpgc-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.wpgc-send svg { width: 20px; height: 20px; }
.wpgc-foot { flex: 0 0 auto; padding: 0 14px 10px; background: #fff; text-align: center; font-size: 10.5px; color: var(--wpgc-muted); }

/* Ended view */
.wpgc-ended { margin: auto; padding: 28px 28px 34px; text-align: center; }
.wpgc-ended h3 { margin: 14px 0 8px; font-family: "Poppins", sans-serif; font-size: 19px; color: var(--wpgc-navy); }
.wpgc-ended p { margin: 0 0 20px; color: var(--wpgc-muted); }
.wpgc-ended-icon { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: #e6f6ec; color: #1e9a52; font-size: 30px; }
.wpgc-ended-icon.wpgc-spin { background: none; border: 4px solid #dbe4ee; border-top-color: var(--wpgc-navy-2); animation: wpgc-rotate .9s linear infinite; }
.wpgc-ended-icon.is-warn { background: #fff4d6; color: #b07a00; }

/* Confirm overlay */
.wpgc-confirm { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 24px; background: rgba(13, 44, 71, .55); backdrop-filter: blur(2px); animation: wpgc-rise .2s ease both; }
.wpgc-confirm-card { width: 100%; background: #fff; border-radius: 18px; padding: 22px 20px 20px; box-shadow: 0 16px 40px rgba(0, 0, 0, .3); text-align: center; }
.wpgc-confirm-card h4 { margin: 0 0 6px; font-family: "Poppins", sans-serif; font-size: 17px; color: var(--wpgc-navy); }
.wpgc-confirm-card p { margin: 0 0 18px; color: var(--wpgc-muted); font-size: 13.5px; }
.wpgc-confirm-actions { display: flex; gap: 10px; }
.wpgc-confirm-actions > * { flex: 1 1 0; width: auto; }

/* ---------- Mobile ---------- */
@media (max-width: 575.98px) {
    .wpgc-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
    .wpgc.is-open .wpgc-launcher { display: none; }
    .wpgc-launcher { right: 16px; bottom: 16px; width: 56px; height: 56px; }
    .wpgc-teaser { right: 16px; bottom: 84px; }
    .scroll-top.active { bottom: 84px !important; inset-inline-end: 16px !important; }
}

@media (prefers-reduced-motion: reduce) {
    .wpgc *, .wpgc *::before, .wpgc *::after { animation: none !important; transition: none !important; }
}

/* RTL (Arabic) */
[dir="rtl"] .wpgc-panel, [dir="rtl"] .wpgc-body { direction: rtl; }
[dir="rtl"] .wpgc-msg.bot .wpgc-bubble { border-bottom-left-radius: 16px; border-bottom-right-radius: 4px; }
[dir="rtl"] .wpgc-msg.user .wpgc-bubble { border-bottom-right-radius: 16px; border-bottom-left-radius: 4px; }
[dir="rtl"] .wpgc-bubble ul, [dir="rtl"] .wpgc-bubble ol { padding-left: 0; padding-right: 20px; }
