:root {
    --shop-assistant-primary: #0073aa;
    --shop-assistant-primary-dark: #005a87;
    --shop-assistant-bg: #ffffff;
    --shop-assistant-text: #1e1e1e;
    --shop-assistant-border: #e0e0e0;
    --shop-assistant-shadow: rgba(0, 0, 0, 0.1);
    --shop-assistant-user-bg: #f0f0f0;
}

/* Widget Container */
.shop-assistant-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.shop-assistant-widget.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.shop-assistant-widget.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Toggle Button */
.shop-assistant-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--shop-assistant-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--shop-assistant-shadow);
    transition: all 0.3s ease;
}

.shop-assistant-toggle:hover {
    background: var(--shop-assistant-primary-dark);
    transform: scale(1.05);
}

.shop-assistant-toggle:active {
    transform: scale(0.95);
}

/* Chat Container */
.shop-assistant-container {
    display: flex;
    flex-direction: column;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: var(--shop-assistant-bg);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Header */
.shop-assistant-header {
    background: var(--shop-assistant-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shop-assistant-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.shop-assistant-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-assistant-new-chat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px !important;
    border: 1px solid white !important;
}

.shop-assistant-new-chat-btn,
.shop-assistant-close-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.shop-assistant-new-chat-btn:hover,
.shop-assistant-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
.shop-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shop-assistant-messages::-webkit-scrollbar {
    width: 6px;
}

.shop-assistant-messages::-webkit-scrollbar-track {
    background: transparent;
}

.shop-assistant-messages::-webkit-scrollbar-thumb {
    background: var(--shop-assistant-border);
    border-radius: 3px;
}

.shop-assistant-messages::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Messages */
.shop-assistant-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 85%;
}

.shop-assistant-message-user {
    align-self: flex-end;
}

.shop-assistant-message-assistant {
    align-self: flex-start;
}

.shop-assistant-message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.shop-assistant-message-user .shop-assistant-message-content {
    background: var(--shop-assistant-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.shop-assistant-message-assistant .shop-assistant-message-content {
    background: var(--shop-assistant-user-bg);
    color: var(--shop-assistant-text);
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.shop-assistant-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.shop-assistant-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
    animation: typing 1.4s infinite;
}

.shop-assistant-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.shop-assistant-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Product Cards */
.shop-assistant-products {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.shop-assistant-product-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid var(--shop-assistant-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--shop-assistant-text);
    transition: all 0.2s;
}

.shop-assistant-product-card:hover {
    box-shadow: 0 2px 8px var(--shop-assistant-shadow);
    transform: translateY(-2px);
}

.shop-assistant-product-card .product-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
}

.shop-assistant-product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-assistant-product-card .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shop-assistant-product-card h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--shop-assistant-text);
    line-height: 1.3;
}

.shop-assistant-product-card .product-price {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--shop-assistant-primary);
}

/* Input Area */
.shop-assistant-input-container {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--shop-assistant-border);
    background: var(--shop-assistant-bg);
}

.shop-assistant-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--shop-assistant-border);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.shop-assistant-input:focus {
    border-color: var(--shop-assistant-primary);
}

.shop-assistant-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--shop-assistant-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.shop-assistant-send-btn:hover {
    background: var(--shop-assistant-primary-dark);
}

.shop-assistant-send-btn:active {
    transform: scale(0.9);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .shop-assistant-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }

    .shop-assistant-widget.position-bottom-right,
    .shop-assistant-widget.position-bottom-left {
        right: 20px;
        left: 20px;
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .shop-assistant-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .shop-assistant-widget.position-bottom-right,
    .shop-assistant-widget.position-bottom-left {
        right: 0;
        left: 0;
        bottom: 0;
    }

    .shop-assistant-toggle {
        bottom: 20px;
        right: 20px;
    }
}
