/* Floating Chat Toggle Button */
#wc-ai-chat-toggle {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0073aa;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    visibility: visible;
    opacity: 1;
    margin: 0;
    padding: 0;
    line-height: 1;
    font-size: 0;
}

#wc-ai-chat-toggle:hover {
    background: #005a87;
    transform: scale(1.1);
}

#wc-ai-chat-toggle img {
    width: 30px;
    height: 30px;
    display: block;
}

#wc-ai-chat-toggle svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* Disclaimer Banner */
.wc-ai-chat-disclaimer {
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
    padding: 8px 15px;
    font-size: 12px;
    line-height: 1.4;
    color: #856404;
}

.wc-ai-chat-disclaimer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wc-ai-chat-disclaimer-text {
    flex: 1;
}

.wc-ai-chat-disclaimer-link {
    color: #856404;
    text-decoration: underline;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.wc-ai-chat-disclaimer-link:hover {
    color: #533f03;
}

/* Disclaimer Modal */
.wc-ai-chat-disclaimer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-ai-chat-disclaimer-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.wc-ai-chat-disclaimer-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.wc-ai-chat-disclaimer-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wc-ai-chat-disclaimer-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.wc-ai-chat-disclaimer-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.wc-ai-chat-disclaimer-modal-close:hover {
    background: #f0f0f0;
    color: #000;
}

.wc-ai-chat-disclaimer-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.6;
    color: #333;
}

/* Prompt Guides */
.wc-ai-chat-prompt-guides {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.wc-ai-chat-prompt-guides-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
}

.wc-ai-chat-prompt-guides-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wc-ai-chat-prompt-guide-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #333;
    text-align: left;
    width: 100%;
}

.wc-ai-chat-prompt-guide-item:hover {
    background: #f0f7ff;
    border-color: #0073aa;
    color: #0073aa;
}

.wc-ai-chat-prompt-guide-item:active {
    transform: scale(0.98);
}

/* Position variants - using ID selector for higher specificity */
#wc-ai-chat-toggle.wc-ai-chat-bottom-right {
    bottom: 20px;
    right: 20px;
    top: auto;
    left: auto;
}

#wc-ai-chat-toggle.wc-ai-chat-bottom-left {
    bottom: 20px;
    left: 20px;
    top: auto;
    right: auto;
}

#wc-ai-chat-toggle.wc-ai-chat-top-right {
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;
}

#wc-ai-chat-toggle.wc-ai-chat-top-left {
    top: 20px;
    left: 20px;
    bottom: auto;
    right: auto;
}

/* Chat Container */
#wc-ai-chat-container {
    position: fixed;
    width: 400px;
    height: 600px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    z-index: 999999;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    transition: width 0.3s ease;
}

#wc-ai-chat-container.sidebar-open {
    width: 680px;
}

#wc-ai-chat-container.wc-ai-chat-shortcode {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
}

#wc-ai-chat-container.wc-ai-chat-bottom-right {
    bottom: 90px;
    right: 20px;
}

#wc-ai-chat-container.wc-ai-chat-bottom-left {
    bottom: 90px;
    left: 20px;
}

#wc-ai-chat-container.wc-ai-chat-top-right {
    top: 90px;
    right: 20px;
}

#wc-ai-chat-container.wc-ai-chat-top-left {
    top: 90px;
    left: 20px;
}

/* Chat Sidebar */
.wc-ai-chat-sidebar {
    width: 0;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

#wc-ai-chat-container.sidebar-open .wc-ai-chat-sidebar {
    width: 280px;
    opacity: 1;
    visibility: visible;
}

.wc-ai-chat-sidebar-header {
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.wc-ai-chat-new-chat {
    flex: 1;
    padding: 8px 12px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

.wc-ai-chat-new-chat:hover {
    background: #005a87;
}

.wc-ai-chat-new-chat svg {
    width: 16px;
    height: 16px;
}

.wc-ai-chat-sidebar-close {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-ai-chat-sidebar-close:hover {
    color: #333;
}

.wc-ai-chat-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.wc-ai-chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wc-ai-chat-history-item {
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.wc-ai-chat-history-item:hover {
    background: #f0f0f0;
    border-color: #e0e0e0;
}

.wc-ai-chat-history-item.active {
    background: #e3f2fd;
    border-color: #0073aa;
}

.wc-ai-chat-history-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wc-ai-chat-history-item.active .wc-ai-chat-history-item-title {
    color: #0073aa;
}

.wc-ai-chat-history-item-date {
    font-size: 12px;
    color: #666;
}

.wc-ai-chat-history-loading,
.wc-ai-chat-history-loading-more,
.wc-ai-chat-history-empty,
.wc-ai-chat-history-error {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.wc-ai-chat-history-error {
    color: #dc3232;
}

.wc-ai-chat-history-load-more {
    padding: 15px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.wc-ai-chat-history-load-more-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.wc-ai-chat-history-load-more-btn:hover {
    background: #005a87;
}

.wc-ai-chat-history-load-more-btn:active {
    transform: scale(0.98);
}

/* Chat Main Area */
.wc-ai-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Ensure disclaimer is always at top and visible */
.wc-ai-chat-main {
    display: flex;
    flex-direction: column;
}

.wc-ai-chat-main .wc-ai-chat-disclaimer {
    order: 1;
    flex-shrink: 0;
    z-index: 10;
}

.wc-ai-chat-main .wc-ai-chat-header {
    order: 2;
    flex-shrink: 0;
}

.wc-ai-chat-main .wc-ai-chat-messages {
    order: 3;
}

.wc-ai-chat-main .wc-ai-chat-prompt-guides {
    order: 4;
    flex-shrink: 0;
}

.wc-ai-chat-main .wc-ai-chat-input-container {
    order: 5;
    flex-shrink: 0;
}

/* Chat Header */
.wc-ai-chat-header {
    background: #0073aa;
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.wc-ai-chat-history-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    flex-shrink: 0;
}

.wc-ai-chat-history-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.wc-ai-chat-history-toggle svg {
    width: 20px;
    height: 20px;
}

.wc-ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wc-ai-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.wc-ai-chat-avatar-default {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0073aa;
    font-weight: bold;
}

.wc-ai-chat-bot-name {
    font-weight: 600;
    font-size: 16px;
}

.wc-ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.wc-ai-chat-close:hover {
    opacity: 0.8;
}

/* Chat Messages */
.wc-ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wc-ai-message {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.wc-ai-message-user {
    flex-direction: row-reverse;
}

.wc-ai-message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    font-size: 12px;
    font-weight: 600;
}

.wc-ai-message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.wc-ai-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.wc-ai-message-user .wc-ai-message-content {
    background: #0073aa;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.wc-ai-message-assistant .wc-ai-message-content {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.wc-ai-message-content h1,
.wc-ai-message-content h2,
.wc-ai-message-content h3 {
    margin-top: 10px;
    margin-bottom: 10px;
}

.wc-ai-message-content h1:first-child,
.wc-ai-message-content h2:first-child,
.wc-ai-message-content h3:first-child {
    margin-top: 0;
}

.wc-ai-message-content p {
    margin: 8px 0;
}

.wc-ai-message-content ul,
.wc-ai-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.wc-ai-message-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.wc-ai-message-content pre {
    background: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
}

.wc-ai-message-content pre code {
    background: none;
    padding: 0;
}

.wc-ai-message-content a {
    color: #0073aa;
    text-decoration: underline;
}

/* Typing Indicator */
.wc-ai-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    margin-bottom: 20px;
    width: fit-content;
}

.wc-ai-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.wc-ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.wc-ai-typing-indicator 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;
    }
}

/* Chat Input */
.wc-ai-chat-input-container {
    display: flex;
    padding: 15px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
}

.wc-ai-chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.wc-ai-chat-input:focus {
    border-color: #0073aa;
}

.wc-ai-chat-send {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.wc-ai-chat-send:hover {
    background: #005a87;
}

/* Product Card */
.wc-ai-product-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 10px 0;
    overflow: hidden;
}

.wc-ai-product-card-image-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    margin: 0;
}

.wc-ai-product-card-main-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-ai-product-card-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.wc-ai-product-card-thumbnails {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 15px;
    background: #fafafa;
}

.wc-ai-product-card-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 0.2s ease;
    background: #f5f5f5;
}

.wc-ai-product-card-thumb:hover {
    opacity: 1;
    border-color: #0073aa;
    transform: scale(1.05);
}

.wc-ai-product-card-thumb.active {
    opacity: 1;
    border-color: #0073aa;
}

.wc-ai-product-card-content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wc-ai-product-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.wc-ai-product-card-title a {
    color: #0073aa;
    text-decoration: none;
}

.wc-ai-product-card-title a:hover {
    text-decoration: underline;
}

.wc-ai-product-card-type {
    margin: 0 0 8px 0;
}

.wc-ai-product-type-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.wc-ai-product-card-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

.wc-ai-product-card-price {
    font-size: 20px;
    font-weight: 600;
    color: #0073aa;
    margin: 0;
}

.wc-ai-product-card-stock {
    font-size: 13px;
    margin: 0;
}

.wc-ai-product-card-stock.status-in-stock {
    color: #46b450;
}

.wc-ai-product-card-stock.status-out-of-stock {
    color: #dc3232;
}

.wc-ai-product-card-actions {
    display: flex;
    gap: 10px;
}

.wc-ai-product-card-view,
.wc-ai-product-card-add-to-cart {
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.wc-ai-product-card-view {
    background: #f0f0f0;
    color: #333;
}

.wc-ai-product-card-view:hover {
    background: #e0e0e0;
}

.wc-ai-product-card-add-to-cart {
    background: #0073aa;
    color: #fff;
}

.wc-ai-product-card-add-to-cart:hover {
    background: #005a87;
}

.wc-ai-product-card-note {
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 13px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
}

/* Loading and Error States */
.wc-ai-chat-loading,
.wc-ai-chat-error {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.wc-ai-chat-error {
    color: #dc3232;
}

/* Responsive */
@media (max-width: 768px) {
    #wc-ai-chat-container {
        width: calc(100% - 40px);
        height: calc(100vh - 120px);
        max-width: 400px;
    }

    #wc-ai-chat-container.wc-ai-chat-bottom-right,
    #wc-ai-chat-container.wc-ai-chat-bottom-left {
        bottom: 90px;
        left: 20px;
        right: 20px;
    }

    #wc-ai-chat-container.sidebar-open {
        width: calc(100% - 40px);
    }

    #wc-ai-chat-container.sidebar-open .wc-ai-chat-sidebar {
        width: 100%;
    }

    #wc-ai-chat-container.sidebar-open .wc-ai-chat-main {
        display: none;
    }
}

