/* AddonLab AI Review Summarizer Button Styles */

.addonlab-ai-review-summarizer-button {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 5px 10px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
    vertical-align: middle !important;
    line-height: normal !important;
}

.addonlab-ai-review-summarizer-button svg {
    flex-shrink: 0 !important;
    vertical-align: middle !important;
}

.addonlab-ai-review-summarizer-button:hover {
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4) !important;
    transform: translateY(-2px) !important;
}

.addonlab-ai-review-summarizer-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
}

.addonlab-ai-review-summarizer-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.addonlab-ai-review-summarizer-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Container for h2 and button */
.rey-wcPanel-inner h2 {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
}

/* Chat Popup Modal Styles */
.cs-chat-popup.addonlab-ai-chat-popup {
    position: fixed;
    bottom: 40px;
    right: 40px;
    display: none;
    z-index: 9999999;
}

.cs-chat-popup.is-active {
    display: block !important;
}

.cs-chat-popup-container {
    width: 650px;
    max-width: calc(100vw - 80px);
    max-height: 800px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.cs-chat-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.header-button {
    background: transparent;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.header-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.header-button iconify-icon {
    display: block;
    color: white;
}

.header-title iconify-icon {
    vertical-align: middle;
}

/* Chat Body */
.cs-chat-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.cs-chat-thread {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Chat Messages */
.cs-chat-message {
    display: flex;
    width: 100%;
}

.cs-chat-message.is-system {
    justify-content: flex-start;
}

.cs-chat-message.is-user {
    justify-content: flex-end;
}

.cs-chat-message-bubble {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
}

.cs-chat-message-bubble.is-system {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.cs-chat-message-bubble.is-user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.cs-chat-message-bubble p {
    margin: 0 0 8px 0;
    line-height: 1.5;
    padding-bottom: 0 !important;
}

.cs-chat-message-bubble p:last-child {
    margin-bottom: 0;
}

.cs-chat-message-bubble strong {
    font-weight: 600;
    color: #333;
    display: block;
    margin: 12px 0 6px 0;
}

.cs-chat-message-bubble h3 {
    font-size: 16px;
    margin: 12px 0 8px 0;
    font-weight: 600;
}

.cs-chat-message-bubble ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style: none;
}

.cs-chat-message-bubble li {
    margin: 6px 0;
    line-height: 1.5;
    position: relative;
    padding-left: 0;
}

.cs-chat-message-bubble li:before {
    content: "•";
    position: absolute;
    left: -15px;
    font-weight: bold;
}

/* Actions (Thumbs up/down) */
.cs-chat-message .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.cs-chat-message .actions span {
    font-size: 13px;
    color: #666;
}

.cs-chat-message .actions .button {
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.cs-chat-message .actions .button:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.cs-chat-message .actions .button iconify-icon {
    display: block;
}

.cs-chat-message .actions .button.clicked {
    background: #46b450;
    border-color: #46b450;
    color: white;
    cursor: default;
}

.cs-chat-message .actions .button:disabled {
    cursor: not-allowed;
}

/* Loading State */
.cs-chat-message.is-loading .cs-chat-message-bubble {
    background: #f0f0f0;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .addonlab-ai-review-summarizer-button {
        font-size: 13px !important;
        padding: 5px 10px !important;
        margin: 0 !important;
    }

    .rey-wcPanel-inner h2 {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        flex-wrap: wrap !important;
    }

    .cs-chat-popup.addonlab-ai-chat-popup {
        bottom: 20px;
        right: 20px;
        left: 20px;
    }

    .cs-chat-popup-container {
        width: 100%;
        max-width: 100%;
        max-height: 500px;
        border-radius: 12px;
    }

    .cs-chat-popup-header {
        padding: 12px 16px;
    }

    .header-title {
        font-size: 16px;
    }

    .header-button {
        width: 36px;
        height: 36px;
    }

    .header-button iconify-icon {
        width: 24px;
        height: 24px;
    }

    .cs-chat-popup-body {
        padding: 16px;
    }

    .cs-chat-message-bubble {
        max-width: 90%;
        font-size: 14px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .cs-chat-popup.addonlab-ai-chat-popup {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .cs-chat-popup-container {
        max-height: 450px;
    }
}
