/*
 * Tholkudi Market - AI Visual Search System Styles
 */

/* Camera / Visual Search button in Header */
.selvamart-header__camera {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 100%;
	min-height: 48px;
	background: #fffdf8;
	border: 0;
	border-left: 1px solid #d7d7d7;
	color: var(--selvamart-primary, #c4622d);
	cursor: pointer;
	transition: all 0.2s ease;
	flex-shrink: 0;
}
.selvamart-header__camera:hover {
	background: #fff3e8;
	color: var(--selvamart-terra-dark, #8b3a15);
}
.selvamart-header__camera i,
.selvamart-header__camera svg {
	font-size: 1.25rem;
}

/* Modal Overlay */
.sm-vs-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	background: rgba(42, 31, 20, 0.75);
	backdrop-filter: blur(6px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}
.sm-vs-modal-overlay.is-active {
	opacity: 1;
	visibility: visible;
}

/* Modal Window */
.sm-vs-modal {
	background: #fffdf8;
	border: 1px solid var(--selvamart-border, #ede0c8);
	border-top: 4px solid var(--selvamart-primary, #c4622d);
	border-radius: 16px;
	width: min(720px, 100%);
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 24px 60px rgba(42, 31, 20, 0.35);
	overflow: hidden;
	transform: translateY(20px) scale(0.97);
	transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.sm-vs-modal-overlay.is-active .sm-vs-modal {
	transform: translateY(0) scale(1);
}

/* Modal Header */
.sm-vs-header {
	padding: 1.1rem 1.5rem;
	background: #fff7f0;
	border-bottom: 1px solid var(--selvamart-border, #ede0c8);
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.sm-vs-title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--selvamart-charcoal, #2a1f14);
	display: flex;
	align-items: center;
	gap: 0.6rem;
}
.sm-vs-title i {
	color: var(--selvamart-primary, #c4622d);
}
.sm-vs-close {
	background: transparent;
	border: 0;
	font-size: 1.35rem;
	color: #8b6340;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	border-radius: 6px;
	transition: background 0.18s;
}
.sm-vs-close:hover {
	background: #ede0c8;
	color: #2a1f14;
}

/* Provider & Model Bar */
.sm-vs-providers {
	padding: 0.75rem 1.5rem;
	background: #fffdf8;
	border-bottom: 1px solid #ede0c8;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}
.sm-vs-provider-label {
	font-size: 0.8rem;
	font-weight: 700;
	color: #8b6340;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-right: 0.25rem;
}
.sm-vs-chip {
	padding: 0.35rem 0.85rem;
	border-radius: 999px;
	border: 1px solid #ede0c8;
	background: #fff;
	color: #5c3d1e;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.18s ease;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}
.sm-vs-chip:hover {
	background: #fff3e8;
	border-color: #c4622d;
}
.sm-vs-chip.is-selected {
	background: var(--selvamart-primary, #c4622d);
	color: #ffffff;
	border-color: var(--selvamart-primary, #c4622d);
	box-shadow: 0 4px 12px rgba(196, 98, 45, 0.25);
}

/* Modal Body */
.sm-vs-body {
	padding: 1.5rem;
	overflow-y: auto;
	flex: 1;
}

/* Dropzone & Viewfinder */
.sm-vs-dropzone {
	border: 2px dashed #c4622d;
	border-radius: 12px;
	padding: 2rem 1.5rem;
	text-align: center;
	background: #fff7f0;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease;
	position: relative;
}
.sm-vs-dropzone:hover,
.sm-vs-dropzone.is-dragover {
	background: #fff3e8;
	border-color: #8b3a15;
}
.sm-vs-dropzone-icon {
	font-size: 2.75rem;
	color: var(--selvamart-primary, #c4622d);
	margin-bottom: 0.75rem;
}
.sm-vs-dropzone-text {
	font-size: 1rem;
	font-weight: 700;
	color: #2a1f14;
	margin-bottom: 0.35rem;
}
.sm-vs-dropzone-subtext {
	font-size: 0.825rem;
	color: #8b6340;
}
.sm-vs-file-input {
	display: none;
}

/* Camera Live Viewfinder */
.sm-vs-camera-viewport {
	display: none;
	position: relative;
	width: 100%;
	max-height: 280px;
	border-radius: 12px;
	overflow: hidden;
	background: #000;
	margin-bottom: 1rem;
}
.sm-vs-camera-video {
	width: 100%;
	height: 280px;
	object-fit: cover;
}
.sm-vs-scan-line {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, transparent, #c4622d, #ffc327, #c4622d, transparent);
	box-shadow: 0 0 12px #c4622d;
	animation: smScan 2s linear infinite;
	display: none;
}
@keyframes smScan {
	0% { top: 0; }
	50% { top: 90%; }
	100% { top: 0; }
}

/* Action Controls Bar */
.sm-vs-actions {
	display: flex;
	gap: 0.75rem;
	margin-top: 1.25rem;
	justify-content: center;
}
.sm-vs-btn {
	padding: 0.65rem 1.35rem;
	border-radius: 8px;
	font-weight: 700;
	font-size: 0.925rem;
	cursor: pointer;
	border: 0;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	transition: all 0.18s ease;
}
.sm-vs-btn--primary {
	background: var(--selvamart-primary, #c4622d);
	color: #fff;
	box-shadow: 0 4px 14px rgba(196, 98, 45, 0.28);
}
.sm-vs-btn--primary:hover {
	background: #8b3a15;
}
.sm-vs-btn--secondary {
	background: #ede0c8;
	color: #2a1f14;
}
.sm-vs-btn--secondary:hover {
	background: #e0d0b0;
}

/* AI Analysis Results Area */
.sm-vs-results {
	display: none;
	margin-top: 1.5rem;
}
.sm-vs-analysis-card {
	background: #fffdf8;
	border: 1px solid #ede0c8;
	border-left: 4px solid var(--selvamart-primary, #c4622d);
	border-radius: 10px;
	padding: 1rem 1.25rem;
	margin-bottom: 1.25rem;
	display: flex;
	align-items: flex-start;
	gap: 1rem;
}
.sm-vs-preview-thumb {
	width: 68px;
	height: 68px;
	border-radius: 8px;
	object-fit: cover;
	border: 1px solid #ede0c8;
	flex-shrink: 0;
}
.sm-vs-analysis-details {
	flex: 1;
	min-width: 0;
}
.sm-vs-badge {
	display: inline-block;
	background: #fff3e8;
	color: #c4622d;
	font-size: 0.75rem;
	font-weight: 800;
	padding: 0.2rem 0.55rem;
	border-radius: 4px;
	text-transform: uppercase;
	margin-bottom: 0.35rem;
}
.sm-vs-detected-name {
	font-size: 1.05rem;
	font-weight: 800;
	color: #2a1f14;
	margin: 0 0 0.25rem;
}
.sm-vs-confidence {
	font-size: 0.8125rem;
	color: #8b6340;
}

/* Products Grid in Modal */
.sm-vs-products-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 1rem;
}
.sm-vs-product-card {
	background: #ffffff;
	border: 1px solid #ede0c8;
	border-radius: 10px;
	padding: 0.75rem;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sm-vs-product-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 24px rgba(42, 31, 20, 0.12);
}
.sm-vs-product-img {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: 6px;
	margin-bottom: 0.6rem;
}
.sm-vs-product-title {
	font-size: 0.875rem;
	font-weight: 700;
	color: #2a1f14;
	margin: 0 0 0.35rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.sm-vs-product-price {
	font-size: 0.9rem;
	font-weight: 800;
	color: var(--selvamart-primary, #c4622d);
	margin-top: auto;
}

/* ==========================================================================
   AJAX Live Product Search & Auto-Suggestions Dropdown
   ========================================================================== */
.selvamart-header__search {
	position: relative !important;
}

.selvamart-ajax-search-dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 99999;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 12px;
	box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.08);
	overflow: hidden;
	display: none;
	animation: smFadeSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
	font-family: inherit;
	text-align: left;
}

.selvamart-ajax-search-dropdown.is-active {
	display: block;
}

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

/* Category Suggestions Bar */
.sm-as-categories-row {
	padding: 8px 14px;
	background: #f8fafc;
	border-bottom: 1px solid #f1f5f9;
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	font-size: 12px;
	color: #64748b;
}
.sm-as-cat-chip {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 20px;
	background: #e0f2fe;
	color: #0369a1;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.15s ease;
}
.sm-as-cat-chip:hover {
	background: #0284c7;
	color: #ffffff;
}

/* Products List */
.sm-as-product-list {
	max-height: 380px;
	overflow-y: auto;
	margin: 0;
	padding: 4px 0;
	list-style: none;
}

.sm-as-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	text-decoration: none;
	color: #1e293b;
	transition: background 0.15s ease;
	border-bottom: 1px solid #f8fafc;
	cursor: pointer;
}
.sm-as-item:last-child {
	border-bottom: none;
}
.sm-as-item:hover,
.sm-as-item.is-highlighted {
	background: #f0fdf4;
	color: #0f766e;
}

.sm-as-thumb {
	width: 48px;
	height: 48px;
	border-radius: 8px;
	object-fit: cover;
	border: 1px solid #e2e8f0;
	background: #f8fafc;
	flex-shrink: 0;
}

.sm-as-info {
	flex: 1;
	min-width: 0;
}

.sm-as-title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	color: #1e293b;
	margin-bottom: 3px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.sm-as-item:hover .sm-as-title,
.sm-as-item.is-highlighted .sm-as-title {
	color: #0f766e;
}
.sm-as-title strong {
	color: #0f766e;
	font-weight: 800;
	text-decoration: underline;
}

.sm-as-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: #64748b;
}

.sm-as-category {
	background: #f1f5f9;
	color: #475569;
	padding: 1px 6px;
	border-radius: 4px;
	font-size: 11px;
}

.sm-as-price {
	font-weight: 700;
	color: #16a34a;
	font-size: 14px;
	margin-left: auto;
	white-space: nowrap;
}
.sm-as-price del {
	color: #94a3b8;
	font-size: 12px;
	margin-right: 4px;
}
.sm-as-price ins {
	text-decoration: none;
}

.sm-as-badge-out {
	font-size: 10px;
	font-weight: 700;
	color: #dc2626;
	background: #fee2e2;
	padding: 2px 6px;
	border-radius: 4px;
	margin-left: 6px;
}

/* Footer "View all results" */
.sm-as-footer {
	padding: 10px 16px;
	background: #f8fafc;
	border-top: 1px solid #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.sm-as-view-all-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 700;
	color: #0f766e;
	text-decoration: none;
	transition: color 0.15s ease;
	width: 100%;
	justify-content: center;
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px 0;
}
.sm-as-view-all-btn:hover {
	color: #115e59;
	text-decoration: underline;
}

/* Loading & Empty States */
.sm-as-state-box {
	padding: 24px 16px;
	text-align: center;
	font-size: 13px;
	color: #64748b;
}
.sm-as-spinner {
	display: inline-block;
	width: 22px;
	height: 22px;
	border: 3px solid rgba(15, 118, 110, 0.2);
	border-top-color: #0f766e;
	border-radius: 50%;
	animation: smSpin 0.7s linear infinite;
	margin-bottom: 8px;
}

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

@media (max-width: 767px) {
	.selvamart-ajax-search-dropdown {
		position: fixed;
		top: auto;
		left: 12px;
		right: 12px;
		max-height: 70vh;
	}
}

