/* Main Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

.sidebar {
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 1rem;
    background-color: #007bff;
    color: white;
    margin: -1rem -1rem 1rem -1rem;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    background-color: #fff;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-input-container {
    border-top: 1px solid #dee2e6;
    padding: 1rem;
    background-color: #f8f9fa;
}

.chat-form {
    display: flex;
}

.example-queries {
    margin-top: 0.5rem;
}

.example-query {
    padding: 0.5rem;
    background-color: #e9ecef;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #212529;
    transition: background-color 0.2s;
}

.example-query:hover {
    background-color: #dee2e6;
}

.example-query.dynamic-query {
    background-color: #e6f3ff;
    border-left: 3px solid #007bff;
}

.example-query.dynamic-query:hover {
    background-color: #d6ebff;
}

.example-query-separator {
    margin: 10px 0;
    position: relative;
    text-align: center;
}

.example-query-separator span {
    font-size: 0.75rem;
    color: #6c757d;
    background-color: #f8f9fa;
    padding: 0 10px;
    position: relative;
    z-index: 1;
}

.example-query-separator:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #dee2e6;
    z-index: 0;
}

/* Chat History Styles */
.chat-history {
    max-height: 300px;
    overflow-y: auto;
}

.chat-history-item {
    padding: 0.75rem 0.5rem;
    background-color: #f8f9fa;
    border-left: 3px solid #007bff;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #212529;
    transition: all 0.2s ease;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
}

.chat-history-item.active {
    background-color: #e8f4ff;
    border-left-color: #0056b3;
    transform: translateX(2px);
    font-weight: 500;
}

.chat-history-item:hover {
    background-color: #e9ecef;
    transform: translateX(2px);
}

.chat-history-item .title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
    flex-basis: 70%;
    margin-bottom: 0.2rem;
    font-weight: 500;
}

.chat-history-item .image-indicator {
    font-size: 0.8rem;
    margin-left: 0.3rem;
    opacity: 0.7;
    cursor: help;
}

.chat-history-item .chat-meta {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}

.chat-history-item .date {
    font-size: 0.75rem;
    color: #6c757d;
    margin-right: 0.75rem;
}

.chat-history-item .note {
    font-size: 0.75rem;
    color: #495057;
    background-color: #e9ecef;
    padding: 0.15rem 0.4rem;
    border-radius: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-left: 0.25rem;
    margin-top: 0.1rem;
    transition: all 0.2s ease;
}

.chat-history-item .note:hover {
    max-width: 300px;
    background-color: #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-history-item .delete-btn {
    visibility: hidden;
    color: #dc3545;
    background: none;
    border: none;
    padding: 0;
    margin-left: 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    flex-shrink: 0;
    align-self: flex-start;
}

.chat-history-item:hover .delete-btn {
    visibility: visible;
}

/* Message Styles */
.chat-messages {
    display: flex;
    flex-direction: column;
}

.message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1rem;
    max-width: 85%;
}

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

.message-content {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 0;
}

.message.assistant .message-content {
    background-color: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 0;
}

/* Database error styling */
.message-content.database-error {
    background-color: #ffebee;
    color: #c62828;
    border-left: 3px solid #f44336;
}

/* Responsive Styling */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        z-index: 100;
        width: 100%;
        height: auto;
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* Markdown Styling */
.message-content h1, 
.message-content h2,
.message-content h3 {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.message-content h1 {
    font-size: 1.5rem;
}

.message-content h2 {
    font-size: 1.25rem;
}

.message-content h3 {
    font-size: 1.1rem;
}

.message-content p {
    margin-bottom: 0.5rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul, 
.message-content ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.message-content code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 0.2rem;
}

.message-content pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: 0.2rem;
    overflow-x: auto;
}

/* Table formatting for LLM output */
.message-content table {
    width: 100%;
    margin: 0.5rem 0;
    border-collapse: collapse;
    font-size: 0.85rem;
    border: 1px solid #dee2e6;
}

.message-content table th,
.message-content table td {
    padding: 0.4rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

.message-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.message-content table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.message-content .table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

/* Calculator Page Styles */
.calculation-form {
    background-color: #fff;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.results-container {
    background-color: #fff;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    padding: 1.5rem;
}

.result-card {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.confidence-indicator {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.confidence-level {
    height: 100%;
    background-color: #28a745;
    border-radius: 4px;
}

.breakdown-table {
    width: 100%;
}

.breakdown-table th {
    text-align: left;
}

.similar-motor-card {
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.similar-motor-card .similarity-badge {
    background-color: #007bff;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Loader */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #e9ecef;
    border-radius: 1rem;
    width: fit-content;
    margin-bottom: 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #adb5bd;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing-animation 1.5s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.5s;
}

.typing-dot:nth-child(3) {
    animation-delay: 1s;
}

/* Processing text styles */
.processing-text {
    margin-left: 10px;
    font-size: 0.9rem;
    color: #666;
}

/* Processing stages */
.processing-stages {
    margin-top: 10px;
    margin-left: 20px;
}

.processing-stage {
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #777;
    transition: color 0.3s ease;
}

.stage-bullet {
    margin-right: 5px;
    transition: color 0.3s ease;
}

.stage-complete {
    color: #4CAF50;
}

@keyframes typing-animation {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
    100% {
        transform: translateY(0);
    }
}

/* Photo Upload Styles */
.photo-previews-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    margin-bottom: 8px;
    min-height: 80px;
}

#photo-preview-container {
    border: 1px dotted #ccc;
    border-radius: 4px;
    padding: 8px;
    background: #f9f9f9;
}

.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    margin-bottom: 8px;
    margin-right: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-preview-item:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.image-preview-item.loading {
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-preview-item.loaded {
    background-size: cover;
    background-position: center;
}

.message-image-container {
    margin-top: 0.5rem;
}

.message-image-wrapper {
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.message-image {
    max-width: 150px;
    max-height: 100px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

#upload-photo-btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Drag and drop styles */
.chat-messages.drag-over {
    background-color: rgba(0, 123, 255, 0.1);
    border: 2px dashed #007bff;
}

/* Action button styles */
.message-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.action-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}

.action-button {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.action-button:hover {
    background-color: #e0e0e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.action-button:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* Manufacturer-specific button styling */
.manufacturer-button {
    background-color: #fff0e6;
    border-color: #ffcc99;
}

.manufacturer-button:hover {
    background-color: #ffe6d1;
}

/* Analysis button styling */
.analysis-button {
    background-color: #e6f3ff;
    border-color: #b3d7ff;
}

.analysis-button:hover {
    background-color: #d6ebff;
}

/* HEIC conversion styles */
.btn-pulse {
    animation: pulse-animation 1s ease-in-out 3;
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
}

@keyframes pulse-animation {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
    }
    
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }
    
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

/* Image modal for viewing larger images */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    overflow: auto;
}

.image-modal-content {
    display: block;
    margin: 60px auto;
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
}

.image-modal-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #f1f1f1;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* Nameplate Card Styling */
.nameplate-card {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.nameplate-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.nameplate-card .card-header {
    padding: 0.75rem 1rem;
}

.nameplate-card .card-body {
    padding: 1.25rem;
}

.nameplate-card .key-specs {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(0,0,0,0.1);
}

.specs-table {
    margin-bottom: 0;
}

.specs-table td {
    padding: 0.4rem 0.75rem;
    vertical-align: middle;
}

.specs-table td:first-child {
    font-weight: 500;
    width: 40%;
}

.specs-table td:last-child {
    width: 60%;
}

.nameplate-summary {
    font-style: italic;
    color: #6c757d;
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Cost Estimate Card Styling */
.cost-estimate-card,
.pricing-card {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #28a745;
}

.cost-estimate-card:hover,
.pricing-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.cost-estimate-card .card-header,
.pricing-card .card-header {
    background-color: #28a745;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
}

.cost-estimate-card .card-body,
.pricing-card .card-body {
    padding: 1.25rem;
}

.price-card {
    background-color: #f8f9fa;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
}

.estimate-price {
    font-size: 2.5rem;
    font-weight: 600;
    color: #28a745;
    text-align: center;
    padding: 0.5rem 0 1rem;
    margin-bottom: 1rem;
}

.price-range {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    width: 80%;
    margin: 0 auto;
}

.price-range .range-item {
    text-align: center;
    padding: 0.5rem 1rem;
}

.price-range .low, 
.price-range .high {
    color: #6c757d;
    font-size: 0.9rem;
}

.confidence-section {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.confidence-indicator.progress {
    height: 10px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.confidence-indicator .progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
}

.motor-specs-summary {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.database-results {
    border-left: 3px solid #007bff;
    padding-left: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.database-results h5 {
    color: #007bff;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.recommendation-section {
    border-left: 3px solid #28a745;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.cost-breakdown-table {
    width: 100%;
    margin-bottom: 1rem;
}
/* Typing indicator styling */
.typing-indicator .typing-dots {
    display: inline-flex;
    align-items: center;
    height: 1em;
}

.typing-indicator .typing-dots span {
    animation: typingDot 1.4s infinite ease-in-out both;
    background-color: #999;
    border-radius: 50%;
    display: inline-block;
    height: 0.5em;
    margin: 0 0.1em;
    width: 0.5em;
}

.typing-indicator .typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingDot {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}
EOF < /dev/null