/*
 * Alixa Search Styles
 *
 * Self-contained styles for the [alixa-search] shortcode.
 * All selectors prefixed with .alixa-search-* to avoid conflicts with
 * theme styles.
 */

.alixa-search-root {
	font-family: 'Vazirmatn', 'Tahoma', 'Iranian Sans', sans-serif;
	max-width: 800px;
	margin: 1.5rem auto;
	color: #1f2937;
}

.alixa-search-root *,
.alixa-search-root *::before,
.alixa-search-root *::after {
	box-sizing: border-box;
}

/* -------- Search box -------- */

.alixa-search-box {
	position: relative;
	display: flex;
	align-items: center;
	background: #ffffff;
	border: 1.5px solid #d1d5db;
	border-radius: 12px;
	padding: 0 0.75rem;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.alixa-search-box:focus-within {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.alixa-search-icon {
	width: 22px;
	height: 22px;
	color: #6b7280;
	flex-shrink: 0;
	margin-left: 0.5rem;
}

.alixa-search-input {
	flex: 1;
	border: none;
	outline: none;
	padding: 0.85rem 0.25rem;
	font-size: 1rem;
	background: transparent;
	color: inherit;
	font-family: inherit;
	direction: rtl;
	text-align: right;
}

.alixa-search-input::placeholder {
	color: #9ca3af;
}

.alixa-search-clear {
	background: transparent;
	border: none;
	color: #9ca3af;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 0.25rem;
	transition: color 0.15s;
}

.alixa-search-clear:hover {
	color: #374151;
}

/* -------- Filter checkbox -------- */

.alixa-search-filter {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0.75rem 0.25rem;
	font-size: 0.9rem;
	color: #4b5563;
	cursor: pointer;
	user-select: none;
}

.alixa-search-filter input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: #2563eb;
	cursor: pointer;
}

/* -------- Status (loading / errors / empty) -------- */

.alixa-search-status {
	margin: 0.5rem 0;
	font-size: 0.875rem;
	color: #6b7280;
	min-height: 1.25rem;
}

.alixa-search-status.is-error {
	color: #dc2626;
}

/* -------- Results grid -------- */

.alixa-search-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 0.75rem;
	margin-top: 0.5rem;
}

/* -------- Drug card -------- */

.alixa-drug-card {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 0.85rem 1rem;
	display: grid;
	grid-template-columns: 56px 1fr;
	gap: 0.75rem;
	transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.alixa-drug-card:hover {
	border-color: #93c5fd;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.alixa-drug-image {
	width: 56px;
	height: 56px;
	background: #f3f4f6;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #d1d5db;
	flex-shrink: 0;
}

.alixa-drug-image svg {
	width: 28px;
	height: 28px;
}

.alixa-drug-content {
	min-width: 0;  /* allows truncation in flex children */
}

.alixa-drug-name {
	font-weight: 600;
	font-size: 0.95rem;
	color: #111827;
	margin: 0 0 0.25rem;
	line-height: 1.4;
}

.alixa-drug-meta {
	font-size: 0.8rem;
	color: #6b7280;
	margin-bottom: 0.5rem;
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.alixa-drug-meta span {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

.alixa-drug-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: 0.25rem;
}

.alixa-drug-price {
	font-weight: 600;
	font-size: 0.95rem;
	color: #111827;
}

.alixa-drug-price-unit {
	font-size: 0.75rem;
	color: #9ca3af;
	font-weight: 400;
	margin-right: 0.25rem;
}

.alixa-stock-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 500;
}

.alixa-stock-badge.in-stock {
	background: #cdeefb;
	color: #065f46;
}

.alixa-stock-badge.out-of-stock {
	background: #f3f4f6;
	color: #6b7280;
}

.alixa-stock-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

/* -------- Empty state -------- */

.alixa-search-empty {
	text-align: center;
	padding: 2rem 1rem;
	color: #9ca3af;
	font-size: 0.9rem;
}

/* -------- Responsive -------- */

@media (max-width: 600px) {
	.alixa-search-results {
		grid-template-columns: 1fr;
	}

	.alixa-drug-card {
		grid-template-columns: 48px 1fr;
		padding: 0.75rem;
	}

	.alixa-drug-image {
		width: 48px;
		height: 48px;
	}
}


/* =========================================================
 * Phase 6 Task 6.5 - Enhanced drug card (thumbnails + link)
 * Added 2026-06-03. These styles refine and extend the existing
 * .alixa-drug-card layout to support:
 *   - real thumbnails (img instead of SVG icon)
 *   - card as <a> (clickable, navigates to detail page)
 *   - multi-image count badge
 *   - "بزودی" cart placeholder
 * ========================================================= */

/* Card is now an anchor tag — restore link defaults */
a.alixa-drug-card,
a.alixa-drug-card:link,
a.alixa-drug-card:visited {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
    cursor: pointer;
}

a.alixa-drug-card:hover,
a.alixa-drug-card:focus {
    border-color: #0ea5e9;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.12);
    transform: translateY(-1px);
    outline: none;
}

a.alixa-drug-card:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Image cell — square thumbnail */
.alixa-drug-card .alixa-drug-image {
    position: relative;
    flex: 0 0 88px;
    width: 88px;
    height: 88px;
    background: #f1f5f9;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

.alixa-drug-card .alixa-drug-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.alixa-drug-card .alixa-drug-image svg {
    width: 40px;
    height: 40px;
}

/* Multi-image count badge (top-left in RTL = top-right visually) */
.alixa-image-count-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: rgba(14, 165, 233, 0.92);
    color: #ffffff;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Actions row */
.alixa-drug-actions {
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
}

/* "بزودی" cart placeholder */
.alixa-cart-soon {
    display: inline-block;
    padding: 3px 10px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e0;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .alixa-drug-card .alixa-drug-image {
        flex: 0 0 72px;
        width: 72px;
        height: 72px;
    }

    .alixa-drug-card .alixa-drug-image svg {
        width: 32px;
        height: 32px;
    }

    .alixa-image-count-badge {
        min-width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

/* ============================================================
   Add-to-cart button on search result cards (Phase 7.6)
   ============================================================ */
.alixa-cart-add {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: #0096c7;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.alixa-cart-add:hover {
    background: #0077a8;
}
.alixa-cart-add:active {
    transform: scale(0.97);
}
.alixa-cart-add:disabled {
    background: #6b7280;
    cursor: default;
    opacity: 0.85;
}

/* ============================================================
   Storefront v3 — rich card: delivery tag chip + Toman price
   Added 2026-06-24. Hybrid direction (STOREFRONT_DESIGN_DIRECTION.md).
   ============================================================ */

/* Delivery tag chip — sits on the product image (reading-start corner) */
.alixa-deliv-tag {
    position: absolute;
    top: 4px;
    inset-inline-start: 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.7;
    padding: 1px 7px;
    border-radius: 7px;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(2, 32, 54, 0.12);
}
.alixa-deliv-tag--ship   { background: #dcfce7; color: #166534; }  /* shippable (shop) */
.alixa-deliv-tag--pickup { background: #fef3c7; color: #92400e; }  /* pickup-only (drug) */

/* PLP — sort dropdown + load-more (storefront v3) */
.alixa-search-sortlbl {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0.5rem 0;
	font-size: 0.86rem;
	color: #475569;
}
.alixa-search-sort {
	font-family: inherit;
	font-size: 0.86rem;
	padding: 7px 10px;
	border: 1px solid #cfe9f3;
	border-radius: 9px;
	background: #fff;
	color: #0f172a;
	cursor: pointer;
}
.alixa-search-sort:focus {
	outline: none;
	border-color: #0096c7;
	box-shadow: 0 0 0 3px rgba(0, 150, 199, 0.12);
}
.alixa-search-more {
	display: flex;
	justify-content: center;
	margin: 18px 0 4px;
}
.alixa-search-more-btn {
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 700;
	color: #0096c7;
	background: #fff;
	border: 1.5px solid #0096c7;
	border-radius: 11px;
	padding: 10px 26px;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}
.alixa-search-more-btn:hover { background: #0096c7; color: #fff; }

/* ============================================================
   Rich VERTICAL product card — scoped to the shop/PLP grid only
   (.alixa-search-root--grid), so the home autocomplete stays compact.
   Same DOM as the horizontal card; just relaid out as a store card.
   ============================================================ */
.alixa-search-root--grid .alixa-search-results {
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 12px;
}
.alixa-search-root--grid a.alixa-drug-card {
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	padding: 0;
	overflow: hidden;
}
.alixa-search-root--grid .alixa-drug-card .alixa-drug-image {
	flex: none;
	width: 100%;
	height: 132px;
	border-radius: 0;
}
.alixa-search-root--grid .alixa-drug-content {
	padding: 11px 12px 13px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
	min-width: 0;
}
.alixa-search-root--grid .alixa-drug-name {
	font-size: 0.9rem;
	min-height: 2.6em;
}
.alixa-search-root--grid .alixa-drug-footer { margin-top: auto; }
.alixa-search-root--grid .alixa-drug-actions { margin-top: 8px; }
.alixa-search-root--grid .alixa-cart-add { width: 100%; text-align: center; padding: 8px 12px; }
@media (max-width: 600px) {
	.alixa-search-root--grid .alixa-search-results { grid-template-columns: repeat(2, 1fr); }
	.alixa-search-root--grid .alixa-drug-card .alixa-drug-image { height: 112px; }
}

/* discount: «٪X» badge on the image + struck-through original price */
.alixa-off-badge {
	position: absolute;
	top: 4px;
	inset-inline-end: 4px;
	background: #e11d48;
	color: #fff;
	font-weight: 800;
	font-size: 0.72rem;
	border-radius: 8px;
	padding: 2px 7px;
	line-height: 1.5;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.alixa-price-old {
	color: #94a3b8;
	text-decoration: line-through;
	font-weight: 500;
	font-size: 0.78rem;
	margin-inline-end: 4px;
}

/* Price emphasis + Toman unit */
.alixa-drug-card .alixa-drug-price {
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}
.alixa-drug-card .alixa-drug-price-unit {
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748b;
}

/* Sub-line (form · brand) a touch lighter/tighter */
.alixa-drug-card .alixa-drug-meta {
    gap: 0.4rem;
    color: #64748b;
}

/* In-stock badge → green (matches storefront direction) */
.alixa-stock-badge.in-stock { background: #dcfce7; color: #166534; }

/* Card hover uses the brand turquoise */
a.alixa-drug-card:hover,
a.alixa-drug-card:focus {
    border-color: #0096c7;
    box-shadow: 0 6px 16px rgba(0, 150, 199, 0.12);
}
a.alixa-drug-card:focus-visible { outline-color: #0096c7; }