/* ============================================================
   Strivio Chat — Frontend Widget
   Colors: #3b3664 | #FFFFFF | #FFDF73 | #FF8534 | #DCDCDE | #777777
   Font: Montserrat
============================================================ */

:root {
    --strivio-chat-primary:   #3b3664;
    --strivio-chat-secondary: #FFFFFF;
    --strivio-chat-accent:    #FFDF73;
    --strivio-chat-accent2:   #FF8534;
    --strivio-chat-light:     #DCDCDE;
    --strivio-chat-muted:     #777777;
    --strivio-chat-font:      'Montserrat', sans-serif;
    --strivio-chat-fsize:     14px;
    --strivio-chat-bottom:    30px;
    --strivio-chat-radius:    16px;
    --strivio-chat-shadow:    0 8px 32px rgba(59,54,100,.22);
    --strivio-chat-shadow-sm: 0 2px 12px rgba(59,54,100,.14);
}

/* ---- Reset ---- */
#strivio-chat-widget *,
#strivio-chat-widget *::before,
#strivio-chat-widget *::after {
    box-sizing: border-box;
    margin: 0;
    /* padding: 0; */
}

/* ---- Container ---- */
#strivio-chat-widget {
    position: fixed;
    right: 30px;
    bottom: var(--strivio-chat-bottom);
    z-index: 999999;
    font-family: var(--strivio-chat-font);
    font-size: var(--strivio-chat-fsize);
    line-height: 1.5;
}

/* ============================================================
   Float Button
============================================================ */
.strivio-chat-float-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--strivio-chat-primary);
    color: var(--strivio-chat-secondary);
    border: none;
    border-radius: 50px;
    padding: 14px 22px;
    cursor: pointer;
    font-family: var(--strivio-chat-font);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--strivio-chat-shadow);
    transition: transform .25s ease, box-shadow .25s ease, background .2s;
    position: relative;
    white-space: nowrap;
}
.strivio-chat-float-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(59,54,100,.3);
    background: #4a4480;
}
.strivio-chat-float-btn:active { transform: translateY(0); }

.strivio-chat-btn-icon-close { display: none; }
.strivio-chat-float-btn.strivio-chat-open .strivio-chat-btn-icon-open  { display: none; }
.strivio-chat-float-btn.strivio-chat-open .strivio-chat-btn-icon-close { display: block; }

.strivio-chat-unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--strivio-chat-accent2);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: strivio-chat-pulse 1.5s infinite;
}
.strivio-chat-unread-badge.visible { display: flex; }
@keyframes strivio-chat-pulse {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

/* ============================================================
   Chat Box
============================================================ */
.strivio-chat-chat-box {
    position: absolute;
    bottom: 64px;
    right: 0;
    width: 360px;
    height: 520px;
    max-height: 85vh;
    background: var(--strivio-chat-secondary);
    border-radius: var(--strivio-chat-radius);
    box-shadow: var(--strivio-chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(.95) translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .22s ease;
}
.strivio-chat-chat-box.strivio-chat-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Responsive */
@media (max-width: 480px) {
    #strivio-chat-widget { right: 12px; bottom: 12px; }
    .strivio-chat-chat-box { width: calc(100vw - 24px); height: 80vh; right: 0; }
    .strivio-chat-float-btn .strivio-chat-float-label { display: none; }
    .strivio-chat-float-btn { padding: 14px; }
}

/* ============================================================
   Header
============================================================ */
.strivio-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--strivio-chat-primary);
    color: var(--strivio-chat-secondary);
    padding: 14px 16px;
    flex-shrink: 0;
}
.strivio-chat-header-left { display: flex; align-items: center; gap: 10px; }
.strivio-chat-header-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.strivio-chat-header-title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}
.strivio-chat-header-sub {
    display: block;
    font-size: 11px;
    opacity: .75;
    margin-top: 1px;
}
.strivio-chat-header-right { display: flex; align-items: center; gap: 4px; }
.strivio-chat-back-btn,
.strivio-chat-close-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.strivio-chat-back-btn:hover, .strivio-chat-close-btn:hover { background: rgba(255,255,255,.28); }

/* ============================================================
   Body / Screens
============================================================ */
.strivio-chat-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.strivio-chat-screen {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 20px 16px;
    display: none;
    flex-direction: column;
    gap: 12px;
    animation: strivio-chat-slide-in .2s ease;
}
.strivio-chat-screen.active { display: flex; }
@keyframes strivio-chat-slide-in {
    from { opacity:0; transform: translateX(10px); }
    to   { opacity:1; transform: translateX(0); }
}

/* Scrollbar */
.strivio-chat-screen::-webkit-scrollbar { width: 4px; }
.strivio-chat-screen::-webkit-scrollbar-track { background: transparent; }
.strivio-chat-screen::-webkit-scrollbar-thumb { background: var(--strivio-chat-light); border-radius: 4px; }

/* ============================================================
   Home Screen
============================================================ */
.strivio-chat-welcome {
    text-align: center;
    padding: 8px 0 4px;
}
.strivio-chat-welcome-icon {
    width: 56px;
    height: 56px;
    background: var(--strivio-chat-primary);
    color: var(--strivio-chat-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.strivio-chat-welcome-text {
    font-size: 13px;
    color: var(--strivio-chat-muted);
    line-height: 1.5;
}

.strivio-chat-options-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.strivio-chat-option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1.5px solid var(--strivio-chat-light);
    border-radius: 12px;
    padding: 13px 14px;
    cursor: pointer;
    font-family: var(--strivio-chat-font);
    font-size: 13px;
    font-weight: 500;
    color: #333;
    text-align: left;
    transition: all .2s ease;
    width: 100%;
}
.strivio-chat-option-card:hover {
    border-color: var(--strivio-chat-primary);
    background: #f7f6ff;
    transform: translateX(2px);
}
.strivio-chat-option-icon {
    width: 38px;
    height: 38px;
    background: var(--strivio-chat-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--strivio-chat-primary);
    flex-shrink: 0;
}
.strivio-chat-option-label { flex: 1; }
.strivio-chat-option-arrow {
    font-size: 18px;
    color: var(--strivio-chat-muted);
    margin-left: auto;
}
.strivio-chat-option-card.strivio-chat-option-chat .strivio-chat-option-icon {
    background: rgba(255,133,52,.12);
    color: var(--strivio-chat-accent2);
}
.strivio-chat-option-card.strivio-chat-option-chat:hover { border-color: var(--strivio-chat-accent2); background: rgba(255,133,52,.05); }

/* ============================================================
   Screen Headers
============================================================ */
.strivio-chat-screen-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--strivio-chat-primary);
    margin-bottom: 4px;
}
.strivio-chat-screen-header p { font-size: 12px; color: var(--strivio-chat-muted); }

/* ============================================================
   Order Screen
============================================================ */
.strivio-chat-order-form { display: flex; flex-direction: column; gap: 10px; }
.strivio-chat-field-group { display: flex; flex-direction: column; gap: 5px; }
.strivio-chat-field-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--strivio-chat-primary);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.strivio-chat-field-group input,
.strivio-chat-field-group textarea,
.strivio-chat-field-group select {
    border: 1.5px solid var(--strivio-chat-light);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: var(--strivio-chat-font);
    font-size: 13px;
    color: #333;
    outline: none;
    width: 100%;
    transition: border-color .2s;
}
.strivio-chat-field-group input:focus,
.strivio-chat-field-group textarea:focus { border-color: var(--strivio-chat-primary); }

.strivio-chat-btn-primary {
    background: var(--strivio-chat-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 20px;
    font-family: var(--strivio-chat-font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .2s, transform .15s;
}
.strivio-chat-btn-primary:hover { background: #4a4480; transform: translateY(-1px); }
.strivio-chat-btn-primary:active { transform: translateY(0); }

.strivio-chat-alert {
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 500;
}
.strivio-chat-alert-error   { background: #fff1f1; color: #c0392b; border: 1px solid #ffd5d5; }
.strivio-chat-alert-success { background: #f0fdf4; color: #1a7a4a; border: 1px solid #d4f7e0; }

/* Order Card */
.strivio-chat-order-card {
    border: 1.5px solid var(--strivio-chat-light);
    border-radius: 12px;
    overflow: hidden;
}
.strivio-chat-order-card-header {
    background: var(--strivio-chat-primary);
    color: #fff;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}
.strivio-chat-order-id-badge { opacity: .9; }
.strivio-chat-order-status {
    background: var(--strivio-chat-accent);
    color: var(--strivio-chat-primary);
    border-radius: 50px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
}
.strivio-chat-order-meta { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.strivio-chat-order-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--strivio-chat-muted);
}
.strivio-chat-order-meta-row strong { color: #333; text-align: right; }
/* WooCommerce price spans inside order total */
.strivio-chat-order-meta-row strong .woocommerce-Price-amount { font-weight: 700; }
.strivio-chat-order-items {
    border-top: 1px solid var(--strivio-chat-light);
    padding: 8px 14px;
    font-size: 12px;
    color: var(--strivio-chat-muted);
}

/* ============================================================
   Q&A Screen
============================================================ */
.strivio-chat-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
    color: var(--strivio-chat-muted);
    min-height: 20px;
    margin-bottom: 4px;
}
.strivio-chat-breadcrumb-item {
    color: var(--strivio-chat-primary);
    cursor: pointer;
    font-weight: 500;
}
.strivio-chat-breadcrumb-item:hover { text-decoration: underline; }
.strivio-chat-breadcrumb-sep { color: var(--strivio-chat-light); }

.strivio-chat-qa-items { display: flex; flex-direction: column; gap: 8px; }

.strivio-chat-qa-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fff;
    border: 1.5px solid var(--strivio-chat-light);
    border-radius: 10px;
    padding: 11px 13px;
    cursor: pointer;
    font-family: var(--strivio-chat-font);
    font-size: 13px;
    color: #333;
    text-align: left;
    width: 100%;
    transition: all .18s;
    line-height: 1.4;
}
.strivio-chat-qa-btn:hover { border-color: var(--strivio-chat-primary); background: #f7f6ff; }
.strivio-chat-qa-btn .strivio-chat-qa-arrow { margin-left: auto; color: var(--strivio-chat-muted); flex-shrink: 0; }

.strivio-chat-qa-answer-box {
    background: rgba(59,54,100,.06);
    border-left: 3px solid var(--strivio-chat-primary);
    border-radius: 0 10px 10px 0;
    padding: 12px 14px;
    font-size: 13px;
    color: #444;
    line-height: 1.6;
    white-space: pre-wrap;
}

.strivio-chat-qa-empty {
    text-align: center;
    color: var(--strivio-chat-muted);
    font-size: 13px;
    padding: 24px 0;
}

.strivio-chat-qa-input-wrap { display: flex; flex-direction: column; gap: 8px; }
.strivio-chat-field-label { font-size: 12px; font-weight: 600; color: var(--strivio-chat-primary); }

/* ============================================================
   Pre-Chat Screen
============================================================ */
.strivio-chat-prechat-form { display: flex; flex-direction: column; gap: 10px; }

/* ============================================================
   Chat Screen
============================================================ */
#strivio-chat-screen-chat {
    padding: 0;
    flex-direction: column;
    /* inherits position:absolute; inset:0 from .strivio-chat-screen */
}

.strivio-chat-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 16px 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}
.strivio-chat-chat-messages::-webkit-scrollbar { width: 4px; }
.strivio-chat-chat-messages::-webkit-scrollbar-thumb { background: var(--strivio-chat-light); border-radius: 4px; }

.strivio-chat-chat-start-msg {
    text-align: center;
    color: var(--strivio-chat-muted);
    font-size: 11px;
    padding: 8px 0;
}
.strivio-chat-chat-start-msg span {
    background: var(--strivio-chat-light);
    padding: 4px 12px;
    border-radius: 50px;
}

.strivio-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    gap: 3px;
    min-width: 0;
}
.strivio-chat-msg-customer { align-self: flex-end; align-items: flex-end; }
.strivio-chat-msg-admin    { align-self: flex-start; align-items: flex-start; }

.strivio-chat-msg-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}
.strivio-chat-msg-customer .strivio-chat-msg-bubble {
    background: var(--strivio-chat-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.strivio-chat-msg-admin .strivio-chat-msg-bubble {
    background: var(--strivio-chat-light);
    color: #333;
    border-bottom-left-radius: 4px;
}
.strivio-chat-msg-time {
    font-size: 10px;
    color: var(--strivio-chat-muted);
    padding: 0 4px;
}

.strivio-chat-chat-footer {
    border-top: 1px solid var(--strivio-chat-light);
    padding: 10px 12px;
    background: #fff;
    flex-shrink: 0;
    box-sizing: border-box;
}
.strivio-chat-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f7f6ff;
    border: 1.5px solid var(--strivio-chat-light);
    border-radius: 12px;
    padding: 8px 8px 8px 12px;
    transition: border-color .2s;
    box-sizing: border-box;
}
.strivio-chat-chat-input-wrap:focus-within { border-color: var(--strivio-chat-primary); }
#strivio-chat-chat-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    resize: none;
    font-family: var(--strivio-chat-font);
    font-size: 13px;
    color: #333;
    outline: none;
    max-height: 80px;
    line-height: 1.4;
    padding: 2px 0;
}
.strivio-chat-send-btn {
    width: 34px;
    height: 34px;
    background: var(--strivio-chat-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s, transform .15s;
}
.strivio-chat-send-btn:hover  { background: #4a4480; transform: scale(1.08); }
.strivio-chat-send-btn:active { transform: scale(.96); }

/* ============================================================
   Footer
============================================================ */
.strivio-chat-footer {
    background: #fafafa;
    border-top: 1px solid var(--strivio-chat-light);
    text-align: center;
    padding: 7px;
    font-size: 10.5px;
    color: var(--strivio-chat-muted);
    flex-shrink: 0;
}
.strivio-chat-footer strong { color: var(--strivio-chat-primary); }

/* ============================================================
   Spinner
============================================================ */
.strivio-chat-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: strivio-chat-spin .7s linear infinite;
}
.strivio-chat-loading { text-align: center; padding: 20px; color: var(--strivio-chat-muted); font-size: 13px; }

@keyframes strivio-chat-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Style Variations
============================================================ */
/* Warm */
.strivio-chat-variation-warm { --strivio-chat-primary: #FF8534; --strivio-chat-accent: #FFDF73; }
.strivio-chat-variation-warm .strivio-chat-option-card.strivio-chat-option-chat .strivio-chat-option-icon { color: var(--strivio-chat-primary); }

/* Minimal */
.strivio-chat-variation-minimal {
    --strivio-chat-primary:  #444444;
    --strivio-chat-accent:   #DCDCDE;
    --strivio-chat-accent2:  #777777;
}

/* Dark */
.strivio-chat-variation-dark {
    --strivio-chat-primary:  #1a1a2e;
    --strivio-chat-secondary:#16213e;
    --strivio-chat-accent:   #FFDF73;
    --strivio-chat-accent2:  #FF8534;
    --strivio-chat-light:    #2a2a4a;
    --strivio-chat-muted:    #8888aa;
}
.strivio-chat-variation-dark .strivio-chat-chat-box { background: #16213e; }
.strivio-chat-variation-dark .strivio-chat-option-card {
    background: #1e1e3a;
    border-color: #2a2a4a;
    color: #ddd;
}
.strivio-chat-variation-dark .strivio-chat-option-card:hover { background: #252545; }
.strivio-chat-variation-dark .strivio-chat-field-group input { background: #1e1e3a; color: #ddd; }
.strivio-chat-variation-dark .strivio-chat-chat-input-wrap { background: #1e1e3a; }
.strivio-chat-variation-dark #strivio-chat-chat-input { color: #ddd; }
.strivio-chat-variation-dark .strivio-chat-msg-admin .strivio-chat-msg-bubble { background: #2a2a4a; color: #ddd; }
.strivio-chat-variation-dark .strivio-chat-footer { background: #1a1a2e; color: #666; border-color: #2a2a4a; }
.strivio-chat-variation-dark .strivio-chat-qa-btn { background: #1e1e3a; border-color: #2a2a4a; color: #ddd; }
.strivio-chat-variation-dark .strivio-chat-qa-answer-box { background: rgba(255,223,115,.08); color: #ddd; }
.strivio-chat-variation-dark .strivio-chat-order-meta-row strong { color: #ddd; }
.strivio-chat-variation-dark .strivio-chat-chat-start-msg span { background: #2a2a4a; color: #888; }
