/*
 * Live chat widget (frontend). Markup: resources/views/frontend/inc/chat_widget.blade.php.
 * Accent comes from the theme base colour via --sc-accent on #siteChat.
 */
.sc { --sc-ink: #1f2937; --sc-muted: #6b7280; --sc-line: rgba(31, 41, 55, .09); --sc-bg: #fff; --sc-surface: #f7f7f8; --sc-radius: 16px; --sc-accent-soft: rgba(214, 170, 120, .16); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
.sc * { box-sizing: border-box; font-family: inherit; }
@supports (color: color-mix(in srgb, red 50%, blue)) { .sc { --sc-accent-soft: color-mix(in srgb, var(--sc-accent, #d6aa78) 14%, #fff); } }
.sc button { cursor: pointer; }

/* Launcher */
/* Launcher = chhota sa label upar, uske neeche goal icon jisme halka glow chalta rehta hai. */
.sc-launcher { position: fixed; right: 24px; bottom: 32px; z-index: 9990; display: flex; flex-direction: row; align-items: center; gap: 9px; }
/* Sirf text — koi box nahi. Halo isliye ki wo kisi bhi photo par padha ja sake, dabe nahi. */
.sc-fab__label {
    padding: 0;
    border: 0;
    background: none;
    color: var(--sc-ink);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    text-shadow: 0 0 5px #fff, 0 0 12px #fff, 0 0 20px rgba(255, 255, 255, .85), 0 1px 2px rgba(0, 0, 0, .3);
}
.sc-fab__label:hover { color: var(--sc-accent, #d6aa78); }
.sc-fab { position: relative; width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--sc-accent, #d6aa78); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(0, 0, 0, .2); transition: transform .15s ease, box-shadow .15s ease; }
.sc-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0, 0, 0, .26); }
.sc-fab svg { width: 23px; height: 23px; position: relative; }
.sc-fab__ring { position: absolute; inset: 0; border-radius: 50%; background: var(--sc-accent, #d6aa78); opacity: .35; animation: sc-glow 2.6s ease-out infinite; }
@keyframes sc-glow { 0% { transform: scale(1); opacity: .35; } 70% { transform: scale(1.5); opacity: 0; } 100% { transform: scale(1.5); opacity: 0; } }
.sc-fab__badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; z-index: 1; }
.sc.is-open .sc-launcher { display: none; }

/* Panel */
.sc-panel { position: fixed; right: 24px; bottom: 32px; z-index: 9991; width: 390px; max-width: calc(100vw - 24px); height: 640px; max-height: calc(100vh - 40px); background: var(--sc-bg); border-radius: var(--sc-radius); box-shadow: 0 24px 64px rgba(0, 0, 0, .22); display: none; flex-direction: column; overflow: hidden; color: var(--sc-ink); }
.sc.is-open .sc-panel { display: flex; animation: sc-in .18s ease; }
.sc-panel.is-max { width: 720px; height: 82vh; }
@keyframes sc-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--sc-line); background: var(--sc-bg); }
.sc-head__title { font-weight: 700; font-size: 15px; }
.sc-head__status { font-size: 12px; color: var(--sc-muted); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.sc-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); flex: none; }
.sc-head__status.is-waiting .sc-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
.sc-head__status.is-closed .sc-dot { background: #9ca3af; box-shadow: none; }
.sc-head__actions { display: flex; gap: 2px; }
.sc-ibtn { width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--sc-muted); display: inline-flex; align-items: center; justify-content: center; }
.sc-ibtn:hover { background: var(--sc-surface); color: var(--sc-ink); }
.sc-ibtn svg { width: 18px; height: 18px; }
.sc-ibtn.is-active { background: var(--sc-accent-soft); color: var(--sc-accent, #d6aa78); }

.sc-view { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.sc-view.is-active { display: flex; }
.sc-scroll { flex: 1 1 auto; overflow-y: auto; padding: 16px 14px 8px; background: var(--sc-surface); scroll-behavior: smooth; }

/* Hero + quick questions */
.sc-hero__greet { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.sc-hero__icon { width: 40px; height: 40px; border-radius: 12px; background: var(--sc-accent-soft); color: var(--sc-accent, #d6aa78); display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden; }
.sc-hero__icon svg { width: 20px; height: 20px; }
.sc-hero__icon img { width: 100%; height: 100%; object-fit: cover; }
.sc-hero h3 { margin: 4px 0 2px; font-size: 17px; font-weight: 700; }
.sc-hero p { margin: 0; color: var(--sc-muted); font-size: 13px; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sc-chip { border: 1px solid var(--sc-line); background: var(--sc-bg); color: var(--sc-ink); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; }
.sc-chip.is-active { background: var(--sc-accent, #d6aa78); border-color: var(--sc-accent, #d6aa78); color: #fff; }
.sc-quick { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sc-quick__item { text-align: left; border: 1px solid var(--sc-line); background: var(--sc-bg); border-radius: 12px; padding: 11px 14px; font-size: 13px; font-weight: 600; color: var(--sc-ink); display: flex; align-items: center; gap: 10px; transition: border-color .12s ease, transform .12s ease; }
.sc-quick__item:hover { border-color: var(--sc-accent, #d6aa78); transform: translateX(2px); }
.sc-quick__item svg { width: 16px; height: 16px; color: var(--sc-accent, #d6aa78); flex: none; }
.sc-hero.is-hidden { display: none; }

/* Messages */
.sc-messages { display: flex; flex-direction: column; gap: 10px; }
.sc-msg { display: flex; gap: 8px; max-width: 88%; }
.sc-msg--me { align-self: flex-end; flex-direction: row-reverse; }
.sc-msg__avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--sc-accent-soft); color: var(--sc-accent, #d6aa78); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden; margin-top: 18px; }
.sc-msg__avatar img { width: 100%; height: 100%; object-fit: cover; }
.sc-msg--staff .sc-msg__avatar { background: #e0e7ff; color: #3730a3; }
.sc-msg__main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sc-msg__name { font-size: 11px; color: var(--sc-muted); font-weight: 600; padding-left: 4px; }
.sc-msg__bubble { background: var(--sc-bg); border: 1px solid var(--sc-line); border-radius: 14px 14px 14px 4px; padding: 9px 12px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.sc-msg--me .sc-msg__bubble { background: var(--sc-accent, #d6aa78); color: #fff; border-color: transparent; border-radius: 14px 14px 4px 14px; }
.sc-msg__bubble p { margin: 0 0 6px; }
.sc-msg__bubble p:last-child { margin: 0; }
.sc-msg__bubble ul.sc-list { margin: 4px 0 6px; padding-left: 18px; }
.sc-msg__bubble a { color: var(--sc-accent, #d6aa78); text-decoration: underline; font-weight: 600; }
.sc-msg--me .sc-msg__bubble a { color: #fff; }
.sc-msg__time { font-size: 10.5px; color: #9ca3af; padding: 0 4px; }
.sc-msg--me .sc-msg__time { text-align: right; }
.sc-msg--system { align-self: center; max-width: 92%; text-align: center; font-size: 12px; color: var(--sc-muted); padding: 2px 8px; }
.sc-msg__img img { max-width: 220px; max-height: 220px; border-radius: 10px; display: block; }
.sc-msg__file { display: inline-flex; align-items: center; gap: 6px; }
.sc-msg__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sc-msg--system .sc-msg__actions { justify-content: center; }
.sc-btn { border: 1px solid var(--sc-line); background: var(--sc-bg); color: var(--sc-ink); border-radius: 10px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; }
.sc-btn--primary { background: var(--sc-accent, #d6aa78); border-color: var(--sc-accent, #d6aa78); color: #fff; }
.sc-btn:disabled { opacity: .6; cursor: default; }

/* Product cards inside bot replies */
.sc-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.sc-card { display: flex; flex-direction: column; border: 1px solid var(--sc-line); border-radius: 12px; overflow: hidden; color: var(--sc-ink); text-decoration: none !important; background: var(--sc-bg); transition: border-color .12s ease, transform .12s ease; }
.sc-card:hover { border-color: var(--sc-accent, #d6aa78); transform: translateY(-1px); }
.sc-card.is-out { opacity: .7; }
.sc-card__img { display: block; aspect-ratio: 1 / 1; background: var(--sc-surface); }
.sc-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-card__body { display: flex; flex-direction: column; gap: 2px; padding: 8px 9px 9px; }
.sc-card__name { font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--sc-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-card__price { font-size: 13px; font-weight: 700; color: var(--sc-ink); }
.sc-card__price s { font-weight: 400; color: var(--sc-muted); font-size: 11px; margin-left: 4px; }
.sc-card__meta { font-size: 11px; color: #16a34a; font-weight: 600; }
.sc-card.is-out .sc-card__meta { color: var(--sc-muted); }

/* One product in detail */
.sc-detail { display: flex; gap: 10px; margin-top: 10px; border: 1px solid var(--sc-line); border-radius: 12px; overflow: hidden; color: var(--sc-ink); text-decoration: none !important; background: var(--sc-bg); }
.sc-detail:hover { border-color: var(--sc-accent, #d6aa78); }
.sc-detail img { width: 112px; height: 112px; object-fit: cover; flex: none; background: var(--sc-surface); }
.sc-detail__body { display: flex; flex-direction: column; gap: 4px; padding: 10px 10px 10px 0; min-width: 0; }
.sc-detail__name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.sc-detail__price { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sc-detail__price s { font-weight: 400; color: var(--sc-muted); font-size: 12px; }
.sc-stock { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: #dcfce7; color: #15803d; }
.sc-stock.is-out { background: #f3f4f6; color: #6b7280; }
.sc-detail__meta { font-size: 11px; color: var(--sc-muted); }
.sc-detail__cta { align-self: flex-start; margin-top: 2px; padding: 5px 11px; font-size: 12px; }

/* Tap-to-answer options under a question */
.sc-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sc-choice { border: 1px solid var(--sc-accent, #d6aa78); background: var(--sc-bg); color: var(--sc-accent, #d6aa78); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s ease, color .12s ease; }
.sc-choice:hover { background: var(--sc-accent, #d6aa78); color: #fff; }
.sc-msg.is-answered .sc-choice { opacity: .45; pointer-events: none; }

/* Typing */
.sc-typing { display: inline-flex; gap: 4px; align-items: center; padding: 10px 12px; }
.sc-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; animation: sc-bounce 1.2s infinite; }
.sc-typing span:nth-child(2) { animation-delay: .15s; }
.sc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sc-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Inline forms (contact details, rating) */
.sc-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sc-form input { width: 100%; border: 1px solid var(--sc-line); border-radius: 10px; padding: 8px 10px; font-size: 13px; background: var(--sc-bg); color: var(--sc-ink); }
.sc-form input:focus { outline: none; border-color: var(--sc-accent, #d6aa78); }
.sc-form__row { display: flex; gap: 6px; }
.sc-rate { display: flex; gap: 8px; margin-top: 8px; }
.sc-rate .sc-btn { flex: 1; }
.sc-rate .sc-btn.is-picked { background: var(--sc-accent-soft); border-color: var(--sc-accent, #d6aa78); }

/* Notice strip */
.sc-notice { padding: 8px 14px; font-size: 12px; background: #fff7e6; color: #8a5a00; border-top: 1px solid #f5e1b8; }

/* Composer */
.sc-composer { border-top: 1px solid var(--sc-line); background: var(--sc-bg); padding: 10px 12px 8px; }
.sc-composer__box { display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--sc-line); border-radius: 14px; padding: 4px 4px 4px 4px; background: var(--sc-bg); }
.sc-composer__box:focus-within { border-color: var(--sc-accent, #d6aa78); }
.sc-composer__attach { width: 34px; height: 34px; flex: none; }
.sc-composer textarea { flex: 1 1 auto; border: 0; resize: none; outline: none; padding: 8px 4px; font-size: 13.5px; line-height: 1.4; max-height: 120px; min-height: 34px; background: transparent; color: var(--sc-ink); }
.sc-send { width: 36px; height: 36px; border-radius: 11px; border: 0; background: var(--sc-accent, #d6aa78); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.sc-send:disabled { opacity: .5; cursor: default; }
.sc-send svg { width: 18px; height: 18px; }
.sc-composer__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 4px 0; }
.sc-composer__hint { font-size: 10.5px; color: #9ca3af; }
.sc-link { border: 0; background: none; padding: 0; color: var(--sc-muted); font-size: 11.5px; font-weight: 600; text-decoration: underline; }
.sc-link:hover { color: var(--sc-ink); }
.sc.is-readonly .sc-composer__box { opacity: .55; pointer-events: none; }

/* History */
.sc-history { flex: 1 1 auto; overflow-y: auto; padding: 12px; background: var(--sc-surface); display: flex; flex-direction: column; gap: 8px; }
.sc-history__item { text-align: left; border: 1px solid var(--sc-line); background: var(--sc-bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.sc-history__item:hover { border-color: var(--sc-accent, #d6aa78); }
.sc-history__top { display: flex; justify-content: space-between; font-size: 11px; color: var(--sc-muted); }
.sc-history__text { font-size: 13px; color: var(--sc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-history__empty { text-align: center; color: var(--sc-muted); font-size: 13px; padding: 30px 10px; }

/* Order status card (Track my order) */
.sc-order { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--sc-line); border-radius: 12px; background: var(--sc-bg-soft, #fafafa); }
.sc-order__code { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.sc-order__row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--sc-muted); }
.sc-order__row b { color: var(--sc-ink); font-weight: 600; text-align: right; }
.sc-order__items { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--sc-line); font-size: 12.5px; }
.sc-order__link { display: inline-block; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--sc-accent, #d6aa78); }

/* Proactive greeting bubble */
.sc-nudge { position: fixed; right: 24px; bottom: 118px; z-index: 9989; max-width: 288px; display: flex; align-items: flex-start; gap: 6px; animation: sc-nudge-in .22s ease; }
.sc-nudge__body { display: flex; align-items: center; gap: 10px; text-align: left; padding: 11px 13px; border: 1px solid var(--sc-line); border-radius: 14px 14px 4px 14px; background: var(--sc-bg); color: var(--sc-ink); font-size: 13px; line-height: 1.45; box-shadow: 0 12px 30px rgba(0, 0, 0, .16); }
.sc-nudge__body:hover { border-color: var(--sc-accent, #d6aa78); }
.sc-nudge__icon { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: var(--sc-accent-soft); display: flex; align-items: center; justify-content: center; }
.sc-nudge__icon img { width: 100%; height: 100%; object-fit: cover; }
.sc-nudge__x { flex: 0 0 22px; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%; border: 1px solid var(--sc-line); background: var(--sc-bg); color: var(--sc-muted); display: flex; align-items: center; justify-content: center; }
.sc-nudge__x svg { width: 12px; height: 12px; }
.sc.is-open .sc-nudge { display: none; }
@keyframes sc-nudge-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Below 1200px the theme shows a fixed bottom nav (aiz-mobile-bottom-nav) — stay above it */
@media (max-width: 1199.98px) {
    .sc-launcher { bottom: 84px; }
    .sc-panel { bottom: 84px; max-height: calc(100vh - 100px); }
    .sc-nudge { bottom: 170px; }
}
/* Phone: full screen */
@media (max-width: 640px) {
    .sc-nudge { right: 16px; left: 16px; max-width: none; }
    .sc-panel, .sc-panel.is-max { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
    #scBtnMax { display: none; }
    .sc-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { .sc.is-open .sc-panel { animation: none; } .sc-typing span { animation: none; } .sc-fab__ring { animation: none; opacity: 0; } }

/* "Talk to a human" can be hidden (smart/off modes) */
.sc-composer__foot .sc-link[hidden]{ display: none !important; }
