/* AI SEO Reader Chat Widget Styles */

.ai-seo-reader-chat-root {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Position variations */
.ai-seo-reader-chat-root.position-bottom-left {
    left: 20px;
    right: auto;
}

.ai-seo-reader-chat-root.position-bottom-right {
    right: 20px;
    left: auto;
}

/* Chat Launcher Button */
.ai-seo-chat-launcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    transition: all 0.2s ease;
    user-select: none;
}

.ai-seo-chat-launcher:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4);
}

.ai-seo-chat-launcher svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Chat Widget */
.ai-seo-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

/* Widget position variations */
.position-bottom-left .ai-seo-chat-widget {
    left: 20px;
    right: auto;
}

.position-bottom-right .ai-seo-chat-widget {
    right: 20px;
    left: auto;
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #0073aa;
    color: white;
    font-weight: 500;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

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

.ai-seo-chat-close,
.ai-seo-chat-copy {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.ai-seo-chat-close {
    font-size: 20px;
}

.ai-seo-chat-copy {
    font-size: 14px;
}

.ai-seo-chat-close:hover,
.ai-seo-chat-copy:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.ai-seo-chat-copy:active {
    transform: scale(0.95);
}

/* Chat Body */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.welcome-message {
    margin-bottom: 16px;
}

.welcome-message p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.suggested-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestion-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.suggestion-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.chat-message.user {
    align-self: flex-end;
    background: #0073aa;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot {
    align-self: flex-start;
    background: #f3f4f6;
    color: #374151;
    border-bottom-left-radius: 4px;
}

.chat-message.thinking {
    background: #e5e7eb;
    color: #6b7280;
    font-style: italic;
}

/* Content Recommendations */
.content-recommendations {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.recommendation-item {
    display: block;
    padding: 8px 10px;
    margin: 4px 0;
    background: #fafbfc;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    text-decoration: none;
    color: #0073aa;
    font-size: 13px;
    transition: all 0.2s ease;
    position: relative;
}

.recommendation-item:hover {
    background: #f0f6fc;
    border-color: #0073aa;
    text-decoration: none;
    transform: translateX(2px);
}

.recommendation-item:hover .recommendation-indicator {
    opacity: 1;
    transform: translateX(2px);
}

.recommendation-title {
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
    padding-right: 20px;
}

.recommendation-excerpt {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.3;
    padding-right: 20px;
}

.recommendation-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    transition: all 0.2s ease;
    font-weight: bold;
    color: #0073aa;
}

/* Chat Input */
.chat-input {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input input:focus {
    border-color: #0073aa;
}

.chat-input button {
    padding: 10px 12px;
    background: #0073aa;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.chat-input button:hover {
    background: #005a87;
}

.chat-input button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.chat-input button svg {
    width: 16px;
    height: 16px;
}

/* Inline Chat Widget (for shortcode/template tag) */
.ai-seo-chat-inline {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 600px;
    margin: 20px auto;
    display: block;
}

.ai-seo-chat-inline .ai-seo-chat-widget {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 400px !important;
    margin: 0;
    display: flex !important;
}

.ai-seo-chat-inline .ai-seo-chat-launcher {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .ai-seo-chat-floating .ai-seo-chat-widget {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
        border-radius: 8px;
    }
    
    .ai-seo-chat-floating .ai-seo-chat-launcher {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .ai-seo-chat-floating .ai-seo-chat-launcher span {
        display: none;
    }
    
    .ai-seo-chat-inline {
        max-width: none;
        margin: 20px 10px;
    }
}

/* Animation for widget appearance */
.ai-seo-chat-widget {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Scrollbar styling */
.chat-body::-webkit-scrollbar {
    width: 4px;
}

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

.chat-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Back to Suggestions Area */
.back-to-suggestions {
    margin-top: 15px;
}

.show-suggestions-btn {
    transition: all 0.2s ease;
    font-weight: 500;
    text-decoration: none;
}

.show-suggestions-btn:hover {
    background: #005a87 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.hidden-suggestions {
    animation: slideDown 0.3s ease-out;
}

.hidden-suggestions .suggestion-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hidden-suggestions .suggestion-btn {
    font-size: 13px;
    line-height: 1.3;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.hidden-suggestions .suggestion-btn:hover {
    background: #f0f9ff !important;
    border-color: #0073aa !important;
    color: #0073aa;
    transform: translateX(2px);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Analysis Prompt Styles */
.analysis-prompt {
    text-align: center;
    padding: 20px;
}

.analysis-prompt .prompt-message {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.5;
}

.analysis-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.analysis-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 120px;
}

.analysis-btn.primary {
    background: #0073aa;
    color: white;
}

.analysis-btn.primary:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.analysis-btn.secondary {
    background: #f6f7f7;
    color: #666;
    border: 1px solid #ddd;
}

.analysis-btn.secondary:hover {
    background: #e8e9ea;
    border-color: #bbb;
}

.analysis-loading {
    text-align: center;
    padding: 30px 20px;
}

.analysis-loading p {
    font-size: 15px;
    color: #666;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loading-spinner {
    display: flex;
    justify-content: center;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Generated Questions Styles */
.generated-questions {
    animation: slideDown 0.3s ease-out;
}

.generated-questions p {
    text-align: center;
    font-weight: 500;
    color: #0073aa;
    margin-bottom: 15px;
}

.analysis-error {
    text-align: center;
    padding: 20px;
    color: #d63638;
}

.analysis-error p {
    font-size: 14px;
    margin-bottom: 0;
}