/* Wishline Visual Search Styles */

.wishline-camera-btn {
    --wishline-camera-icon-size: 24px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    padding: 4px 6px;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    margin-right: 10px;
    line-height: 0;
}

/* Woodmart themes add icon glyphs to buttons via ::before/::after — suppress on ours. */
.searchform .wishline-camera-btn::before,
.searchform .wishline-camera-btn::after,
form.woodmart-ajax-search .wishline-camera-btn::before,
form.woodmart-ajax-search .wishline-camera-btn::after {
    content: none !important;
    display: none !important;
}

.wishline-camera-btn:hover {
    opacity: 0.75;
}

.wishline-camera-icon {
    position: relative;
    display: inline-flex;
    width: var(--wishline-camera-icon-size, 24px);
    height: var(--wishline-camera-icon-size, 24px);
    align-items: center;
    justify-content: center;
}

.wishline-camera-icon-svg {
    width: var(--wishline-camera-icon-size, 24px);
    height: var(--wishline-camera-icon-size, 24px);
    display: block;
    flex-shrink: 0;
    color: currentColor;
}

/* 2026-05-12: Woodmart/WPBakery search form (.wd-search-form / .woodmart-ajax-search)
   has an absolutely positioned .searchsubmit at the right edge of the bar.
   When we inject the camera button into that form, place it just inside the
   submit icon so it stays visible and doesn't push the input. */
.wd-search-form form.searchform,
form.woodmart-ajax-search,
.searchform {
    position: relative;
    /* One action slot per icon: camera (left) then clear/X (right), then submit */
    --wishline-action-slot: calc(var(--wishline-camera-icon-size, 24px) + 12px);
    --wishline-search-reserve: calc(
        var(--wd-search-btn-w, 46px) + (var(--wishline-action-slot) * 2) + 10px
    );
}

.wd-search-form .wishline-camera-btn,
form.woodmart-ajax-search .wishline-camera-btn,
.searchform .wishline-camera-btn,
.wd-header-search .wishline-camera-btn,
.wd-header-search-mobile .wishline-camera-btn {
    position: absolute;
    /* Camera first (left), then .wd-clear-search, then .searchsubmit */
    inset-inline-end: calc(var(--wd-search-btn-w, 46px) + var(--wishline-action-slot) + 2px);
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 4px;
    line-height: 0;
    z-index: 5;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    --btn-bgcolor: transparent;
    background: transparent !important;
    border-radius: 0;
    min-height: unset;
    width: auto;
}

.wd-search-form .searchform input.s,
.wd-search-form .searchform input[type="text"],
.wd-search-form .searchform input[type="search"],
form.woodmart-ajax-search input.s,
form.woodmart-ajax-search input[type="text"],
form.woodmart-ajax-search input[type="search"],
.searchform input.s,
.searchform input[type="text"],
.searchform input[type="search"] {
    padding-inline-end: var(--wishline-search-reserve) !important;
    box-sizing: border-box;
}

/* Woodmart clear (X) — same visual size as camera, sits between camera and submit */
.searchform .wd-clear-search,
form.woodmart-ajax-search .wd-clear-search,
.wd-search-form .wd-clear-search {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--wishline-action-slot, 36px);
    min-width: var(--wishline-action-slot, 36px);
    height: var(--wishline-camera-icon-size, 24px);
    top: 50%;
    margin-top: 0;
    transform: translateY(-50%);
    padding: 0;
    box-sizing: border-box;
}

.searchform .wd-clear-search::before,
form.woodmart-ajax-search .wd-clear-search::before,
.wd-search-form .wd-clear-search::before {
    font-size: var(--wishline-camera-icon-size, 24px);
    line-height: 1;
}

/* Modal */
/* 2026-05-12: z-index lifted above Woodmart's `.wd-dropdown-results` (z-index 9999)
   and the WP admin bar (32100) so the modal sits over every theme overlay. */
.wishline-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    animation: fadeIn 0.3s ease-in-out;
}

.wishline-modal,
.wishline-modal * {
    pointer-events: auto;
}

.wishline-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.wishline-modal-content {
    background-color: #fff;
    padding: 30px;
    border: none;
    border-radius: 0;
    width: 90%;
    max-width: 800px;
    max-height: min(90vh, calc(100dvh - 48px));
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-in-out;
    flex-shrink: 0;
    box-sizing: border-box;
}

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

.wishline-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.wishline-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.wishline-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s ease;
}

.wishline-close:hover {
    color: #333;
}

/* Upload Area */
.wishline-upload-area {
    position: relative;
    margin-bottom: 30px;
}

#wishline-image-input {
    display: none;
}

.wishline-upload-label {
    display: block;
    border: 2px dashed #000000;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f9f9f9;
}

.wishline-upload-label:hover {
    border-color: #000000;
    background-color: #f0f0f0;
}

.wishline-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    margin: 0 auto 10px;
    line-height: 0;
}

.wishline-upload-icon img {
    display: block;
    width: 48px;
    height: 48px;
    max-width: none;
    object-fit: contain;
}

.wishline-upload-text {
    color: #666;
    font-size: 14px;
}

/* Uploaded image shown while search runs / results display */
.wishline-search-preview {
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fafafa;
}

.wishline-search-preview[hidden] {
    display: none !important;
}

.wishline-search-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.wishline-search-preview-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wishline-search-preview-change {
    background: none;
    border: none;
    color: #007bba;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.wishline-search-preview-change:hover {
    color: #005a87;
}

.wishline-search-preview-img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 6px;
    object-fit: contain;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wishline-upload-area.has-preview .wishline-upload-label {
    display: none;
}

/* Search Options — brand on top, title filter below */
.wishline-search-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

.wishline-input {
    flex: 1;
    width: 100%;
    min-height: 52px;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.4;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

select.wishline-input {
    padding-right: 40px;
    cursor: pointer;
}

.wishline-input:focus {
    outline: none;
    border-color: #007bba;
    box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.1);
}

/* Results Grid */
.wishline-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    align-items: stretch;
    gap: 24px 20px;
    margin-bottom: 20px;
}

.wishline-results-grid.wishline-results-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.wishline-load-more-wrap {
    display: flex;
    justify-content: center;
    margin: 8px 0 24px;
}

.wishline-load-more-wrap[hidden] {
    display: none !important;
}

.wishline-load-more-btn {
    min-width: 160px;
    padding: 12px 28px;
    border: 1px solid #000;
    border-radius: 0;
    background: #fff;
    color: #000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.wishline-load-more-btn:hover:not(:disabled) {
    background: #000;
    color: #fff;
    border-color: #000;
}

.wishline-load-more-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.wishline-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: none;
    border-radius: 0;
    overflow: visible;
    cursor: pointer;
    text-align: left;
}

.wishline-product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #fff;
    margin-bottom: 12px;
}

.wishline-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.wishline-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 4px 6px;
    border: 1px solid #d8d8d8;
    border-radius: 50%;
    background: #fff;
    color: #000;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.wishline-product-info {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 0;
    min-height: 0;
}

.wishline-brand {
    flex-shrink: 0;
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.25;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.wishline-product-title {
    flex: 1 1 auto;
    margin: 0 0 10px 0;
    min-height: calc(13px * 1.4 * 2);
    font-size: 13px;
    font-weight: 400;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    text-transform: none;
}

.wishline-price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.wishline-price-regular,
.wishline-price-regular .amount {
    color: #9a9a9a;
    font-size: 14px;
    font-weight: 400;
    text-decoration: line-through;
}

.wishline-price-sale,
.wishline-price-sale .amount {
    color: #000;
    font-size: 15px;
    font-weight: 700;
}

.wishline-price-row del {
    color: #9a9a9a;
    font-weight: 400;
    text-decoration: line-through;
}

.wishline-price-row ins {
    text-decoration: none;
    color: #000;
    font-weight: 700;
}

.wishline-rating {
    margin: 8px 0;
    font-size: 12px;
    color: #666;
}

.wishline-similar-btn {
    display: inline-block;
    width: auto;
    padding: 0;
    margin: auto 0 0 0;
    flex-shrink: 0;
    align-self: flex-start;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #666;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.wishline-similar-btn:hover {
    background: transparent;
    color: #000;
    border-color: transparent;
    text-decoration: underline;
}

/* Loading and No Results */
.wishline-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.wishline-no-results,
.wishline-error {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.wishline-error {
    color: #d32f2f;
}

/* Header search bar — smaller camera, extra reserve on mobile */
@media (max-width: 768px) {
    .wishline-camera-btn {
        --wishline-camera-icon-size: 20px;
    }

    .wd-search-form form.searchform,
    form.woodmart-ajax-search,
    .searchform {
        --wishline-action-slot: calc(var(--wishline-camera-icon-size, 20px) + 12px);
    }

    .wd-search-form .wishline-camera-btn,
    form.woodmart-ajax-search .wishline-camera-btn,
    .searchform .wishline-camera-btn {
        inset-inline-end: calc(var(--wd-search-btn-w, 46px) + var(--wishline-action-slot) + 2px);
        padding: 2px 4px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    /* Inset panel so the dimmed backdrop stays tappable to close. */
    .wishline-modal.active {
        padding: 24px 16px;
    }

    .wishline-modal-content {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - 48px);
        margin: 0;
        padding: 18px 16px;
    }

    .wishline-modal-header {
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .wishline-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }

    .wishline-modal-header h2 {
        font-size: 18px;
    }
}