/* ===== Chat Widget - Floating Customer Chat ===== */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
    font-family: inherit;
}

/* FAB Wrapper */
.chat-fab-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

/* Animated tooltip */
.chat-fab-tooltip {
    background: #fff;
    color: #4f46e5;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    animation: tooltipSlideIn 0.4s ease-out 1.5s both, tooltipPulse 3s ease-in-out 2.5s infinite;
    pointer-events: none;
}

.chat-widget.open .chat-fab-tooltip {
    display: none;
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tooltipPulse {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-3px); }
}

/* FAB Button */
.chat-widget-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45), 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    animation: fabBounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s both;
}

@keyframes fabBounceIn {
    from {
        opacity: 0;
        transform: scale(0) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Pulse ring */
.chat-fab-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid rgba(99, 102, 241, 0.5);
    animation: fabRing 2.5s ease-out 2s infinite;
    pointer-events: none;
}

.chat-widget.open .chat-fab-ring {
    display: none;
}

@keyframes fabRing {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    70% {
        transform: scale(1.8);
        opacity: 0;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.chat-widget-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.55), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chat-widget-fab:active {
    transform: scale(0.95);
}

.chat-widget-fab .chat-widget-fab-close {
    display: none;
    font-size: 20px;
}

.chat-widget.open .chat-widget-fab {
    width: 52px;
    animation: none;
}

.chat-widget.open .chat-widget-fab .chat-widget-fab-icon {
    display: none;
}

.chat-widget.open .chat-widget-fab .chat-widget-fab-close {
    display: inline;
}

/* Badge */
.chat-widget-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #fff;
    line-height: 1;
}

/* Panel */
.chat-widget-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 340px;
    max-height: 520px;
    background: var(--ct-card-bg, #fff);
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: widgetSlideUp 0.25s ease-out;
}

@keyframes widgetSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Pull bar - hidden on desktop */
.chat-widget-pull-bar {
    display: none;
}

/* Header */
.chat-widget-header {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 50%, #8b5cf6 100%);
    padding: 8px 12px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-radius: 0 0 20px 20px;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Close button */
.chat-widget-close-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}
.chat-widget-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

.chat-widget-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chat-widget-avatar img {
    border-radius: 50%;
    object-fit: cover;
}

.chat-widget-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}
.chat-widget-status {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.2;
}

/* Messages */
.chat-widget-messages-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--ct-body-bg, #f5f7fb);
    max-height: 350px;
    min-height: 250px;
    overscroll-behavior: contain;
}

.chat-widget-messages-inner {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Message Bubbles */
.chat-widget-msg {
    max-width: 82%;
    width: fit-content;
    display: flex;
    flex-direction: column;
}

.chat-widget-msg.self {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-widget-bubble {
    padding: 8px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    background: var(--ct-card-bg, #e4e6eb);
    word-break: break-word;
    display: inline-block;
}

.chat-widget-bubble p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-widget-msg.self .chat-widget-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 4px;
}

/* Message row — bubble + copy button */
.chat-widget-msg .chat-msg-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.chat-widget-msg.self .chat-msg-row {
    justify-content: flex-end;
}

.chat-widget-msg .msg-copy-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    font-size: 12px;
    padding: 0;
    align-self: center;
}

.chat-widget-msg .chat-msg-row:hover .msg-copy-btn {
    opacity: 1;
}

.chat-widget-msg .msg-copy-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.chat-widget-msg .msg-copy-btn.copied {
    opacity: 1;
    color: #059669;
}

@media (hover: none) {
    .chat-widget-msg .msg-copy-btn {
        opacity: 0.5;
    }
    .chat-widget-msg .msg-pin-btn {
        opacity: 0.5;
    }
    .chat-widget-msg .msg-pin-btn.pinned {
        opacity: 1;
    }
}

/* ===== Pin Button (Widget) ===== */
.chat-widget-msg .msg-pin-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    font-size: 12px;
    padding: 0;
    align-self: center;
}

.chat-widget-msg .chat-msg-row:hover .msg-pin-btn {
    opacity: 1;
}

.chat-widget-msg .msg-pin-btn:hover {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

.chat-widget-msg .msg-pin-btn.pinned {
    opacity: 1;
    color: #eab308;
}

/* ===== Widget Pin Header Button ===== */
.chat-widget-pin-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

.chat-widget-pin-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

.chat-widget-pin-btn.active {
    background: rgba(255, 255, 255, 0.35);
    color: #facc15;
}

/* ===== Widget Pinned Messages Panel ===== */
.widget-pinned-panel {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    max-height: 200px;
    overflow-y: auto;
    animation: widgetPinnedSlide 0.2s ease;
}

@keyframes widgetPinnedSlide {
    from { max-height: 0; opacity: 0; }
    to { max-height: 200px; opacity: 1; }
}

.widget-pinned-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #eab308;
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
}

.widget-pinned-list .pinned-item {
    display: flex;
    flex-direction: column;
    padding: 6px 12px;
    border-bottom: 1px solid #f8fafc;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}

.widget-pinned-list .pinned-item:hover {
    background: rgba(99, 102, 241, 0.04);
}

.widget-pinned-list .pinned-item:last-child {
    border-bottom: none;
}

.widget-pinned-list .pinned-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1px;
}

.widget-pinned-list .pinned-sender {
    font-size: 10px;
    font-weight: 600;
    color: #6366f1;
}

.widget-pinned-list .pinned-time {
    font-size: 9px;
    color: #94a3b8;
}

.widget-pinned-list .pinned-item-text {
    font-size: 12px;
    color: #334155;
    line-height: 1.3;
    padding-right: 24px;
}

.widget-pinned-list .pinned-unpin-btn {
    position: absolute;
    right: 8px;
    bottom: 6px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.widget-pinned-list .pinned-item:hover .pinned-unpin-btn {
    opacity: 1;
}

.widget-pinned-list .pinned-unpin-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.widget-pinned-list .pinned-empty {
    text-align: center;
    padding: 16px;
    color: #94a3b8;
    font-size: 12px;
}

/* Widget message highlight */
.chat-widget-msg.msg-highlight {
    animation: msgHighlight 2s ease;
}

@keyframes msgHighlight {
    0%, 30% { background: rgba(234, 179, 8, 0.15); }
    100% { background: transparent; }
}

/* Dark mode widget pin styles */
[data-bs-theme="dark"] .chat-widget-msg .msg-pin-btn {
    color: #64748b;
}

[data-bs-theme="dark"] .chat-widget-msg .chat-msg-row:hover .msg-pin-btn {
    opacity: 1;
}

[data-bs-theme="dark"] .chat-widget-msg .msg-pin-btn:hover {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

[data-bs-theme="dark"] .chat-widget-msg .msg-pin-btn.pinned {
    color: #facc15;
}

[data-bs-theme="dark"] .widget-pinned-panel {
    background: #1e293b;
    border-color: #334155;
}

[data-bs-theme="dark"] .widget-pinned-header {
    color: #facc15;
    border-color: #334155;
}

[data-bs-theme="dark"] .widget-pinned-list .pinned-item {
    border-color: #1e293b;
}

[data-bs-theme="dark"] .widget-pinned-list .pinned-item:hover {
    background: rgba(165, 180, 252, 0.06);
}

[data-bs-theme="dark"] .widget-pinned-list .pinned-sender {
    color: #a5b4fc;
}

[data-bs-theme="dark"] .widget-pinned-list .pinned-time {
    color: #64748b;
}

[data-bs-theme="dark"] .widget-pinned-list .pinned-item-text {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .widget-pinned-list .pinned-unpin-btn {
    color: #64748b;
}

[data-bs-theme="dark"] .widget-pinned-list .pinned-unpin-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

[data-bs-theme="dark"] .widget-pinned-list .pinned-empty {
    color: #64748b;
}

[data-bs-theme="dark"] .chat-widget-msg.msg-highlight {
    animation: msgHighlightDark 2s ease;
}

@keyframes msgHighlightDark {
    0%, 30% { background: rgba(234, 179, 8, 0.1); }
    100% { background: transparent; }
}

/* Time label below message group */
.chat-widget-time-label {
    font-size: 10px;
    color: #94a3b8;
    padding: 1px 4px 2px;
    line-height: 1;
}

/* Seen tick indicators */
.seen-tick {
    display: inline-flex;
    align-items: center;
    margin-left: 3px;
    font-size: 13px;
    color: #94a3b8;
    vertical-align: middle;
    transition: color 0.2s;
}
.seen-tick.seen {
    color: #3b82f6;
}

/* Image & File */
.chat-widget-img {
    max-width: 160px;
    max-height: 120px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: opacity 0.15s, transform 0.15s;
}

.chat-widget-img:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.chat-widget-file-link {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    text-decoration: none;
    color: var(--bs-primary, #6366f1);
}

.chat-widget-msg.self .chat-widget-file-link {
    color: #fff;
}

/* Voice Player */
.chat-widget-bubble .voice-player {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
    padding: 2px 0;
}

.chat-widget-bubble .voice-play-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}

.chat-widget-bubble .voice-play-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

.chat-widget-msg.self .voice-play-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.chat-widget-msg.self .voice-play-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-widget-bubble .voice-wave {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 4px 0;
}

.chat-widget-bubble .voice-progress {
    height: 3px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-widget-msg.self .voice-progress {
    background: rgba(255, 255, 255, 0.25);
}

.chat-widget-bubble .voice-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: #6366f1;
    transition: width 0.1s linear;
}

.chat-widget-msg.self .voice-progress-fill {
    background: #fff;
}

.chat-widget-bubble .voice-duration {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.chat-widget-msg.self .voice-duration {
    color: rgba(255, 255, 255, 0.8);
}

/* Widget Recording Bar */
.widget-recording-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    border-radius: 22px;
    border: 1px solid #fecaca;
    animation: wRecBarIn 0.25s ease;
}

@keyframes wRecBarIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.widget-recording-bar .recording-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    animation: recDotPulse 1.2s ease-in-out infinite;
}

.widget-recording-bar .rec-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.widget-recording-bar .rec-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.widget-recording-bar .rec-wave span {
    display: block;
    width: 2.5px;
    border-radius: 2px;
    background: #ef4444;
    animation: recWaveBar 1s ease-in-out infinite;
}

.widget-recording-bar .rec-wave span:nth-child(1) { height: 6px;  animation-delay: 0s; }
.widget-recording-bar .rec-wave span:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.widget-recording-bar .rec-wave span:nth-child(3) { height: 18px; animation-delay: 0.3s; }
.widget-recording-bar .rec-wave span:nth-child(4) { height: 11px; animation-delay: 0.45s; }
.widget-recording-bar .rec-wave span:nth-child(5) { height: 7px;  animation-delay: 0.6s; }

@keyframes recWaveBar {
    0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

.widget-recording-time {
    font-size: 14px;
    font-weight: 700;
    color: #ef4444;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.widget-recording-bar .rec-cancel-btn,
.widget-recording-bar .rec-send-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.15s;
}

.widget-recording-bar .rec-cancel-btn:active,
.widget-recording-bar .rec-send-btn:active {
    transform: scale(0.9);
}

.widget-recording-bar .rec-cancel-btn {
    background: #fee2e2;
    color: #ef4444;
}

.widget-recording-bar .rec-send-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

/* File Preview */
.chat-widget-file-preview {
    padding: 6px 12px;
    border-bottom: 1px solid var(--ct-border-color, #e9ecef);
}

.chat-widget-file-preview img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

/* Input bar icon buttons (attach, product) */
.chat-widget-input-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #64748b;
    transition: color 0.15s, background 0.15s;
}

.chat-widget-input-btn:hover {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}
.chat-widget-input-btn.active {
    color: #fff;
    background: #6366f1;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.18), 0 0 0 2px rgba(99,102,241,0.25);
}

/* Typing */
.chat-widget-typing {
    padding: 6px 16px 2px;
    display: flex;
    align-items: center;
    background: var(--ct-body-bg, #f5f7fb);
}

.chat-widget-typing .typing-dots {
    display: inline-flex;
    gap: 3px;
}

.chat-widget-typing .typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typingDot 1.4s ease-in-out infinite;
}

.chat-widget-typing .typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-widget-typing .typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-3px); }
}

/* Product Strip (horizontal scroll above input) */
.chat-product-strip {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--ct-border-color, #e9ecef);
    background: var(--ct-card-bg, #fff);
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.chat-product-strip::-webkit-scrollbar {
    display: none;
}

.chat-product-strip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    width: 52px;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.chat-product-strip-item:active {
    transform: scale(0.93);
}

.chat-product-strip-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ct-border-color, #e9ecef);
    background: var(--ct-body-bg, #f5f7fb);
    transition: border-color 0.15s;
}

.chat-product-strip-item:hover .chat-product-strip-img {
    border-color: #6366f1;
}

.chat-product-strip-tick {
    position: absolute;
    bottom: -2px;
    right: -2px;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    background: #22c55e;
    border-radius: 50%;
    display: flex;
    padding: 1px;
    box-shadow: 0 0 0 2px var(--ct-card-bg, #fff), 0 0 6px rgba(34,197,94,0.5);
}

.chat-product-strip-name {
    font-size: 9px;
    margin-top: 3px;
    color: var(--ct-body-color, #555);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

/* Input */
.chat-widget-input {
    padding: 10px 12px;
    border-top: 1px solid var(--ct-border-color, #e9ecef);
    background: var(--ct-card-bg, #fff);
    flex-shrink: 0;
}

.chat-widget-input textarea.form-control {
    font-size: 13px;
    padding: 8px 14px;
    background: var(--ct-body-bg, #f5f7fb);
    border-radius: 18px;
    resize: none;
    overflow-y: hidden;
    min-height: 36px;
    max-height: 100px;
    line-height: 1.4;
}

.chat-widget-input textarea.form-control:focus {
    box-shadow: none;
    border-color: #6366f1;
}

.chat-widget-send {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #6366f1;
    border-color: #6366f1;
}

.chat-widget-send:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

/* Mobile - Full screen chat */
@media (max-width: 575.98px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-fab-tooltip {
        position: absolute;
        bottom: 60px;
        right: 0;
        font-size: 12px;
        padding: 5px 12px;
        max-width: 180px;
    }

    .chat-widget.open {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        z-index: 99999;
    }

    .chat-widget.open .chat-fab-wrap {
        display: none;
    }

    .chat-widget.open .chat-widget-panel {
        position: fixed;
        inset: 0;
        width: 100%;
        max-height: 100dvh;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        animation: mobileSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    @keyframes mobileSlideIn {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* Pull indicator bar */
    .chat-widget-pull-bar {
        display: flex;
        justify-content: center;
        padding: 8px 0 0;
        background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    }

    .chat-widget-pull-bar span {
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.35);
    }

    /* Header - larger on mobile */
    .chat-widget.open .chat-widget-header {
        padding: 12px 16px 16px;
        background: linear-gradient(135deg, #6366f1 0%, #7c3aed 50%, #8b5cf6 100%);
        border-radius: 0 0 24px 24px;
    }
    .chat-widget.open .chat-widget-close-btn,
    .chat-widget.open .chat-widget-pin-btn {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .chat-widget.open .chat-widget-title {
        font-size: 15px;
    }
    .chat-widget.open .chat-widget-status {
        font-size: 11px;
    }

    .chat-widget.open .chat-widget-avatar {
        width: 34px;
        height: 34px;
    }

    .chat-widget.open .chat-widget-avatar img {
        width: 34px;
        height: 34px;
    }

    /* Messages area */
    .chat-widget.open .chat-widget-messages-wrap {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        background: var(--ct-body-bg, #f5f7fb);
    }

    .chat-widget.open .chat-widget-messages {
        max-height: none;
        min-height: 0;
        flex: 1;
        padding: 16px 14px;
    }

    /* Bigger bubbles on mobile */
    .chat-widget.open .chat-widget-bubble {
        padding: 10px 14px;
        border-radius: 18px;
        border-bottom-left-radius: 4px;
    }

    .chat-widget.open .chat-widget-bubble p {
        font-size: 14px;
    }

    .chat-widget.open .chat-widget-msg.self .chat-widget-bubble {
        border-bottom-left-radius: 18px;
        border-bottom-right-radius: 4px;
    }

    /* Product strip */
    .chat-widget.open .chat-product-strip {
        padding: 10px 14px;
    }

    .chat-widget.open .chat-product-strip-img {
        width: 44px;
        height: 44px;
    }

    .chat-widget.open .chat-product-strip-name {
        font-size: 10px;
    }

    /* Input area */
    .chat-widget.open .chat-widget-input {
        padding: 10px 14px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .chat-widget.open .chat-widget-input textarea.form-control {
        font-size: 15px;
        padding: 10px 16px;
        min-height: 40px;
        border-radius: 20px;
    }

    .chat-widget.open .chat-widget-send {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 18px;
    }

    .chat-widget.open .chat-widget-input-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 18px;
    }

    /* Images slightly larger on mobile */
    .chat-widget.open .chat-widget-img {
        max-width: 200px;
        max-height: 150px;
    }

    /* Voice player larger touch targets on mobile */
    .chat-widget.open .voice-play-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 16px;
    }

    .chat-widget.open .voice-progress {
        height: 5px;
    }

    .chat-widget.open .voice-duration {
        font-size: 12px;
    }

    /* Recording bar larger on mobile */
    .chat-widget.open .widget-recording-bar {
        padding: 10px 12px;
    }

    .chat-widget.open .widget-recording-bar .rec-cancel-btn,
    .chat-widget.open .widget-recording-bar .rec-send-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 18px;
    }

    .chat-widget.open .widget-recording-time {
        font-size: 16px;
    }

    .chat-widget.open .widget-recording-bar .rec-wave {
        height: 24px;
        gap: 3px;
    }

    .chat-widget.open .widget-recording-bar .rec-wave span {
        width: 3px;
    }

    /* Scroll button */
    .chat-widget.open .widget-scroll-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* Message Toast Popover */
.chat-widget-toast {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 280px;
    background: var(--ct-card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 10px 14px;
    cursor: pointer;
    animation: toastIn 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: auto;
}

.chat-widget-toast.fade-out {
    opacity: 0;
}

.chat-widget-toast-name {
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    margin-bottom: 2px;
}

.chat-widget-toast-text {
    font-size: 13px;
    color: var(--ct-body-color, #333);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== Product Picker ===== */

.chat-product-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 55%;
    background: var(--ct-card-bg, #fff);
    z-index: 15;
    display: flex;
    flex-direction: column;
    animation: productSlideUp 0.25s ease-out;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

@keyframes productSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.chat-product-pull-bar {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
    cursor: grab;
    flex-shrink: 0;
}

.chat-product-pull-bar span {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: #cbd5e1;
}

.chat-product-header {
    padding: 6px 16px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--ct-border-color, #e9ecef);
    flex-shrink: 0;
}

.chat-product-header h6 {
    font-size: 14px;
    color: var(--ct-body-color, #333);
}

.chat-product-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    overscroll-behavior: contain;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-content: start;
}

.chat-product-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: 12px;
    transition: background 0.15s, transform 0.15s;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.chat-product-item:hover {
    background: rgba(99, 102, 241, 0.06);
}

.chat-product-item:active {
    transform: scale(0.94);
}

.chat-product-thumb-wrap {
    position: relative;
    display: inline-block;
}

.chat-product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--ct-body-bg, #f5f7fb);
    border: 2px solid var(--ct-border-color, #e9ecef);
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.chat-product-item:hover .chat-product-thumb {
    border-color: #6366f1;
}

.chat-product-tick {
    position: absolute;
    bottom: -2px;
    right: -2px;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    background: #22c55e;
    border-radius: 50%;
    display: flex;
    padding: 1px;
    box-shadow: 0 0 0 2px var(--ct-card-bg, #fff), 0 0 6px rgba(34,197,94,0.5);
}

.chat-product-info {
    margin-top: 6px;
    text-align: center;
    min-width: 0;
    max-width: 100%;
}

.chat-product-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--ct-body-color, #333);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    word-break: break-word;
}

/* Credential Popup (long-press) */
.chat-cred-popup {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: credFadeIn 0.2s ease;
    border-radius: inherit;
    overscroll-behavior: contain;
}

@keyframes credFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.chat-cred-popup-body {
    background: var(--ct-card-bg, #fff);
    border-radius: 20px 20px 0 0;
    width: 100%;
    padding: 0 16px 20px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    animation: credSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.chat-cred-popup-body > .chat-cred-popup-inner {
    animation: credContentFade 0.2s ease;
}

@keyframes credContentFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes credSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* Pull handle */
.chat-cred-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
}

.chat-cred-handle span {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #cbd5e1;
}

/* Header with avatar */
.chat-cred-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 14px;
    border-bottom: 1px solid var(--ct-border-color, #e9ecef);
    margin-bottom: 8px;
}

.chat-cred-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ct-border-color, #e9ecef);
    flex-shrink: 0;
}

.chat-cred-header-info {
    flex: 1;
    min-width: 0;
}

.chat-cred-popup-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ct-body-color, #1e293b);
    margin: 0;
    line-height: 1.3;
}

.chat-cred-status {
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
}

.chat-cred-status i {
    font-size: 13px;
}

.chat-cred-status.active {
    color: #22c55e;
}

/* Action buttons */
.chat-cred-actions {
    padding-top: 4px;
}

.chat-cred-action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--ct-body-color, #334155);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-align: left;
    text-decoration: none;
}

.chat-cred-action i {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
    flex-shrink: 0;
}

.chat-cred-action:hover {
    background: rgba(99, 102, 241, 0.05);
}

.chat-cred-action:active {
    transform: scale(0.98);
    background: rgba(99, 102, 241, 0.1);
}

.chat-cred-divider {
    height: 1px;
    background: var(--ct-border-color, #e9ecef);
    margin: 6px 12px;
}

/* Credentials sub-view */
.chat-cred-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0 12px;
}

.chat-cred-nav-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ct-body-color, #1e293b);
}

.chat-cred-back {
    border: none;
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.chat-cred-back:hover {
    background: rgba(99, 102, 241, 0.15);
}

.chat-cred-card {
    background: var(--ct-body-bg, #f8fafc);
    border: 1px solid var(--ct-border-color, #e2e8f0);
    border-radius: 14px;
    padding: 14px;
}

.chat-cred-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--ct-border-color, #e2e8f0);
    font-size: 13px;
    font-weight: 600;
    color: var(--ct-body-color, #334155);
}

.chat-cred-card-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-cred-row {
    margin-bottom: 10px;
}

.chat-cred-row:last-child {
    margin-bottom: 0;
}

.chat-cred-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 4px;
}

.chat-cred-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ct-card-bg, #fff);
    border: 1px solid var(--ct-border-color, #e2e8f0);
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ct-body-color, #334155);
    word-break: break-all;
}

.chat-cred-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--ct-body-color, #334155);
    outline: none;
}

.chat-cred-input::placeholder {
    color: #94a3b8;
}

.chat-cred-copy {
    border: none;
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 15px;
    flex-shrink: 0;
    margin-left: 8px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.chat-cred-copy:hover {
    background: rgba(99, 102, 241, 0.15);
}

.chat-cred-copy.copied {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

/* Scroll to Bottom Button */
.widget-scroll-btn {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--ct-card-bg, #fff);
    color: #6366f1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 10;
    transition: opacity 0.2s, transform 0.2s;
}

.widget-scroll-btn:hover {
    background: #6366f1;
    color: #fff;
}

/* Image Lightbox */
.chat-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chat-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.chat-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* New Messages Divider */
.chat-widget-new-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.chat-widget-new-divider::before,
.chat-widget-new-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ef4444;
    opacity: 0.4;
}

.chat-widget-new-divider span {
    font-size: 10px;
    font-weight: 600;
    color: #ef4444;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* New Message Highlight */
@keyframes widgetMsgHighlight {
    0%   { background: rgba(99, 102, 241, 0.15); }
    100% { background: transparent; }
}

.chat-widget-msg.msg-new {
    animation: widgetMsgHighlight 2s ease-out;
    border-radius: 10px;
}

/* Guest Name Prompt */
.chat-guest-prompt {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--ct-body-bg, #f5f7fb);
}

.chat-guest-prompt-inner {
    text-align: center;
    max-width: 240px;
}

.chat-guest-prompt-icon {
    font-size: 48px;
    color: #6366f1;
    margin-bottom: 8px;
    line-height: 1;
}

.chat-guest-prompt h6 {
    font-size: 16px;
    font-weight: 700;
    color: var(--ct-body-color, #1e293b);
    margin-bottom: 4px;
}

.chat-guest-prompt p {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 16px;
    line-height: 1.5;
}

.chat-guest-prompt input {
    border-radius: 10px;
    font-size: 13px;
    padding: 8px 14px;
    text-align: center;
}

.chat-guest-prompt input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.chat-guest-prompt button[type="submit"] {
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    padding: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
}

/* Message Sending State */
.chat-widget-msg.msg-sending .chat-widget-bubble {
    opacity: 0.7;
}

.msg-status {
    font-size: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 1px 4px;
    justify-content: flex-end;
}

.msg-status i {
    font-size: 13px;
}

/* Message Failed State */
.chat-widget-msg.msg-failed .chat-widget-bubble {
    opacity: 0.6;
}

.msg-status.failed {
    color: #ef4444;
}

.msg-status.failed i {
    font-size: 12px;
}

.msg-retry-btn {
    border: none;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    margin-left: 4px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: background 0.15s, transform 0.15s;
    vertical-align: middle;
    line-height: 1;
}

.msg-retry-btn i {
    font-size: 12px;
    color: inherit;
}

.msg-retry-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

.msg-retry-btn:active {
    transform: scale(0.95);
}

/* Retrying State */
.msg-status.retrying {
    color: #6366f1;
}

@keyframes msgSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.msg-spin {
    animation: msgSpin 0.8s linear infinite;
    display: inline-block;
}

/* System messages (errors, info) */
.chat-widget-system-msg {
    text-align: center;
    padding: 4px 12px;
    margin: 4px 0;
}

/* Copyable code blocks */
.chat-copy-block {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    padding: 2px 6px;
    margin: 1px 0;
    font-size: 12.5px;
}

.chat-copy-block code {
    font-family: 'Consolas', 'Courier New', monospace;
    color: #1e293b;
    font-size: inherit;
    user-select: all;
}

.chat-widget-msg.self .chat-copy-block {
    background: rgba(255, 255, 255, 0.2);
}

.chat-widget-msg.self .chat-copy-block code {
    color: inherit;
}

.chat-copy-btn {
    border: none;
    background: none;
    color: #64748b;
    cursor: pointer;
    padding: 0 2px;
    font-size: 13px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
}

.chat-copy-btn:hover {
    opacity: 1;
    color: #6366f1;
}

.chat-widget-msg.self .chat-copy-btn {
    color: rgba(255, 255, 255, 0.7);
}

.chat-widget-msg.self .chat-copy-btn:hover {
    color: #fff;
}

/* ===== Dark Mode Support ===== */
[data-bs-theme="dark"] .chat-widget-badge {
    border-color: var(--ct-card-bg, #1e1f2e);
}

[data-bs-theme="dark"] .chat-fab-tooltip {
    background: #1e1f2e;
    color: #a5b4fc;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .chat-fab-ring {
    border-color: rgba(165, 180, 252, 0.4);
}

[data-bs-theme="dark"] .chat-widget-panel {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .chat-widget-bubble {
    background: #2a2b3d;
}

[data-bs-theme="dark"] .chat-widget-toast {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .chat-copy-block {
    background: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .chat-copy-block code {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .chat-product-pull-bar span,
[data-bs-theme="dark"] .chat-cred-handle span {
    background: #4d4e60;
}

/* --- Product panel (game list popup) --- */
[data-bs-theme="dark"] .chat-product-panel {
    background: #1e1f2e !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .chat-product-header {
    border-bottom-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-product-list {
    background: #1e1f2e;
}

[data-bs-theme="dark"] .chat-product-thumb {
    background: #252636 !important;
    border-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-product-item:hover .chat-product-thumb {
    border-color: #818cf8 !important;
}

[data-bs-theme="dark"] .chat-product-name {
    color: #cbd5e1 !important;
}

/* --- Product strip (horizontal scroll) --- */
[data-bs-theme="dark"] .chat-product-strip {
    background: #1e1f2e !important;
    border-top-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-product-strip-img {
    background: #252636 !important;
    border-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-product-strip-item:hover .chat-product-strip-img {
    border-color: #818cf8 !important;
}

[data-bs-theme="dark"] .chat-product-strip-name {
    color: #94a3b8 !important;
}

/* --- Widget structural panels --- */
[data-bs-theme="dark"] .chat-widget-panel {
    background: #1e1f2e !important;
}

[data-bs-theme="dark"] .chat-widget-messages {
    background: #141520 !important;
}

[data-bs-theme="dark"] .chat-widget-input {
    background: #1e1f2e !important;
    border-top-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-widget-input textarea.form-control {
    background: #252636 !important;
    border-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-widget-typing {
    background: #141520 !important;
}

/* --- Credential popup --- */
[data-bs-theme="dark"] .chat-cred-popup-body {
    background: #1e1f2e !important;
}

[data-bs-theme="dark"] .chat-cred-header {
    border-bottom-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-cred-avatar {
    border-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-cred-divider {
    background: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-cred-card {
    background: #252636 !important;
    border-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-cred-card-header {
    border-bottom-color: #2d2e3f !important;
}

[data-bs-theme="dark"] .chat-cred-value {
    background: #1a1b29 !important;
    border-color: #2d2e3f !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .chat-cred-copy {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}

[data-bs-theme="dark"] .chat-cred-copy:hover {
    background: rgba(99, 102, 241, 0.2);
}

[data-bs-theme="dark"] .chat-cred-action i {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}

[data-bs-theme="dark"] .chat-cred-back {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}

[data-bs-theme="dark"] .chat-cred-back:hover {
    background: rgba(99, 102, 241, 0.2);
}

/* Guest prompt area */
[data-bs-theme="dark"] .chat-guest-prompt {
    background: #141520 !important;
}

[data-bs-theme="dark"] .chat-cred-popup-body {
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .chat-product-tick,
[data-bs-theme="dark"] .chat-product-strip-tick {
    box-shadow: 0 0 0 2px var(--ct-card-bg, #1e1f2e), 0 0 6px rgba(34, 197, 94, 0.5);
}

[data-bs-theme="dark"] .chat-widget-input-btn {
    color: #94a3b8;
}

[data-bs-theme="dark"] .chat-widget-input-btn:hover {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.15);
}

/* Guest prompt */
[data-bs-theme="dark"] .chat-guest-prompt input {
    background: #252636 !important;
    border-color: #2d2e3f !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .chat-guest-prompt input::placeholder {
    color: #4d4e60 !important;
}

[data-bs-theme="dark"] .chat-guest-prompt input:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
}

[data-bs-theme="dark"] .chat-guest-prompt h6 {
    color: #e2e8f0 !important;
}

/* Widget textarea */
[data-bs-theme="dark"] .chat-widget-input textarea.form-control {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .chat-widget-input textarea.form-control::placeholder {
    color: #4d4e60 !important;
}

/* Widget recording bar */
[data-bs-theme="dark"] .widget-recording-bar {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.04));
    border-color: rgba(239, 68, 68, 0.2);
}

[data-bs-theme="dark"] .widget-recording-time {
    color: #f87171;
}

[data-bs-theme="dark"] .widget-recording-bar .rec-cancel-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

[data-bs-theme="dark"] .widget-recording-bar .rec-wave span {
    background: #f87171;
}

/* Widget file preview */
[data-bs-theme="dark"] .chat-widget-file-preview {
    border-bottom-color: #2d2e3f !important;
}

/* Product header */
[data-bs-theme="dark"] .chat-product-header h6 {
    color: #e2e8f0 !important;
}

/* Product close button */
[data-bs-theme="dark"] .chat-product-header .btn {
    color: #64748b !important;
}

[data-bs-theme="dark"] .chat-product-header .btn:hover {
    color: #a5b4fc !important;
}

/* Product item hover */
[data-bs-theme="dark"] .chat-product-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Credential popup action buttons */
[data-bs-theme="dark"] .chat-cred-action:hover {
    background: rgba(99, 102, 241, 0.08);
}

[data-bs-theme="dark"] .chat-cred-action:active {
    background: rgba(99, 102, 241, 0.15);
}

/* Scroll button */
[data-bs-theme="dark"] .widget-scroll-btn {
    background: #252636 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

[data-bs-theme="dark"] .widget-scroll-btn:hover {
    background: #6366f1 !important;
    color: #fff !important;
}

/* Retry button */
[data-bs-theme="dark"] .msg-retry-btn {
    background: rgba(99, 102, 241, 0.15);
}

[data-bs-theme="dark"] .msg-retry-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

/* Toast name */
[data-bs-theme="dark"] .chat-widget-toast-name {
    color: #a5b4fc;
}

/* Credential label muted text */
[data-bs-theme="dark"] .chat-cred-label {
    color: #64748b;
}

/* Credential status text */
[data-bs-theme="dark"] .chat-cred-status {
    color: #64748b;
}

[data-bs-theme="dark"] .chat-cred-status.active {
    color: #4ade80;
}

/* Don't show on chat page */
body.page-chat .chat-widget {
    display: none !important;
}
