/* General Body Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #343a40;
    margin: 0;
    padding: 1rem;
}

/* Main Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

h1 {
    text-align: center;
    color: #212529;
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: #6c757d;
    margin-bottom: 3rem;
    font-size: 1.1rem;
}


/* Two-Panel Layout */
.main-content {

    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    display: block;
}

.search-panel,
.controls-panel {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

h3 {
    font-size: 1.25rem;
    color: #495057;
    margin-top: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.75rem;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


/* Unified Search Container */
.unified-search-container {
    background: #f8f9fa;
    /* border: 1px solid #e9ecef; */
    border-radius: 12px;
    /* padding: 1.5rem; */
    /* margin: 0 auto 1rem auto; */
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.unified-search-container h3 {
    margin: 0 0 1.5rem 0;
    color: #495057;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.75rem;
}

.search-input-section {
    margin-bottom: 1.5rem;
}

.category-section {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.category-section .category-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-section .category-selector label {
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

/* Search Controls Layout - Single Line */
.search-controls-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

/* Text Search Styles - Updated with spell check layout */
.text-search-container {
    margin-bottom: 1rem;
}

.text-input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.text-input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    background-color: #fff;
}

.text-input:focus {
    outline: none;
    border-color: #007bff;
}

.text-input::placeholder {
    color: #6c757d;
}

.spell-check-btn {
    padding: 1rem 1.25rem;
    background-color: #6f42c1;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.spell-check-btn:hover {
    background-color: #5a2d91;
    transform: translateY(-1px);
}

.spell-check-btn:active {
    transform: translateY(0);
}

.spell-check-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.spell-check-btn.processing .spell-check-text {
    display: none;
}

.spell-check-btn.processing::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spell-check-icon {
    width: 16px;
    height: 16px;
}

/* Spell check suggestions */
.spell-suggestions {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #856404;
    display: none;
}

.spell-suggestions.show {
    display: block;
}

.suggestion-item.whole-sentence {
    background: #007bff;
    color: white;
    display: block;
    margin: 0.5rem 0 0.25rem 0;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.suggestion-item.whole-sentence:hover {
    background: #0056b3;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.action-button {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.action-button:hover {
    background-color: #dee2e6;
    border-color: #b3b9c0;
}

.action-button.processing {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    cursor: not-allowed;
}

.action-button.processing::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.drop-zone.drag-over {
    background-color: #e9ecef;
    border-color: #495057;
}

.file-input {
    display: none;
}

.upload-icon {
    color: #6c757d;
    margin-bottom: 1rem;
    transition: color 0.2s ease;
}

.drop-zone.drag-over .upload-icon {
    color: #343a40;
}

.drop-zone-prompt p {
    margin: 0.5rem 0;
    color: #6c757d;
}

.file-name {
    font-weight: 500;
    color: #007bff;
    margin-top: 0.5rem;
    display: inline-block;
}

/* Image Preview Styles */
.image-preview-container {
    margin-top: 1rem;
}

.preview-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.edit-image,
.remove-image,
.undo-image,
.redo-image {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.edit-image {
    background-color: #007bff;
    color: white;
}

.edit-image:hover {
    background-color: #0056b3;
}

.remove-image {
    background-color: #dc3545;
    color: white;
}

.remove-image:hover {
    background-color: #c82333;
}

.undo-image {
    background-color: #6f42c1;
    color: white;
}

.undo-image:hover {
    background-color: #5a2d91;
}

.undo-image:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.redo-image {
    background-color: #17a2b8;
    color: white;
}

.redo-image:hover {
    background-color: #138496;
}

.redo-image:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.image-preview-wrapper {
    text-align: center;
}

.image-preview {
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.image-preview.clickable {
    cursor: pointer;
}

.image-preview.clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.image-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.preview-filename {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.preview-size {
    display: block;
    font-size: 0.875rem;
    color: #6c757d;
}

.image-history-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #0066cc;
    text-align: center;
}

/* Image Editor Modal */
.editor-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.editor-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.editor-content {
    background: white;
    border-radius: 12px;
    width: 90vw;
    max-width: 1200px;
    height: 90vh;
    max-height: 800px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

.editor-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.editor-header h3 {
    margin: 0;
    color: #495057;
    border: none;
    padding: 0;
}

.editor-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    margin-left: auto;
}

.editor-close:hover {
    color: #343a40;
}

.editor-body {
    display: flex;
    flex: 1;
    min-height: 500px;
}

.editor-canvas-container {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #f8f9fa;
    min-height: 400px;
    overflow: hidden;
}

.editor-canvas {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: crosshair;
}

.editor-controls {
    width: 300px;
    padding: 1.5rem;
    background: white;
    border-left: 1px solid #e9ecef;
    overflow-y: auto;
}

.editor-section {
    margin-bottom: 2rem;
}

.editor-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.editor-slider-group {
    margin-bottom: 1rem;
}

.editor-slider-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.editor-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.editor-slider {
    flex: 1;
}

.editor-slider-value {
    font-weight: 600;
    color: #007bff;
    min-width: 40px;
    font-size: 0.875rem;
}

.editor-button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.editor-button.primary {
    background-color: #007bff;
    color: white;
}

.editor-button.primary:hover {
    background-color: #0056b3;
}

.editor-button.secondary {
    background-color: #6c757d;
    color: white;
}

.editor-button.secondary:hover {
    background-color: #545b62;
}

.editor-button.danger {
    background-color: #dc3545;
    color: white;
}

.editor-button.danger:hover {
    background-color: #c82333;
}

.editor-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.editor-action-buttons {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
    background: #f8f9fa;
}

.editor-action-buttons button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background-color: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background-color: #545b62;
}

.btn-apply {
    background-color: #28a745;
    color: white;
}

.btn-apply:hover {
    background-color: #218838;
}

/* Controls Panel - Always visible */
.controls-panel {
    display: flex;
    flex-direction: column;
}

.search-controls {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

label {
    font-weight: 500;
    color: #495057;
}

.slider-value {
    font-weight: 600;
    color: #007bff;
    min-width: 45px;
}

input[type="range"] {
    flex-grow: 1;
}

.search-button-wrapper {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

.search-button-wrapper button {
    flex: 1;
}

/* Image Search Button */
#image-search-button {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#image-search-button:hover {
    background-color: #0056b3;
}

#image-search-button:active {
    transform: scale(0.98);
}

#image-search-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Text Search Button */
#text-search-button {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#text-search-button:hover {
    background-color: #0056b3;
}

#text-search-button:active {
    transform: scale(0.98);
}

#text-search-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

#text-search-button-keyword {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#text-search-button-keyword:hover {
    background-color: #0056b3;
}

#text-search-button-keyword:active {
    transform: scale(0.98);
}

#text-search-button-keyword:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Current Query Display */
.current-query {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #0066cc;
}

.current-query strong {
    color: #004499;
}

/* Results Section - Model Display Layout */
.results-section {
    margin: 1rem auto 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    overflow: hidden;
    min-height: 525px;
    width: 100%;
    max-width: 92%;
}

.model-display-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Main model area - fixed dimensions to prevent image cutting */
.main-model-area {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    height: 510px; /* Fixed height to prevent layout shifts */
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    display: flex;
    /* align-items: center; */
    justify-content: center;
    overflow: hidden;
    /* padding: 20px; */
    box-sizing: border-box;
    border-radius: 12px;
    margin-bottom: 1rem;
    flex-shrink: 0; /* Prevent shrinking */
    /* Temporary border for debugging - remove after testing */
    border: 2px solid rgba(255, 255, 255, 0.3);
}




.main-model-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; /* Ensures full image is visible without cutting */
    object-position: center;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    display: block;
    margin: 0;
    background: white;
    border: 2px solid rgba(255, 255, 255, 0.9);
}

/* Alternative approach - let image determine container height */
.main-model-area-flexible {
    position: relative;
    min-height: 400px; /* Minimum height */
    max-height: 700px; /* Maximum height */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
}

.main-model-image-flexible {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    background: white;
    border: 2px solid rgba(255, 255, 255, 0.9);
}


.main-model-image:hover {
    transform: scale(1.02);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

/* Ensure proper image loading and display */
.main-model-image[src=""] {
    display: none;
}

.main-model-image:not([src]),
.main-model-image[src=""] {
    display: none;
}

/* Image loading states */
.main-model-image {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.main-model-image.loading {
    opacity: 0.5;
}

/* Prevent image cutting by ensuring proper aspect ratio handling */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Better image quality */
.main-model-image,
#jewelry-result-image,
.result-item img {
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
}

.model-placeholder {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.model-placeholder svg {
    opacity: 0.6;
    color: rgba(255, 255, 255, 0.7);
}

.model-placeholder p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    max-width: 300px;
}

.model-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.model-nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.model-prev-btn {
    left: 20px;
}

.model-next-btn {
    right: 20px;
}

.product-recommendations {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.recommendations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.recommendations-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.results-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.results-info span {
    font-size: 0.85rem;
    color: #495057;
    font-weight: 500;
}

.recommendations-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-nav-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #007bff;
    color: white;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    flex-shrink: 0;
}

.slider-nav-btn:hover:not(:disabled) {
    background: #0056b3;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.slider-nav-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.slider-nav-btn:disabled:hover {
    transform: none;
}

/* Results Container - Horizontal Layout */
.results-container {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: nowrap;
    overflow: hidden;
    flex: 1;
}

.result-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    flex: 0 0 auto;
    width: 173px;
    min-width: 140px;
}

.result-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.result-item img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    object-position: center;
    background: #f8f9fa;
    transition: transform 0.2s ease;
    border-radius: 4px;
    padding: 5px;
    box-sizing: border-box;
}

.result-item:hover img {
    transform: scale(1.05);
}

.result-details {
    padding: 0.75rem;
}

.result-details p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: #495057;
    text-align: center;
}

.match-score {
    font-weight: 600;
    color: #28a745;
}

.result-rank {
    font-weight: 500;
    color: #6c757d;
}

.product-sku,
.product-title {
    color: #495057;
    font-size: 0.85rem;
}

.image-error {
    padding: 1rem;
    text-align: center;
    color: #dc3545;
    font-size: 0.9rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    margin: auto;
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
    border: none;
    padding: 0;
    font-size: 1.25rem;
}

.modal-body {
    display: flex;
    flex: 1;
    min-height: 500px;
    max-height: 70vh;
}

.modal-body123 {
    flex: 1;
    min-height: 500px;
    max-height: 70vh;
}

.modal-image-section {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    position: relative;
}

.modal-results-section {
    width: 400px;
    background: white;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.results-header {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #495057;
}

.results-count {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: normal;
}

/* Modal body scroll fix */
.modal-results-container {
    max-height: 400px;
    /* adjust as needed */
    overflow-y: auto;
    padding-right: 5px;
}

/* Ensure image fits properly */
.modal-image {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    margin: 0 auto;
}


.modal-result-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.modal-result-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-result-item.selected {
    border-color: #007bff;
    background: #f0f8ff;
}

.modal-result-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    flex-shrink: 0;
}

.modal-result-details {
    flex: 1;
    font-size: 0.875rem;
}

.modal-result-details p {
    margin: 0.25rem 0;
}

.modal-result-rank {
    font-weight: 600;
    color: #6c757d;
}

.modal-result-score {
    font-weight: 600;
    color: #28a745;
}

.modal-result-sku {
    color: #495057;
    font-size: 0.8rem;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.modal-info {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    text-align: center;
    color: #343a40;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.modal-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #212529;
}

.modal-info p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
}

.close:hover {
    color: #343a40;
}

.modal-actions {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
}

.modal-actions button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#fixed-search-button {
    background-color: #28a745;
    color: white;
}

#fixed-search-button:hover {
    background-color: #218838;
}

#fixed-search-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

#modal-close-button {
    background-color: #6c757d;
    color: white;
}

#modal-close-button:hover {
    background-color: #545b62;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nav-button:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-button:disabled:hover {
    transform: translateY(-50%) scale(1);
}

.prev-button {
    left: -70px;
}

.next-button {
    right: -70px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Loading State for Modal Results */
.modal-results-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007bff;
}

/* Search Results Modal Styles */
.search-results-modal-content {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    min-width: 1276px;
}

.search-results-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
    min-height: 400px;
}

.search-result-grid-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.search-result-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.search-result-grid-image {
    width: 100%;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.search-result-grid-details {
    text-align: left;
}

.search-result-grid-rank {
    font-weight: 600;
    color: #007bff;
    margin-bottom: 0.25rem;
}

.search-result-grid-score {
    color: #28a745;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.search-result-grid-sku {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.search-result-grid-title {
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
}

.loading-spinner {
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* AI Generation Dialog Styles */
.ai-generation-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.ai-generation-loading p {
    margin: 0.5rem 0;
    color: #495057;
    font-size: 1.1rem;
}

.loading-subtitle {
    color: #6c757d !important;
    font-size: 0.9rem !important;
}

.ai-generation-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.generated-image-container {
    margin-bottom: 2rem;
    text-align: center;
}

.generated-image {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.generation-details {
    text-align: center;
    max-width: 600px;
}

.generation-details h4 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
}

.generation-details p {
    margin: 0;
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.5;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.download-btn:hover {
    background: #218838;
}

.download-btn svg {
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-results-modal-content {
        min-width: 95vw;
        width: 95vw;
    }

    .search-results-grid-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .search-tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .text-input-wrapper {
        flex-direction: column;
    }

    .spell-check-btn {
        min-width: auto;
        width: 100%;
    }

    .unified-search-container {
        padding: 1rem;
    }

    .category-section .category-selector {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .category-section .category-selector label {
        white-space: normal;
    }
    
    .search-controls-inline {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-btn-inline {
        width: 100%;
    }
    
    /* Single row responsive */
    .single-row-search {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .text-input-row {
        flex: none;
        min-width: auto;
        width: 100%;
    }
    
    .category-dropdown-row {
        flex: none;
        min-width: auto;
        width: 100%;
    }
    
    .search-btn-row {
        flex: none;
        width: 100%;
    }

    
    
/* Responsive adjustments for model area */
@media (max-width: 768px) {
    .main-model-area {
        height: 400px; /* Smaller height on mobile */
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .main-model-area {
        height: 300px; /* Even smaller height on small mobile */
        padding: 10px;
    }
}

    .product-recommendations {
        position: relative;
        background: #ffffff;
        backdrop-filter: none;
    }

    .recommendations-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
        text-align: center;
    }

    .results-info {
        justify-content: center;
    }

    .recommendations-slider {
        gap: 0.5rem;
    }

    .slider-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .results-container {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .result-item {
        width: 120px;
        min-width: 120px;
    }

    .result-item img {
        height: 80px;
    }

    .model-placeholder p {
        font-size: 0.9rem;
        max-width: 250px;
    }

    .model-nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }

    .model-prev-btn {
        left: 10px;
    }

    .model-next-btn {
        right: 10px;
    }

    .editor-content {
        width: 95vw;
        height: 95vh;
        max-width: none;
        max-height: none;
    }

    .editor-canvas-container {
        min-height: 300px;
    }

    .editor-body {
        flex-direction: column;
    }

    .editor-controls {
        width: 100%;
        max-height: 250px;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }

    .modal-content {
        max-width: 60vw;
        max-height: 95vh;
    }

    .modal-body {
        flex-direction: column;
    }

    .modal-body123 {
        flex-direction: column;
    }

    .modal-results-section {
        width: 100%;
        max-height: 300px;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }

    .prev-button {
        left: -50px;
    }

    .next-button {
        right: -50px;
    }
}

@media (max-width: 480px) {
    .search-results-modal-content {
        min-width: 98vw;
        width: 98vw;
    }

    .search-results-grid-container {
        grid-template-columns: 1fr;
    }
}

/* Category Dropdown */
.category-dropdown {
    padding: 0.75rem 1rem;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #fff;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.2s ease;
    min-width: 180px;
}

.category-dropdown:focus {
    outline: none;
    border-color: #007bff;
}

.category-dropdown:hover {
    border-color: #007bff;
}

/* Single Row Search Layout */
.single-row-search {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
}

.text-input-row {
    flex: 2;
    min-width: 300px;
    padding: 0.75rem 1rem;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    background-color: #fff;
}

.text-input-row:focus {
    outline: none;
    border-color: #007bff;
}

.text-input-row::placeholder {
    color: #6c757d;
}

.category-dropdown-row {
    flex: 0 0 auto;
    min-width: 180px;
    padding: 0.75rem 1rem;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #fff;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.category-dropdown-row:focus {
    outline: none;
    border-color: #007bff;
}

.category-dropdown-row:hover {
    border-color: #007bff;
}

.search-btn-row {
    flex: 0 0 auto;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-btn-row:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.search-btn-row:active {
    transform: translateY(0);
}

.search-btn-row:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Legacy styles for backward compatibility */
.search-controls-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

.search-btn-inline {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-btn-inline:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.search-btn-inline:active {
    transform: translateY(0);
}

.search-btn-inline:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}



/* Responsive design for slider */
@media (max-width: 768px) {
    .slider-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .category-selector {
        justify-content: center;
    }
    
    .main-image-display {
        height: 300px;
    }
    
    .thumbnail-item {
        width: 80px;
        height: 80px;
    }
    
    .thumbnails-track {
        min-height: 100px;
    }
    
    .thumb-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .main-slider-container {
        padding: 1rem;
    }
    
    .main-image-display {
        height: 250px;
    }
    
    .thumbnail-item {
        width: 60px;
        height: 60px;
    }
    
    .thumbnails-track {
        min-height: 80px;
        gap: 0.5rem;
    }
}


/* Force hide sliders - fixed values only */
#accuracy-slider-container,
.slider-container:has(#quantity-slider),
.slider-container:has(#accuracy-slider) {
    display: none !important;
}

/* Loading spinner for jewelry modal */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Jewelry Inpainting Modal Styles */
#jewelry-inpainting-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

#jewelry-inpainting-modal .modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 900px;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#jewelry-inpainting-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#jewelry-inpainting-modal .modal-header h3 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

#jewelry-inpainting-modal .close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#jewelry-inpainting-modal .close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

#jewelry-inpainting-modal .modal-body {
    padding: 2rem;
    background: #f8f9fa;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

/* Jewelry Result Container Styles */
#jewelry-result-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#jewelry-result-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem;
}

/* Jewelry Result Image Styles */
#jewelry-result-image {
    max-width: 100%;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    background: white;
    border: 2px solid #e9ecef;
    display: block;
    margin: 0 auto;
}

#jewelry-result-image:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    transform: scale(1.02);
}

/* Ensure jewelry result image is properly centered */
#jewelry-result-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem;
    min-height: 300px;
}

/* Loading Spinner for Jewelry Modal */
#jewelry-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #495057;
    min-height: 300px;
    width: 100%;
    text-align: center;
}

#jewelry-loading .loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem auto;
    display: block;
}

#jewelry-loading p {
    font-size: 1.1rem;
    margin: 0;
    text-align: center;
    font-weight: 500;
}

/* Error State */
#jewelry-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: #dc3545;
}

#jewelry-error p {
    font-size: 1.1rem;
    margin: 0;
    text-align: center;
    font-weight: 500;
}

#jewelry-inpainting-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    min-height: 70px;
    align-items: center;
}

#jewelry-inpainting-modal .modal-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    min-width: 120px;
    display: inline-block;
}

#jewelry-download-btn {
    background: #28a745;
    color: white;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

#jewelry-download-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

#jewelry-modal-close-button {
    background: #6c757d;
    color: white;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
    display: inline-block !important;
}

#jewelry-modal-close-button:hover {
    background: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

/* Ensure download button is visible when shown */
#jewelry-download-btn[style*="inline-block"] {
    display: inline-block !important;
}

@media (max-width: 768px) {
    #jewelry-inpainting-modal .modal-content {
        width: 95%;
        margin: 1rem;
        max-width: none;
        max-height: 95vh;
    }
    
    #jewelry-inpainting-modal .modal-header {
        padding: 1rem 1.5rem;
    }
    
    #jewelry-inpainting-modal .modal-header h3 {
        font-size: 1.25rem;
    }
    
    #jewelry-inpainting-modal .modal-body {
        padding: 1rem;
        min-height: 300px;
    }
    
    #jewelry-inpainting-modal .modal-actions {
        padding: 1rem 1.5rem;
        flex-direction: column;
        min-height: 80px;
        background: #f8f9fa;
    }
    
    #jewelry-inpainting-modal .modal-actions button {
        width: 100%;
        margin-bottom: 0.5rem;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        display: block !important;
    }
    
    #jewelry-modal-close-button {
        display: block !important;
        margin-bottom: 0 !important;
    }
    
    #jewelry-result-image {
        max-height: 60vh;
        border-radius: 8px;
    }
    
    #jewelry-loading {
        padding: 2rem 1rem;
    }
    
    #jewelry-loading .loading-spinner {
        width: 50px;
        height: 50px;
    }
    
    #jewelry-error {
        padding: 2rem 1rem;
    }
}