/**
 * REEMCO AI Visual Search (AI Lens) Stylesheet
 * Integrates directly into top header search bar (.rc-search-wrap)
 */

/* ── Search Wrap Position Container ── */
.rc-search-wrap {
    position: relative !important;
}

/* ── Visual Search Trigger Button inside Search Box ── */
.rc-visual-btn-container {
    display: flex;
    align-items: center;
    position: relative;
    padding: 0 4px;
}

.rc-visual-search-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    color: #0b3c5d;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.rc-visual-search-btn:hover {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #38bdf8;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.18);
    transform: translateY(-1px);
}

.rc-visual-search-btn svg.rc-camera-icon {
    width: 17px;
    height: 17px;
    transition: transform 0.2s ease;
}

.rc-visual-search-btn:hover svg.rc-camera-icon {
    transform: scale(1.1);
}

.rc-ai-lens-badge {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 1px 5px;
    border-radius: 6px;
    text-transform: uppercase;
    box-shadow: 0 1px 4px rgba(5, 150, 105, 0.3);
}

/* Drag over visual cue on search box */
.rc-search-box.rc-drag-active {
    border-color: #059669 !important;
    background: #ecfdf5 !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25) !important;
}

/* ── Visual Search Modal / Dropdown Panel ── */
.rc-visual-search-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    min-width: 320px;
    max-width: 620px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 999999;
    padding: 18px;
    direction: rtl;
    text-align: right;
    animation: rcSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

@keyframes rcSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Panel Header */
.rc-vsp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 14px;
}

.rc-vsp-title-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rc-vsp-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #ecfdf5;
    color: #059669;
    border-radius: 8px;
}

.rc-vsp-title-area h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.rc-vsp-close {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s ease;
}

.rc-vsp-close:hover {
    color: #e11d48;
}

/* ── Dropzone Area ── */
.rc-vsp-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rc-vsp-dropzone:hover,
.rc-vsp-dropzone.rc-dragover {
    border-color: #059669;
    background: #f0fdf4;
}

.rc-vsp-icon-wrap {
    color: #059669;
    margin-bottom: 10px;
}

.rc-vsp-prompt {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 6px 0;
}

.rc-vsp-prompt span {
    color: #0284c7;
    text-decoration: underline;
}

.rc-vsp-hint {
    display: block;
    font-size: 12px;
    color: #64748b;
}

/* ── Scanning Area (Laser Effect) ── */
.rc-vsp-scanning {
    padding: 16px 0;
    text-align: center;
}

.rc-vsp-preview-box {
    position: relative;
    display: inline-block;
    width: 140px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #059669;
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.2);
    margin-bottom: 12px;
}

.rc-vsp-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rc-vsp-laser-beam {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #10b981;
    box-shadow: 0 0 12px #10b981, 0 0 20px #34d399;
    animation: rcLaserScan 1.4s ease-in-out infinite alternate;
}

@keyframes rcLaserScan {
    0% { top: 2%; }
    100% { top: 96%; }
}

.rc-vsp-scan-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.rc-vsp-pulse-loader {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #059669;
    border-radius: 50%;
    animation: rcSpin 0.8s linear infinite;
}

@keyframes rcSpin {
    to { transform: rotate(360deg); }
}

.rc-vsp-scan-text {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

/* ── Results Area ── */
.rc-vsp-results {
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.rc-vsp-results::-webkit-scrollbar {
    width: 6px;
}
.rc-vsp-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Detected Item Hero Card */
.rc-vsp-detected-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.rc-vsp-detected-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
}

.rc-vsp-detected-info {
    flex: 1;
    min-width: 0;
}

.rc-vsp-detected-tag {
    display: inline-block;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.rc-vsp-detected-name {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
}

.rc-vsp-detected-specs {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

/* Section Headings */
.rc-vsp-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin: 14px 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rc-vsp-section-title span.rc-vsp-count {
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Products Grid / List */
.rc-vsp-prod-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.rc-vsp-prod-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.rc-vsp-prod-card:hover {
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateX(-2px);
}

.rc-vsp-prod-card img {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f8fafc;
}

.rc-vsp-prod-body {
    flex: 1;
    min-width: 0;
}

.rc-vsp-prod-title {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-vsp-prod-price {
    font-size: 13px;
    font-weight: 800;
    color: #047857;
}

.rc-vsp-prod-action {
    flex-shrink: 0;
}

.rc-vsp-btn-view {
    background: #f1f5f9;
    color: #0b3c5d;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rc-vsp-prod-card:hover .rc-vsp-btn-view {
    background: #059669;
    color: #ffffff;
}

/* WhatsApp Inquiry Banner for Unlisted / Project Items */
.rc-vsp-wa-banner {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border: 1px solid #a7f3d0;
    border-radius: 12px;
    padding: 14px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rc-vsp-wa-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #065f46;
    font-size: 13px;
    font-weight: 700;
}

.rc-vsp-wa-desc {
    margin: 0;
    font-size: 12px;
    color: #047857;
    line-height: 1.5;
}

.rc-vsp-wa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #25D366;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(37, 211, 102, 0.25);
    transition: all 0.2s ease;
}

.rc-vsp-wa-btn:hover {
    background: #1eb954;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(37, 211, 102, 0.35);
}

.rc-vsp-wa-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Secondary Action Row */
.rc-vsp-footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.rc-vsp-btn-reupload {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.rc-vsp-btn-reupload:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.rc-vsp-btn-assistant {
    color: #0284c7;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.rc-vsp-btn-assistant:hover {
    text-decoration: underline;
}

/* ── Mobile Responsive Adjustments ── */
@media (max-width: 640px) {
    .rc-visual-search-panel {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
    .rc-ai-lens-badge {
        display: none;
    }
    .rc-visual-search-btn {
        padding: 6px 8px;
    }
}
