/* DND Product Search & Save
   Override any of these CSS variables from your theme to match your brand. */
.dnd-ps-inline-form,
.dnd-ss-wrap,
.dnd-sr-wrap {
	--dnd-ps-accent: #00AEEF;
	--dnd-ps-text: #1a1a1a;
	--dnd-ps-muted: #6b6b6b;
	--dnd-ps-border: #e5e5e5;
	--dnd-ps-shadow: #e8e8e8;
	--dnd-ps-bg: #ffffff;
	--dnd-ps-panel-bg: #f5f5f5;
}

/* Inline search bar (rendered directly by [dnd_product_search], no popup) */
.dnd-ps-inline-form {
	display: flex;
	align-items: center;
	gap: 10px;
	border: 1.5px solid var(--dnd-ps-border);
	border-radius: 999px;
	padding: 8px 8px 8px 18px;
	max-width: 480px;
	background: var(--dnd-ps-bg);
}
.dnd-ps-form-icon {
	color: var(--dnd-ps-muted);
	flex-shrink: 0;
}
.dnd-ps-inline-input {
	flex: 1;
	border: none;
	outline: none;
	font-size: 15px;
	color: var(--dnd-ps-text);
	background: transparent;
	min-width: 0;
}
.dnd-ps-go-btn {
	background: var(--dnd-ps-text);
	color: var(--dnd-ps-bg);
	border: none;
	border-radius: 999px;
	padding: 9px 20px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	flex-shrink: 0;
}
.dnd-ps-go-btn:hover {
	opacity: 0.85;
}

/* Results grid */
.dnd-ps-results-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 16px;
}
.dnd-ps-result-card {
	display: block;
	text-decoration: none;
	color: inherit;
	border: 1px solid var(--dnd-ps-border);
	border-radius: 8px;
	overflow: hidden;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.dnd-ps-result-card:hover {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}
.dnd-ps-result-image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}
.dnd-ps-result-info {
	padding: 10px;
}
.dnd-ps-result-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--dnd-ps-text);
	margin-bottom: 4px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.dnd-ps-result-price {
	font-size: 13px;
	color: var(--dnd-ps-muted);
}
.dnd-ps-result-price ins {
	text-decoration: none;
	color: var(--dnd-ps-accent);
}
.dnd-ps-result-price del {
	opacity: 0.6;
}

/* Empty state */
.dnd-ps-empty-state {
	text-align: center;
	padding: 8px 0;
}
.dnd-ps-empty-title {
	font-size: 20px;
	font-weight: 600;
	color: var(--dnd-ps-text);
	margin: 0 0 20px;
}
.dnd-ps-empty-svg {
	margin: 0 auto 20px;
	display: block;
}
.dnd-ps-empty-panel {
	background: var(--dnd-ps-panel-bg);
	border-radius: 8px;
	padding: 28px 20px;
}
.dnd-ps-empty-panel h3 {
	margin: 0 0 8px;
	font-size: 18px;
	font-weight: 700;
	color: var(--dnd-ps-text);
}
.dnd-ps-empty-panel p {
	margin: 0 0 20px;
	color: #1f2937;
	font-size: 15px;
	font-weight: 500;
}
.dnd-ps-save-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: transparent;
	border: 1.5px solid var(--dnd-ps-text);
	color: var(--dnd-ps-text);
	border-radius: 999px;
	padding: 10px 22px;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
	text-decoration: none;
}
.dnd-ps-save-btn:hover {
	background: var(--dnd-ps-text);
	color: var(--dnd-ps-bg);
}
.dnd-ps-save-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

/* Saved Searches page */
.dnd-ss-wrap {
	max-width: 640px;
}
.dnd-ss-heading {
	margin-bottom: 16px;
}
.dnd-ss-empty {
	color: var(--dnd-ps-muted);
}
.dnd-ss-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--dnd-ps-border);
}
.dnd-ss-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 4px;
	border-bottom: 1px solid var(--dnd-ps-border);
}
.dnd-ss-term {
	font-weight: 600;
	color: var(--dnd-ps-text);
	text-decoration: none;
	flex: 1;
}
.dnd-ss-term:hover {
	color: var(--dnd-ps-accent);
}
.dnd-ss-date {
	color: var(--dnd-ps-muted);
	font-size: 13px;
}
.dnd-ss-delete {
	background: none;
	border: 1px solid var(--dnd-ps-border);
	border-radius: 999px;
	padding: 6px 14px;
	font-size: 12px;
	cursor: pointer;
	color: var(--dnd-ps-muted);
}
.dnd-ss-delete:hover {
	border-color: #d33;
	color: #d33;
}
.dnd-ss-login-notice {
	color: var(--dnd-ps-muted);
}

/* Search Results page */
.dnd-sr-wrap {
	max-width: 1100px;
}
.dnd-sr-form {
	display: flex;
	align-items: center;
	gap: 10px;
	border: 1.5px solid var(--dnd-ps-border);
	border-radius: 999px;
	padding: 8px 8px 8px 18px;
	max-width: 480px;
	margin: 0 0 28px;
}
.dnd-sr-form-icon {
	color: var(--dnd-ps-muted);
	flex-shrink: 0;
}
.dnd-sr-form input[type="text"] {
	flex: 1;
	border: none;
	outline: none;
	font-size: 15px;
	background: transparent;
	color: var(--dnd-ps-text);
}
.dnd-sr-form-btn {
	background: var(--dnd-ps-text);
	color: var(--dnd-ps-bg);
	border: none;
	border-radius: 999px;
	padding: 9px 20px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}
.dnd-sr-form-btn:hover {
	opacity: 0.85;
}
.dnd-sr-hint {
	color: var(--dnd-ps-muted);
}
.dnd-sr-count {
	color: var(--dnd-ps-muted);
	font-size: 14px;
	margin-bottom: 16px;
}
.dnd-sr-pagination {
	margin-top: 28px;
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}
.dnd-sr-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 34px;
	padding: 0 8px;
	border: 1px solid var(--dnd-ps-border);
	border-radius: 6px;
	text-decoration: none;
	color: var(--dnd-ps-text);
	font-size: 13px;
}
.dnd-sr-pagination .page-numbers.current {
	background: var(--dnd-ps-text);
	color: var(--dnd-ps-bg);
	border-color: var(--dnd-ps-text);
}
.dnd-sr-wrap .dnd-ps-empty-state {
	max-width: 480px;
	margin: 20px auto 0;
}

/* ================================================================
   v1.3 additions — Save Search widget & guest modal
   ================================================================ */

/* Header row: search form + inline save widget */
.dnd-sr-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    margin-bottom: 20px;
}
.dnd-sr-header .dnd-sr-form {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
}
.dnd-sr-header .dnd-ps-save-widget {
    flex: 0 0 auto;
}

/* --- Save widget (inline next to the search bar) --- */
.dnd-ps-save-widget {
    display: inline-flex;
    align-items: center;
}
.dnd-ps-save-widget .dnd-ps-saved-notice { display: none; }
.dnd-ps-save-widget.is-saved .dnd-ps-save-btn { display: none; }
.dnd-ps-save-widget.is-saved .dnd-ps-saved-notice { display: inline-flex; }

/* Compact Save button when placed inline (next to search bar) */
.dnd-ps-save-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #4ea5d9;
    color: #ffffff;
    border: 0;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.18s ease;
    font-family: inherit;
    white-space: nowrap;
}
.dnd-ps-save-inline:hover {
    background: #3d94c8;
    color: #ffffff;
}
.dnd-ps-save-inline:disabled {
    opacity: 0.7;
    cursor: default;
}
.dnd-ps-save-inline svg { flex-shrink: 0; }

/* Empty-state uses the same widget markup — same blue button */
.dnd-ps-empty-panel .dnd-ps-save-inline {
    padding: 11px 22px;
    font-size: 15px;
}
.dnd-ps-empty-panel .dnd-ps-save-inline:hover {
    background: #3d94c8;
}

/* "You've already Saved this Search" notice */
.dnd-ps-saved-notice {
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #f0fdf4;
    color: #15803d;
    border: 1.5px solid #86efac;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}
.dnd-ps-saved-notice svg { flex-shrink: 0; }
.dnd-ps-saved-text { flex: 0 0 auto; }
.dnd-ps-remove-btn {
    background: transparent;
    border: 0;
    color: #15803d;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    padding: 0 0 0 4px;
    font-family: inherit;
    font-weight: 600;
}
.dnd-ps-remove-btn:hover { color: #991b1b; }
.dnd-ps-remove-btn:disabled { opacity: 0.6; cursor: default; }

/* --- Guest login modal --- */
.dnd-ps-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: dndPsFadeIn 0.18s ease;
}
@keyframes dndPsFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.dnd-ps-modal {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    padding: 36px 32px 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    animation: dndPsSlideUp 0.22s ease;
}
@keyframes dndPsSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.dnd-ps-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: 0;
    font-size: 28px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.dnd-ps-modal-close:hover { color: #111827; }
.dnd-ps-modal-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}
.dnd-ps-modal-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}
.dnd-ps-modal-text {
    margin: 0 0 22px;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.55;
}
.dnd-ps-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.dnd-ps-modal-primary,
.dnd-ps-modal-secondary {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
}
.dnd-ps-modal-primary {
    background: #111827;
    color: #ffffff;
}
.dnd-ps-modal-primary:hover {
    background: #1f2937;
    color: #ffffff;
}
.dnd-ps-modal-secondary {
    background: #ffffff;
    color: #111827;
    border: 1.5px solid #d1d5db;
}
.dnd-ps-modal-secondary:hover { border-color: #111827; }

/* Responsive */
@media (max-width: 640px) {
    .dnd-sr-header {
        flex-direction: column;
        align-items: stretch;
    }
    .dnd-ps-save-widget {
        justify-content: center;
    }
    .dnd-ps-save-inline,
    .dnd-ps-saved-notice {
        width: 100%;
        justify-content: center;
    }
}


/* ================================================================
   v1.3.4 — Save Search button inline with results count row
   Per client screenshot: no full-width gray box; button sits
   right after "3 results for X" text.
   ================================================================ */

/* Row that holds "3 results for X" text + inline Save Search button */
.dnd-sr-count-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 0 20px;
}
.dnd-sr-count-row .dnd-sr-count {
    margin: 0;
    flex: 1 1 auto;
}
.dnd-sr-count-row .dnd-ps-save-widget {
    flex: 0 0 auto;
}

/* Compact saved-status pill: small, inline, NOT full-width per client instruction.
   Overrides the more generic .dnd-ps-saved-notice from the earlier version. */
.dnd-ps-save-widget.is-saved .dnd-ps-saved-notice {
    display: inline-flex;
    padding: 7px 12px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    line-height: 1.2;
    white-space: nowrap;
}
.dnd-ps-save-widget .dnd-ps-saved-notice .dnd-ps-remove-btn {
    font-size: 12px;
    font-weight: 600;
    padding: 0 0 0 4px;
}

/* Darken empty-state message text (client request #2) */
.dnd-ps-empty-panel p {
    color: #333333;
    font-size: 16px;
    font-weight: 400;
}

/* Mobile: stack the row on small screens */
@media (max-width: 640px) {
    .dnd-sr-count-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .dnd-sr-count-row .dnd-ps-save-widget {
        justify-content: flex-start;
    }
}
