/* AI Assisted Listing Chat Styles - Matching Smart Search Chat */
/* Override the existing assisted-listing.css styles to match smart-search-chat.css */

/* Main chat container */
.chat-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

/* Chat messages container */
#chatMessages {
    padding: 20px;
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    /* Prevent layout shift during content updates */
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
}

/* AI Message Styles - matching smart search */
.ai-message {
    margin-bottom: 15px;
    max-width: 80%;
    align-self: flex-start;
}

.ai-message .message-content {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 15px 15px 15px 5px;
    color: var(--theme-dark-gray, #343a40);
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* User Message Styles - matching smart search orange theme */
.user-message-assisted,
.user-message {
    align-self: flex-end;
    margin-bottom: 15px;
    margin-left: auto;
    width: fit-content;
    max-width: 70%;
    word-wrap: break-word;
}

.user-message-assisted .message-content,
.user-message .message-content {
    background: linear-gradient(135deg, var(--theme-orange, #F15A29) 0%, var(--theme-orange-dark, #d64c20) 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 15px 15px 5px 15px;
    box-shadow: 0 4px 12px rgba(241, 90, 41, 0.25);
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.5;
}

/* AI Chat input area - make it specific to the AI form */
#aiAssistedForm .input-group {
    background: #f8f9fa;
    border-radius: 25px;
    padding: 4px;
    border: 1px solid #e1e5e9;
    transition: all 0.3s ease;
}

#aiAssistedForm .input-group:focus-within {
    border-color: var(--theme-orange, #F15A29);
    box-shadow: 0 0 0 3px rgba(241, 90, 41, 0.1);
}

/* Input field styling - specific to AI chat */
#aiAssistedForm #userMessage {
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 1rem;
    outline: none;
    border-radius: 20px;
}

#aiAssistedForm #userMessage::placeholder {
    color: #6c757d;
}

/* Send button styling - specific to AI chat */
#aiAssistedForm #sendMessage {
    background: linear-gradient(135deg, var(--theme-orange, #F15A29) 0%, var(--theme-orange-dark, #d64c20) 100%);
    border: none;
    color: white;
    border-radius: 20px;
    padding: 10px 16px;
    margin-left: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(241, 90, 41, 0.3);
    min-width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#aiAssistedForm #sendMessage:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(241, 90, 41, 0.4);
}

/* Upload button styling - specific to AI chat */
#aiAssistedForm #uploadButton {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e1e5e9;
    color: var(--theme-orange, #F15A29);
    border-radius: 20px;
    padding: 10px 16px;
    margin-left: 8px;
    transition: all 0.3s ease;
    min-width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#aiAssistedForm #uploadButton:hover {
    background: var(--theme-orange, #F15A29);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(241, 90, 41, 0.3);
}

/* Ensure manual form input groups remain unchanged */
#manualListingForm .input-group {
    /* Reset any inherited styles */
    background: transparent;
    border-radius: 0.375rem;
    padding: 0;
    border: none;
    box-shadow: none;
}

#manualListingForm .input-group:focus-within {
    border: none;
    box-shadow: none;
}

/* Typing indicator matching smart search */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    gap: 4px;
}

.typing-indicator span,
.typing-indicator .dot,
.typing-dot {
    height: 8px;
    width: 8px;
    border-radius: 50%;
    background-color: var(--theme-orange, #F15A29);
    display: inline-block;
    margin-right: 3px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1),
.typing-indicator .dot:nth-child(1),
.typing-dot:nth-child(1) { animation-delay: -0.32s; }

.typing-indicator span:nth-child(2),
.typing-indicator .dot:nth-child(2),
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

.typing-indicator span:nth-child(3),
.typing-indicator .dot:nth-child(3),
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Listing preview section */
#previewSection {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e1e5e9;
}

#listingPreview {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Submit button styling */
#submitAiListing {
    background: linear-gradient(135deg, var(--theme-orange, #F15A29) 0%, var(--theme-orange-dark, #d64c20) 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(241, 90, 41, 0.3);
}

#submitAiListing:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(241, 90, 41, 0.4);
}

/* Suggestion buttons for preview prompts */
.suggestion-buttons {
    margin: 15px 0;
}

.preview-yes-btn {
    background: linear-gradient(135deg, var(--theme-orange, #F15A29) 0%, var(--theme-orange-dark, #d64c20) 100%);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(241, 90, 41, 0.3);
}

.preview-yes-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(241, 90, 41, 0.4);
    color: white;
}

.preview-no-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e1e5e9;
    color: #6c757d;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.preview-no-btn:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
}

/* Image upload and analysis styles */
.uploaded-image-container {
    position: relative;
    display: inline-block;
    margin: 10px 0;
}

.uploaded-hardware-thumbnail {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    border: 2px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.uploaded-hardware-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--theme-orange, #F15A29);
}

.image-analysis-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Analysis progress indicators */
.analysis-progress .analysis-stages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analysis-stages .stage {
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8f9fa;
    color: #6c757d;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.analysis-stages .stage.active {
    background: linear-gradient(135deg, rgba(241, 90, 41, 0.1) 0%, rgba(241, 90, 41, 0.05) 100%);
    color: var(--theme-orange, #F15A29);
    font-weight: 500;
    border-color: rgba(241, 90, 41, 0.2);
}

.analysis-stages .stage.completed {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(40, 167, 69, 0.05) 100%);
    color: #28a745;
    border-color: rgba(40, 167, 69, 0.2);
}

.analysis-stages .stage i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

/* Error message styling */
.ai-message.error .message-content {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* Alert styling within messages */
.message-content .alert {
    margin: 0;
    border-radius: 8px;
}

/* Listing preview specific styles */
.listing-preview-container {
    font-family: inherit;
}

.listing-title {
    color: var(--theme-dark-gray, #343a40);
    font-weight: 600;
    margin-bottom: 12px;
}

.listing-price .badge {
    font-size: 1rem;
    padding: 8px 12px;
}

.listing-category .badge {
    font-size: 0.85rem;
    padding: 6px 10px;
}

.listing-specs .specs-list {
    list-style: none;
    padding-left: 0;
}

.listing-specs .specs-list li {
    padding: 4px 0;
    border-bottom: 1px solid #f1f3f4;
}

.listing-specs .specs-list li:last-child {
    border-bottom: none;
}

.listing-warning {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    border-left: 4px solid var(--theme-orange, #F15A29);
}

/* Image counter badge */
.image-counter-badge {
    margin-top: 12px;
    text-align: center;
}

.image-counter-badge .badge {
    background: linear-gradient(135deg, var(--theme-orange, #F15A29) 0%, var(--theme-orange-dark, #d64c20) 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-message,
    .user-message-assisted,
    .user-message {
        max-width: 90%;
    }

    #chatMessages {
        padding: 15px;
        max-height: 350px;
    }

    .ai-message .message-content,
    .user-message-assisted .message-content,
    .user-message .message-content {
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    #aiAssistedForm #sendMessage,
    #aiAssistedForm #uploadButton {
        min-width: 44px;
        height: 44px;
        padding: 8px 12px;
    }
}

/* AI disclaimer styling */
.ai-disclaimer {
    background: rgba(241, 90, 41, 0.05);
    border: 1px solid rgba(241, 90, 41, 0.1);
    border-radius: 8px;
    color: #6c757d;
}

.ai-disclaimer a {
    color: var(--theme-orange, #F15A29);
    text-decoration: none;
}

.ai-disclaimer a:hover {
    text-decoration: underline;
}

/* Listing Mode Toggle Styling */
.listing-mode-toggle {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.listing-mode-toggle .form-check-input {
    width: 3rem;
    height: 1.5rem;
    background-color: #dee2e6;
    border: 2px solid #dee2e6;
    border-radius: 2rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.listing-mode-toggle .form-check-input:checked {
    background-color: var(--theme-orange, #F15A29);
    border-color: var(--theme-orange, #F15A29);
    background-image: none;
}

.listing-mode-toggle .form-check-input:focus {
    border-color: var(--theme-orange, #F15A29);
    box-shadow: 0 0 0 0.25rem rgba(241, 90, 41, 0.25);
}

.listing-mode-toggle .form-check-input:checked:focus {
    border-color: var(--theme-orange-dark, #d64c20);
    box-shadow: 0 0 0 0.25rem rgba(241, 90, 41, 0.25);
}

/* Label styling */
.listing-mode-toggle .form-check-label {
    font-size: 1.1rem;
    margin-left: 0.75rem;
    cursor: pointer;
}

.listing-mode-toggle #legacyLabel {
    color: #6c757d;
    transition: all 0.3s ease;
}

.listing-mode-toggle #assistedLabel {
    color: #6c757d;
    transition: all 0.3s ease;
}

/* Active state styling */
.listing-mode-toggle .form-check-input:not(:checked) ~ .form-check-label #legacyLabel {
    color: var(--theme-orange, #F15A29);
    font-weight: 700;
}

.listing-mode-toggle .form-check-input:checked ~ .form-check-label #assistedLabel {
    color: var(--theme-orange, #F15A29);
    font-weight: 700;
}

/* Hover effects */
.listing-mode-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.listing-mode-toggle .form-check-input:hover {
    transform: scale(1.05);
}

/* Additional polish */
.listing-mode-toggle > div > span:first-child {
    color: var(--theme-dark-gray, #343a40);
    font-size: 1.1rem;
}

.listing-mode-toggle .mx-1 {
    color: #adb5bd;
    font-weight: 300;
}

/* Image analysis */
.image-analysis-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    border: 2px solid white;
    transition: all 0.2s ease;
}

.image-analysis-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}