/* ───────────────────────────────────────────────────────────────────
   TriveSales — Widget CSS (PREMIUM v0.1.4.3)
   All rules prefixed with #trv-chat-root for maximum specificity.
   This overrides any WordPress theme styles.
   ─────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* ── Variables ───────────────────────────────────────────────────── */
#trv-chat-root {
    --trv-w-primary:       #6C63FF;
    --trv-w-primary-dark:  #4834D4;
    --trv-w-primary-gl:    linear-gradient(135deg, #6C63FF 0%, #4834D4 100%);
    --trv-w-secondary:     #F5F6FB;
    --trv-w-text:          #1A1A2E;
    --trv-w-text-light:    #7F8C9A;
    --trv-w-white:         #FFFFFF;
    --trv-w-border:        #EBEBF0;
    --trv-w-radius-xl:     26px;
    --trv-w-radius-lg:     20px;
    --trv-w-radius-md:     14px;
    --trv-w-shadow-window: 0 24px 64px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.08);
    --trv-w-shadow-bubble: 0 2px 8px rgba(0,0,0,.06);
    --trv-w-font:          'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#trv-chat-root,
#trv-chat-root * {
    box-sizing: border-box !important;
    font-family: var(--trv-w-font) !important;
    -webkit-font-smoothing: antialiased;
}

/* ── FAB Button ──────────────────────────────────────────────────── */
#trv-chat-root .trv-chat-fab {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 999998 !important;
    width: 62px !important;
    height: 62px !important;
    border-radius: 50% !important;
    background: var(--trv-w-primary-gl) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 6px 24px rgba(108,99,255,.40) !important;
    transition: all .35s cubic-bezier(.34,1.56,.64,1) !important;
    animation: trv-fab-entrance .6s cubic-bezier(.34,1.56,.64,1) both !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    text-decoration: none !important;
}

#trv-chat-root .trv-chat-fab:hover {
    transform: scale(1.12) translateY(-3px) !important;
    box-shadow: 0 10px 32px rgba(108,99,255,.50) !important;
}

#trv-chat-root .trv-chat-fab svg {
    width: 27px !important;
    height: 27px !important;
    transition: transform .3s ease !important;
    fill: none !important;
    stroke: currentColor !important;
}

#trv-chat-root .trv-chat-fab.trv-open svg {
    transform: rotate(90deg) scale(0.8) !important;
}

#trv-chat-root .trv-chat-fab--left { right: auto !important; left: 24px !important; }

/* ── Unread Badge ────────────────────────────────────────────────── */
#trv-chat-root .trv-chat-fab__badge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    width: 22px !important;
    height: 22px !important;
    background: #FF4757 !important;
    color: #fff !important;
    border-radius: 50% !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #fff !important;
    line-height: 1 !important;
}

#trv-chat-root .trv-chat-fab__badge.trv-visible {
    display: flex !important;
    animation: trv-badge-pop .4s cubic-bezier(.34,1.56,.64,1) both !important;
}

/* ── Chat Window ─────────────────────────────────────────────────── */
#trv-chat-root .trv-chat-window {
    position: fixed !important;
    bottom: 102px !important;
    right: 24px !important;
    z-index: 999999 !important;
    width: 390px !important;
    max-width: calc(100vw - 32px) !important;
    height: 620px !important;
    max-height: calc(100vh - 140px) !important;
    border-radius: var(--trv-w-radius-xl) !important;
    background: var(--trv-w-white) !important;
    box-shadow: var(--trv-w-shadow-window) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    opacity: 0 !important;
    transform: translateY(28px) scale(.94) !important;
    pointer-events: none !important;
    transition: opacity .35s cubic-bezier(.16,1,.3,1), transform .35s cubic-bezier(.16,1,.3,1) !important;
    border: 1px solid rgba(108,99,255,.08) !important;
    margin: 0 !important;
    padding: 0 !important;
}

#trv-chat-root .trv-chat-window.trv-visible {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: all !important;
}

#trv-chat-root .trv-chat-window--left { right: auto !important; left: 24px !important; }

/* ── Header ──────────────────────────────────────────────────────── */
#trv-chat-root .trv-chat-header {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 20px 22px !important;
    background: var(--trv-w-primary-gl) !important;
    color: #fff !important;
    flex-shrink: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

#trv-chat-root .trv-chat-header::before {
    content: '' !important;
    position: absolute !important;
    top: -40% !important;
    left: -10% !important;
    width: 60% !important;
    height: 200% !important;
    background: rgba(255,255,255,.08) !important;
    border-radius: 50% !important;
    pointer-events: none !important;
}

#trv-chat-root .trv-chat-header__avatar {
    width: 46px !important;
    height: 46px !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,.20) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    border: 2.5px solid rgba(255,255,255,.35) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,.15) !important;
}

#trv-chat-root .trv-chat-header__avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#trv-chat-root .trv-chat-header__avatar svg {
    width: 28px !important;
    height: 28px !important;
    fill: #fff !important;
}

#trv-chat-root .trv-chat-header__info { flex: 1 !important; min-width: 0 !important; }

#trv-chat-root .trv-chat-header__name {
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin: 0 0 3px !important;
    padding: 0 !important;
    letter-spacing: -.02em !important;
    line-height: 1.2 !important;
    background: none !important;
    border: none !important;
}

#trv-chat-root .trv-chat-header__status {
    font-size: 12px !important;
    color: rgba(255,255,255,.88) !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-weight: 400 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#trv-chat-root .trv-chat-header__dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #00E676 !important;
    box-shadow: 0 0 0 3px rgba(0,230,118,.25) !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
    animation: trv-pulse 2s ease-in-out infinite !important;
}

#trv-chat-root .trv-chat-header__close {
    background: rgba(255,255,255,.18) !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background .2s, transform .2s !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

#trv-chat-root .trv-chat-header__close:hover {
    background: rgba(255,255,255,.30) !important;
    transform: scale(1.1) !important;
}

#trv-chat-root .trv-chat-header__close svg {
    width: 18px !important;
    height: 18px !important;
    fill: #fff !important;
}

/* ── Messages Area ───────────────────────────────────────────────── */
#trv-chat-root .trv-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 24px 20px !important;
    background: var(--trv-w-secondary) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 18px !important;
    scroll-behavior: smooth !important;
    margin: 0 !important;
    border: none !important;
}

#trv-chat-root .trv-chat-messages::-webkit-scrollbar { width: 4px !important; }
#trv-chat-root .trv-chat-messages::-webkit-scrollbar-track { background: transparent !important; }
#trv-chat-root .trv-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(108,99,255,.25) !important;
    border-radius: 4px !important;
}

/* ── Message Bubbles ─────────────────────────────────────────────── */
#trv-chat-root .trv-msg {
    display: flex !important;
    animation: trv-msg-in .4s cubic-bezier(.16,1,.3,1) both !important;
    margin: 0 !important;
    padding: 0 !important;
}

#trv-chat-root .trv-msg--user { justify-content: flex-end !important; }
#trv-chat-root .trv-msg--bot  { justify-content: flex-start !important; }

#trv-chat-root .trv-msg__bubble {
    max-width: 82% !important;
    padding: 14px 18px !important;
    font-size: 14.5px !important;
    line-height: 1.65 !important;
    position: relative !important;
    word-break: break-word !important;
    margin: 0 !important;
    border: none !important;
}

#trv-chat-root .trv-msg--user .trv-msg__bubble {
    background: var(--trv-w-primary-gl) !important;
    color: #fff !important;
    border-radius: var(--trv-w-radius-lg) var(--trv-w-radius-lg) 5px var(--trv-w-radius-lg) !important;
    box-shadow: 0 6px 18px rgba(108,99,255,.28) !important;
    border: none !important;
}

#trv-chat-root .trv-msg--bot .trv-msg__bubble {
    background: var(--trv-w-white) !important;
    color: var(--trv-w-text) !important;
    border-radius: 5px var(--trv-w-radius-lg) var(--trv-w-radius-lg) var(--trv-w-radius-lg) !important;
    border: 1px solid var(--trv-w-border) !important;
    box-shadow: var(--trv-w-shadow-bubble) !important;
}

#trv-chat-root .trv-msg__bubble p {
    margin: 0 0 8px !important;
    padding: 0 !important;
}

#trv-chat-root .trv-msg__bubble p:last-child { margin-bottom: 0 !important; }

#trv-chat-root .trv-msg__bubble a {
    color: var(--trv-w-primary) !important;
    text-decoration: underline !important;
}

#trv-chat-root .trv-msg--user .trv-msg__bubble a {
    color: rgba(255,255,255,.9) !important;
}

#trv-chat-root .trv-msg__bubble img.trv-upload-preview {
    max-width: 100% !important;
    border-radius: 6px !important;
    display: block !important;
    margin-bottom: 5px !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
}

#trv-chat-root .trv-btn-action {
    display: inline-block !important;
    margin-top: 8px !important;
    padding: 8px 14px !important;
    background: var(--trv-w-primary) !important;
    color: #fff !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    text-align: center !important;
    transition: background .2s, transform .2s !important;
}

#trv-chat-root .trv-btn-action:hover {
    background: var(--trv-w-primary-gl) !important;
    transform: translateY(-1px) !important;
    color: #fff !important;
}

#trv-chat-root .trv-msg__bubble strong {
    font-weight: 600 !important;
}

#trv-chat-root .trv-msg__time {
    font-size: 10.5px !important;
    color: var(--trv-w-text-light) !important;
    margin: 7px 0 0 !important;
    padding: 0 !important;
    display: block !important;
    opacity: .75 !important;
    font-weight: 400 !important;
    background: none !important;
    border: none !important;
}

#trv-chat-root .trv-msg--user .trv-msg__time {
    text-align: right !important;
    color: rgba(255,255,255,.75) !important;
}

/* ── Input Area ──────────────────────────────────────────────────── */
#trv-chat-root .trv-chat-input {
    padding: 14px 18px !important;
    background: var(--trv-w-white) !important;
    border-top: 1px solid var(--trv-w-border) !important;
    display: flex !important;
    align-items: flex-end !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

#trv-chat-root .trv-chat-input__field {
    flex: 1 !important;
    border: 1.5px solid var(--trv-w-border) !important;
    border-radius: 22px !important;
    padding: 12px 18px !important;
    font-size: 14px !important;
    font-family: var(--trv-w-font) !important;
    background: var(--trv-w-secondary) !important;
    outline: none !important;
    resize: none !important;
    min-height: 46px !important;
    max-height: 120px !important;
    transition: border-color .2s, box-shadow .2s, background .2s !important;
    color: var(--trv-w-text) !important;
    line-height: 1.5 !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    margin: 0 !important;
}

#trv-chat-root .trv-chat-input__field::placeholder {
    color: var(--trv-w-text-light) !important;
    opacity: 1 !important;
}

#trv-chat-root .trv-chat-input__field:focus {
    border-color: var(--trv-w-primary) !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(108,99,255,.10) !important;
    outline: none !important;
}

#trv-chat-root .trv-chat-input__attach {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--trv-w-text-light) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all .2s !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-bottom: 5px !important;
}

#trv-chat-root .trv-chat-input__attach:hover {
    color: var(--trv-w-primary) !important;
    background: rgba(108,99,255,.08) !important;
}

#trv-chat-root .trv-chat-input__attach svg {
    width: 22px !important;
    height: 22px !important;
    fill: currentColor !important;
}

#trv-chat-root .trv-chat-input__send {
    width: 46px !important;
    height: 46px !important;
    border-radius: 50% !important;
    background: var(--trv-w-primary-gl) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all .25s cubic-bezier(.34,1.56,.64,1) !important;
    box-shadow: 0 4px 12px rgba(108,99,255,.30) !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

#trv-chat-root .trv-chat-input__send svg {
    width: 20px !important;
    height: 20px !important;
    fill: #fff !important;
}

#trv-chat-root .trv-chat-input__send:hover:not(:disabled) {
    transform: scale(1.1) translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(108,99,255,.40) !important;
}

#trv-chat-root .trv-chat-input__send:disabled {
    opacity: .4 !important;
    cursor: not-allowed !important;
    filter: grayscale(1) !important;
    box-shadow: none !important;
    transform: none !important;
}

/* ── RGPD Banner ─────────────────────────────────────────────────── */
#trv-chat-root .trv-rgpd {
    padding: 14px 20px !important;
    background: #FAFAFA !important;
    border-top: 1px solid var(--trv-w-border) !important;
    font-size: 12px !important;
    color: var(--trv-w-text-light) !important;
    line-height: 1.5 !important;
    transition: opacity .3s ease !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

#trv-chat-root .trv-rgpd label {
    display: flex !important;
    gap: 12px !important;
    cursor: pointer !important;
    align-items: flex-start !important;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: normal !important;
    color: var(--trv-w-text-light) !important;
}

#trv-chat-root .trv-rgpd input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    margin-top: 2px !important;
    accent-color: var(--trv-w-primary) !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    padding: 0 !important;
    border: none !important;
}

#trv-chat-root .trv-rgpd a {
    color: var(--trv-w-primary) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
}

#trv-chat-root .trv-rgpd a:hover { text-decoration: underline !important; }

/* ── Typing Indicator ────────────────────────────────────────────── */
#trv-chat-root .trv-typing {
    display: none !important;
    padding: 4px 0 !important;
    margin: 0 !important;
}

#trv-chat-root .trv-typing.trv-visible { display: flex !important; }

#trv-chat-root .trv-typing__bubble {
    background: var(--trv-w-white) !important;
    padding: 14px 20px !important;
    border-radius: 5px var(--trv-w-radius-lg) var(--trv-w-radius-lg) var(--trv-w-radius-lg) !important;
    border: 1px solid var(--trv-w-border) !important;
    display: flex !important;
    gap: 5px !important;
    align-items: center !important;
    box-shadow: var(--trv-w-shadow-bubble) !important;
}

#trv-chat-root .trv-typing__dot {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    background: #BDC3CF !important;
    animation: trv-typing-bounce 1.4s infinite !important;
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
}

#trv-chat-root .trv-typing__dot:nth-child(2) { animation-delay: .2s !important; }
#trv-chat-root .trv-typing__dot:nth-child(3) { animation-delay: .4s !important; }

/* ── Footer ──────────────────────────────────────────────────────── */
#trv-chat-root .trv-chat-footer {
    padding: 9px !important;
    font-size: 11px !important;
    text-align: center !important;
    background: #fff !important;
    color: #C5CBD3 !important;
    letter-spacing: .01em !important;
    border-top: 1px solid var(--trv-w-border) !important;
    margin: 0 !important;
}

#trv-chat-root .trv-chat-footer a {
    color: var(--trv-w-primary) !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

/* ── Quick Replies ───────────────────────────────────────────────── */
#trv-chat-root .trv-quick-replies {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 4px 0 !important;
    margin: 0 !important;
}

#trv-chat-root .trv-quick-reply {
    background: var(--trv-w-white) !important;
    border: 1.5px solid var(--trv-w-primary) !important;
    color: var(--trv-w-primary) !important;
    border-radius: 20px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    font-family: var(--trv-w-font) !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all .2s !important;
    line-height: 1.4 !important;
}

#trv-chat-root .trv-quick-reply:hover {
    background: var(--trv-w-primary) !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(108,99,255,.25) !important;
}

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes trv-fab-entrance {
    from { opacity: 0; transform: scale(.5) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes trv-badge-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

@keyframes trv-msg-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes trv-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-5px); }
}

@keyframes trv-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(0,230,118,.20); }
    50%      { box-shadow: 0 0 0 5px rgba(0,230,118,.05); }
}

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #trv-chat-root .trv-chat-window.trv-mobile-full {
        bottom: 0 !important;
        right:  0 !important;
        left:   0 !important;
        width:  100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }
}
