/* 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: 2rem;
    line-height: 1.6;
}

/* Main Container */
.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 1rem;
}

h1 {
    text-align: center;
    color: #212529;
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    margin-top: 0;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: #6c757d;
    margin-bottom: 3rem !important;
    font-size: 1.1rem;
    margin-top: 0;
    line-height: 1.5;
}

/* Search Mode Tabs */
.search-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tab-button {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 6px 6px 0 0;
}

.tab-button.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-button:hover {
    color: #007bff;
}

/* Two-Panel Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
}

.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;
    min-height: 400px;
}

h3 {
    font-size: 1.25rem;
    color: #495057;
    margin-top: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.75rem;
    font-weight: 600;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* AI Jewelry Search Tab Styling */
#ai-jewelry-tab {
    background: transparent;
    padding: 0;
}

/* 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 {
    margin-top: auto;
    /* Pushes the button to the bottom */
    padding-top: 1.5rem;
    /* Adds space above the button */
}

/* 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 Grid */
.results-grid {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.result-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.result-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.result-item img {
    width: 100%;
    /* height: 180px; */
    object-fit: contain;
    transition: transform 0.2s ease;
}

.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: visible;
    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: 300px;
    max-height: 60vh;
    overflow: auto;
}

.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;
    flex-shrink: 0;
    min-height: 60px;
    align-items: center;
}

.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;
}

#copy-navigate-button {
    background-color: #007bff;
    color: white;
}

#copy-navigate-button:hover {
    background-color: #0056b3;
}

.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) {
    body {
        padding: 1rem;
    }
    
    .container {
        padding: 0 0.5rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .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;
        gap: 1rem;
    }
    
    .search-panel,
    .controls-panel {
        padding: 1.5rem;
        min-height: auto;
    }

    .search-tabs {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .text-input-wrapper {
        flex-direction: column;
    }

    .spell-check-btn {
        min-width: auto;
        width: 100%;
    }

    .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;
    }
}