/**
 * TabslAISearch Chat Widget Styles
 * Standalone CSS for AI Shopping Assistant Chat Interface
 * All classes prefixed with 'tabsl-chat-' to avoid theme conflicts
 */

/* ============================================
   CSS Variables - Color Palette & Sizing
   ============================================ */
:root {
    --tabsl-chat-primary: #4A90D9;
    --tabsl-chat-primary-hover: #3A7BC8;
    --tabsl-chat-primary-active: #2A6BB7;
    --tabsl-chat-secondary: #F5F6F7;
    --tabsl-chat-bg-white: #FFFFFF;
    --tabsl-chat-bg-gray: #F0F2F5;
    --tabsl-chat-text-primary: #1C1E21;
    --tabsl-chat-text-secondary: #606770;
    --tabsl-chat-text-light: #8A8D91;
    --tabsl-chat-border: #E4E6EB;
    --tabsl-chat-border-light: #F0F2F5;
    --tabsl-chat-shadow: rgba(0, 0, 0, 0.08);
    --tabsl-chat-shadow-lg: rgba(0, 0, 0, 0.12);
    --tabsl-chat-success: #31A24C;
    --tabsl-chat-success-hover: #278C3F;
    --tabsl-chat-error: #E41E3F;
    --tabsl-chat-bubble-user: #4A90D9;
    --tabsl-chat-bubble-bot: #E4E6EB;
    --tabsl-chat-z-bubble: 9999;
    --tabsl-chat-z-window: 10000;
    --tabsl-chat-z-overlay: 9998;
    --tabsl-chat-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Chat Bubble (Toggle Button)
   ============================================ */
.tabsl-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--tabsl-chat-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--tabsl-chat-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--tabsl-chat-z-bubble);
    transition: transform var(--tabsl-chat-transition),
                box-shadow var(--tabsl-chat-transition),
                background-color var(--tabsl-chat-transition);
    border: none;
    padding: 0;
}

.tabsl-chat-bubble:hover {
    background: var(--tabsl-chat-primary-hover);
    transform: scale(1.05);
    box-shadow: 0 6px 16px var(--tabsl-chat-shadow-lg);
}

.tabsl-chat-bubble:active {
    background: var(--tabsl-chat-primary-active);
    transform: scale(0.98);
}

.tabsl-chat-bubble.tabsl-chat-bubble--bounce {
    animation: tabsl-chat-bounce 0.6s ease-out;
}

.tabsl-chat-bubble-icon {
    width: 28px;
    height: 28px;
    fill: var(--tabsl-chat-bg-white);
}

/* Bubble bounce animation */
@keyframes tabsl-chat-bounce {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.15);
    }
    50% {
        transform: scale(0.95);
    }
    75% {
        transform: scale(1.08);
    }
}

/* Hide bubble when chat is open */
.tabsl-chat-bubble.tabsl-chat-bubble--hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

/* ============================================
   Chat Window Container
   ============================================ */
.tabsl-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 520px;
    background: var(--tabsl-chat-bg-white);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--tabsl-chat-shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: var(--tabsl-chat-z-window);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity var(--tabsl-chat-transition),
                transform var(--tabsl-chat-transition),
                visibility var(--tabsl-chat-transition);
    overflow: hidden;
}

.tabsl-chat-window.tabsl-chat-window--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ============================================
   Chat Header
   ============================================ */
.tabsl-chat-header {
    background: var(--tabsl-chat-primary);
    color: var(--tabsl-chat-bg-white);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
}

.tabsl-chat-header-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.tabsl-chat-header-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.tabsl-chat-close-button {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color var(--tabsl-chat-transition);
    flex-shrink: 0;
}

.tabsl-chat-close-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.tabsl-chat-close-button:active {
    background: rgba(255, 255, 255, 0.25);
}

.tabsl-chat-close-icon {
    width: 20px;
    height: 20px;
    fill: none;
    color: var(--tabsl-chat-bg-white);
}

.tabsl-chat-header-info {
    flex: 1;
    min-width: 0;
}

.tabsl-chat-header-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.tabsl-chat-expand-button {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color var(--tabsl-chat-transition);
}

.tabsl-chat-expand-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.tabsl-chat-expand-button:active {
    background: rgba(255, 255, 255, 0.25);
}

.tabsl-chat-expand-icon {
    width: 18px;
    height: 18px;
    fill: var(--tabsl-chat-bg-white);
}

.tabsl-chat-newchat-button {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color var(--tabsl-chat-transition);
}

.tabsl-chat-newchat-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.tabsl-chat-newchat-button:active {
    background: rgba(255, 255, 255, 0.25);
}

.tabsl-chat-newchat-icon {
    width: 18px;
    height: 18px;
    fill: none;
    color: var(--tabsl-chat-bg-white);
}

.tabsl-chat-newchat-button--input {
    width: 36px;
    height: 36px;
    background: var(--tabsl-chat-bg-light);
    border: 1px solid var(--tabsl-chat-border);
    border-radius: 50%;
    flex-shrink: 0;
}

.tabsl-chat-newchat-button--input .tabsl-chat-newchat-icon {
    color: var(--tabsl-chat-text-secondary);
}

.tabsl-chat-newchat-button--input:hover {
    background: var(--tabsl-chat-border);
}

/* ============================================
   Messages Container
   ============================================ */
.tabsl-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--tabsl-chat-bg-gray);
    scroll-behavior: smooth;
}

.tabsl-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.tabsl-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.tabsl-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.tabsl-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ============================================
   Message Bubbles
   ============================================ */
.tabsl-chat-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: tabsl-chat-message-slide-in 0.3s ease-out;
}

@keyframes tabsl-chat-message-slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User messages (right-aligned, blue) */
.tabsl-chat-message--user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.tabsl-chat-message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.tabsl-chat-message--user .tabsl-chat-message-bubble {
    background: var(--tabsl-chat-bubble-user);
    color: var(--tabsl-chat-bg-white);
    border-bottom-right-radius: 4px;
}

/* Bot messages (left-aligned, gray) */
.tabsl-chat-message--bot {
    flex-direction: row;
}

.tabsl-chat-message--bot .tabsl-chat-message-bubble {
    background: var(--tabsl-chat-bg-white);
    color: var(--tabsl-chat-text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px var(--tabsl-chat-shadow);
}

/* Emoji replaced by flat icon (Cloudflare-safe, no Unicode emoji font) */
.tabsl-chat-emoji-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: 1.25em;
    height: 1.25em;
    margin: 0 0.05em;
}
.tabsl-chat-emoji-icon-svg {
    width: 100%;
    height: 100%;
    color: inherit;
}

/* Message timestamp */
.tabsl-chat-message-time {
    font-size: 11px;
    color: var(--tabsl-chat-text-light);
    margin-top: 4px;
    display: block;
}

.tabsl-chat-message--user .tabsl-chat-message-time {
    text-align: right;
}

/* ============================================
   Typing Indicator
   ============================================ */
.tabsl-chat-typing {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: tabsl-chat-message-slide-in 0.3s ease-out;
}

.tabsl-chat-typing-bubble {
    background: var(--tabsl-chat-bg-white);
    padding: 14px 18px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px var(--tabsl-chat-shadow);
    display: flex;
    gap: 4px;
    align-items: center;
}

.tabsl-chat-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--tabsl-chat-text-light);
    border-radius: 50%;
    animation: tabsl-chat-typing-bounce 1.4s infinite ease-in-out;
}

.tabsl-chat-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.tabsl-chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.tabsl-chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes tabsl-chat-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ============================================
   Product Cards - Widget (2-column card grid)
   ============================================ */
.tabsl-chat-products-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0 8px;
    margin: 4px 0;
    max-width: 90%;
    max-height: 320px;
    -webkit-overflow-scrolling: touch;
}

.tabsl-chat-products-container::-webkit-scrollbar {
    width: 3px;
}

.tabsl-chat-products-container::-webkit-scrollbar-track {
    background: transparent;
}

.tabsl-chat-products-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

/* Scroll fade wrapper for widget product containers */
.tabsl-chat-products-scroll-wrap {
    position: relative;
    max-width: 90%;
    margin: 4px 0;
}

.tabsl-chat-products-scroll-wrap .tabsl-chat-products-container {
    max-width: 100%;
    margin: 0;
}

.tabsl-chat-products-scroll-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.95));
    pointer-events: none;
    border-radius: 0 0 8px 8px;
    z-index: 1;
    transition: opacity 0.2s;
}

.tabsl-chat-products-scroll-wrap.tabsl-chat-scroll-end::after {
    opacity: 0;
}

.tabsl-chat-product-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--tabsl-chat-bg-white);
    border: 1px solid var(--tabsl-chat-border);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
    text-decoration: none;
    color: inherit;
}

.tabsl-chat-product-item:hover {
    box-shadow: 0 2px 10px var(--tabsl-chat-shadow-lg);
    border-color: var(--tabsl-chat-primary);
}

.tabsl-chat-product-img-link {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f8f8f8;
    border-bottom: 1px solid var(--tabsl-chat-border-light);
    border-radius: 10px 10px 0 0;
}

.tabsl-chat-product-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.tabsl-chat-product-info {
    padding: 8px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tabsl-chat-product-link {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 11px;
    font-weight: 600;
    color: var(--tabsl-chat-text-primary);
    text-decoration: none;
    line-height: 1.3;
    overflow: hidden;
    margin-bottom: 4px;
}

.tabsl-chat-product-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px;
    margin-top: auto;
}

.tabsl-chat-product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--tabsl-chat-primary);
    white-space: nowrap;
}

.tabsl-chat-product-unitprice {
    font-size: 10px;
    font-weight: 400;
    color: #888;
    white-space: nowrap;
    text-align: right;
}

/* ============================================
   Product Cards - Fullpage (horizontal carousel)
   ============================================ */
.tabsl-chat-window--fullpage .tabsl-chat-products-container {
    display: flex;
    grid-template-columns: unset;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    min-height: 200px;
}

.tabsl-chat-window--fullpage .tabsl-chat-products-scroll-wrap {
    max-width: 100%;
}

.tabsl-chat-window--fullpage .tabsl-chat-products-scroll-wrap::after {
    display: none;
}

.tabsl-chat-window--fullpage .tabsl-chat-products-container::-webkit-scrollbar {
    height: 3px;
    width: auto;
}

.tabsl-chat-window--fullpage .tabsl-chat-product-item {
    width: 140px;
    min-width: 140px;
}

.tabsl-chat-window--fullpage .tabsl-chat-product-img-link {
    height: 140px;
    aspect-ratio: unset;
}

.tabsl-chat-window--fullpage .tabsl-chat-product-info {
    padding: 8px 10px 10px;
}

.tabsl-chat-window--fullpage .tabsl-chat-product-link {
    font-size: 12px;
}

.tabsl-chat-window--fullpage .tabsl-chat-product-price {
    font-size: 14px;
}

/* ============================================
   Category & Manufacturer Cards
   ============================================ */
.tabsl-chat-category-card .tabsl-chat-product-price,
.tabsl-chat-manufacturer-card .tabsl-chat-product-price {
    font-size: 11px;
    font-weight: 600;
    color: var(--tabsl-chat-primary);
}

/* ============================================
   Category Suggestions (legacy pill links)
   ============================================ */
.tabsl-chat-category-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    max-width: 90%;
    background: var(--tabsl-chat-bg-white);
    border-radius: 12px;
    box-shadow: 0 1px 2px var(--tabsl-chat-shadow);
    animation: tabsl-chat-message-slide-in 0.3s ease-out;
}

.tabsl-chat-category-label {
    font-size: 11px;
    color: var(--tabsl-chat-text-light);
    font-weight: 500;
    width: 100%;
    margin-bottom: 2px;
}

.tabsl-chat-category-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--tabsl-chat-primary);
    background: rgba(74, 144, 217, 0.08);
    border: 1px solid rgba(74, 144, 217, 0.2);
    border-radius: 16px;
    padding: 5px 12px;
    text-decoration: none;
    transition: all 0.2s;
}

.tabsl-chat-category-link:hover {
    background: var(--tabsl-chat-primary);
    color: #fff;
    border-color: var(--tabsl-chat-primary);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(74, 144, 217, 0.3);
}

/* ============================================
   Manufacturer Suggestions
   ============================================ */
.tabsl-chat-manufacturer-link {
    color: #8b5e3c;
    background: rgba(139, 94, 60, 0.08);
    border-color: rgba(139, 94, 60, 0.2);
}

.tabsl-chat-manufacturer-link:hover {
    background: #8b5e3c;
    color: #fff;
    border-color: #8b5e3c;
    box-shadow: 0 2px 6px rgba(139, 94, 60, 0.3);
}

/* ============================================
   Chat Suggestions (Quick-Start Chips)
   ============================================ */
.tabsl-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    max-width: 100%;
    width: 100%;
    animation: tabsl-chat-message-slide-in 0.3s ease-out;
}

.tabsl-chat-suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--tabsl-chat-primary);
    background: rgba(74, 144, 217, 0.08);
    border: 1px solid rgba(74, 144, 217, 0.25);
    border-radius: 18px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.3;
}

.tabsl-chat-suggestion-chip:hover {
    background: var(--tabsl-chat-primary);
    color: #fff;
    border-color: var(--tabsl-chat-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

.tabsl-chat-suggestion-chip:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ============================================
   Input Area
   ============================================ */
.tabsl-chat-input-container {
    padding: 12px 16px;
    background: var(--tabsl-chat-bg-white);
    border-top: 1px solid var(--tabsl-chat-border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.tabsl-chat-input-wrapper {
    flex: 1;
    position: relative;
}

.tabsl-chat-input {
    width: 100%;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    border: 1px solid var(--tabsl-chat-border);
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    color: var(--tabsl-chat-text-primary);
    background: var(--tabsl-chat-bg-gray);
    resize: none;
    overflow-y: auto;
    transition: border-color var(--tabsl-chat-transition),
                background-color var(--tabsl-chat-transition);
}

.tabsl-chat-input:focus {
    outline: none;
    border-color: var(--tabsl-chat-primary);
    background: var(--tabsl-chat-bg-white);
}

.tabsl-chat-input::placeholder {
    color: var(--tabsl-chat-text-light);
}

.tabsl-chat-input::-webkit-scrollbar {
    width: 4px;
}

.tabsl-chat-input::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.tabsl-chat-send-button {
    width: 40px;
    height: 40px;
    background: var(--tabsl-chat-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: background-color var(--tabsl-chat-transition),
                transform 0.1s ease;
}

.tabsl-chat-send-button:hover {
    background: var(--tabsl-chat-primary-hover);
}

.tabsl-chat-send-button:active {
    background: var(--tabsl-chat-primary-active);
    transform: scale(0.95);
}

.tabsl-chat-send-button:disabled {
    background: var(--tabsl-chat-border);
    cursor: not-allowed;
    transform: none;
}

.tabsl-chat-send-icon {
    width: 20px;
    height: 20px;
    fill: var(--tabsl-chat-bg-white);
}

/* ============================================
   Mobile Overlay (Below 480px)
   ============================================ */
@media (max-width: 480px) {
    .tabsl-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        transform: translateY(100%);
    }

    .tabsl-chat-window.tabsl-chat-window--open {
        transform: translateY(0);
    }

    .tabsl-chat-header {
        border-radius: 0;
        padding: 16px 20px;
        padding-top: calc(16px + env(safe-area-inset-top));
    }

    .tabsl-chat-bubble {
        bottom: 16px;
        right: 16px;
    }

    .tabsl-chat-products-container {
        max-width: 100%;
    }

    .tabsl-chat-input-container {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* ============================================
   Tablet & Desktop Responsiveness
   ============================================ */
@media (max-width: 768px) and (min-width: 481px) {
    .tabsl-chat-window {
        width: 340px;
        height: 480px;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .tabsl-chat-window {
        width: 420px;
        height: 600px;
    }
}

/* ============================================
   Full Page Mode
   ============================================ */
.tabsl-chat-window.tabsl-chat-window--fullpage {
    position: relative;
    bottom: auto;
    right: auto;
    width: 100%;
    height: 600px;
    border-radius: 12px;
    border: 1px solid var(--tabsl-chat-border);
    opacity: 1;
    visibility: visible;
    transform: none;
    z-index: auto;
    box-shadow: 0 2px 12px var(--tabsl-chat-shadow-lg);
}

.tabsl-chat-window--fullpage .tabsl-chat-products-container,
.tabsl-chat-window--fullpage .tabsl-chat-category-suggestions {
    max-width: 100%;
}

@media (min-width: 768px) {
    .tabsl-chat-window.tabsl-chat-window--fullpage {
        height: 650px;
    }
}

@media (min-width: 1200px) {
    .tabsl-chat-window.tabsl-chat-window--fullpage {
        height: 700px;
    }
}

@media (max-width: 480px) {
    .tabsl-chat-window.tabsl-chat-window--fullpage {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        max-width: 100%;
        height: 500px;
        border-radius: 12px;
        transform: none;
    }
}

/* ============================================
   Message List Variations
   ============================================ */
.tabsl-chat-message-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
}

.tabsl-chat-message-list-item {
    font-size: 14px;
    color: var(--tabsl-chat-text-primary);
    line-height: 1.5;
    padding-left: 20px;
    position: relative;
}

.tabsl-chat-message-list-item::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: var(--tabsl-chat-primary);
}

/* ============================================
   Quick Reply Suggestions
   ============================================ */
.tabsl-chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.tabsl-chat-quick-reply {
    background: var(--tabsl-chat-bg-white);
    border: 1px solid var(--tabsl-chat-border);
    border-radius: 16px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--tabsl-chat-text-primary);
    cursor: pointer;
    transition: background-color var(--tabsl-chat-transition),
                border-color var(--tabsl-chat-transition);
}

.tabsl-chat-quick-reply:hover {
    background: var(--tabsl-chat-secondary);
    border-color: var(--tabsl-chat-primary);
}

.tabsl-chat-quick-reply:active {
    background: var(--tabsl-chat-border);
}

/* ============================================
   Error States
   ============================================ */
.tabsl-chat-error-message {
    background: #FFF3F3;
    border-left: 3px solid var(--tabsl-chat-error);
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--tabsl-chat-text-primary);
    font-size: 13px;
    line-height: 1.4;
}

.tabsl-chat-error-message-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--tabsl-chat-error);
}

/* ============================================
   Loading States
   ============================================ */
.tabsl-chat-loading {
    display: flex;
    justify-content: center;
    padding: 16px;
}

.tabsl-chat-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--tabsl-chat-border);
    border-top-color: var(--tabsl-chat-primary);
    border-radius: 50%;
    animation: tabsl-chat-spin 0.8s linear infinite;
}

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

/* ============================================
   Welcome Message
   ============================================ */
.tabsl-chat-welcome {
    text-align: center;
    padding: 24px 16px;
    color: var(--tabsl-chat-text-secondary);
}

.tabsl-chat-welcome-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    opacity: 0.6;
}

.tabsl-chat-welcome-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--tabsl-chat-text-primary);
    margin: 0 0 8px 0;
}

.tabsl-chat-welcome-text {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* ============================================
   Accessibility Improvements
   ============================================ */
.tabsl-chat-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
.tabsl-chat-bubble:focus-visible,
.tabsl-chat-close-button:focus-visible,
.tabsl-chat-send-button:focus-visible,
.tabsl-chat-product-button:focus-visible,
.tabsl-chat-quick-reply:focus-visible {
    outline: 2px solid var(--tabsl-chat-primary);
    outline-offset: 2px;
}

.tabsl-chat-input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

/* ============================================
   Reduced Motion Support
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Feedback Buttons
   ============================================ */
.tabsl-chat-feedback {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    padding-left: 2px;
}

.tabsl-chat-feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--tabsl-chat-text-light);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

.tabsl-chat-feedback-btn svg {
    width: 18px;
    height: 18px;
}

.tabsl-chat-feedback-btn:hover:not(.tabsl-chat-feedback-btn--selected) {
    transform: scale(1.2);
}

.tabsl-chat-feedback-btn--positive:hover:not(.tabsl-chat-feedback-btn--selected) {
    color: #31A24C;
}

.tabsl-chat-feedback-btn--neutral:hover:not(.tabsl-chat-feedback-btn--selected) {
    color: #E8A317;
}

.tabsl-chat-feedback-btn--negative:hover:not(.tabsl-chat-feedback-btn--selected) {
    color: #E41E3F;
}

.tabsl-chat-feedback-btn--selected.tabsl-chat-feedback-btn--positive {
    color: #31A24C;
}

.tabsl-chat-feedback-btn--selected.tabsl-chat-feedback-btn--neutral {
    color: #E8A317;
}

.tabsl-chat-feedback-btn--selected.tabsl-chat-feedback-btn--negative {
    color: #E41E3F;
}

.tabsl-chat-feedback--voted .tabsl-chat-feedback-btn:not(.tabsl-chat-feedback-btn--selected) {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.tabsl-chat-feedback-btn:focus-visible {
    outline: 2px solid var(--tabsl-chat-primary);
    outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .tabsl-chat-bubble,
    .tabsl-chat-window {
        display: none !important;
    }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */
@media (prefers-contrast: high) {
    .tabsl-chat-message-bubble,
    .tabsl-chat-product-card,
    .tabsl-chat-input {
        border: 2px solid currentColor;
    }

    .tabsl-chat-bubble,
    .tabsl-chat-send-button,
    .tabsl-chat-product-button--primary {
        border: 2px solid var(--tabsl-chat-bg-white);
    }
}

/* ============================================
   Dark Mode Support (Optional Future Enhancement)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Currently maintaining light theme for consistency
       Can be extended later if dark mode is required */
}
