/*
 * ⚠ اصلاحِ ۲۰۲۶-۰۸-۱۶: این سلکتور تا امروز .dm-waitlist-btn-class/.dm-wishlist-btn-class
 * بود — پسوندِ «-class» که در هیچ‌کدام از قالب‌ها (templates/waitlist-btn.php،
 * wishlist-btn.php، waitlist-nostock-btn.php) روی خودِ عنصر نیست؛ کلاسِ واقعیِ
 * رندرشده همیشه .dm-waitlist-btn/.dm-wishlist-btn بوده. یعنی از روز اول این
 * قانون هرگز روی هیچ دکمه‌ای نمی‌نشست و دکمه‌ها بدونِ استایلِ پایه (فقط متن)
 * روی هر سایتی می‌ماندند مگر قالبِ میزبان خودش کاملاً بازنویسی‌شان می‌کرد.
 */
.dm-waitlist-btn, .dm-wishlist-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: var(--dm-btn-bg, #fff);
    color: var(--dm-btn-text, #333);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    /* 3.5.1: هر سه قالب حالا <button> هستند؛ دکمه فونت را از والد ارث نمی‌برد. */
    font-family: inherit;
    line-height: inherit;
    margin: 0 4px;
}

/*
 * ⚠ 4.1.1 — hover and active read the colours the ADMIN sets (Config::button_color_css prints
 * --dm-btn-text / --dm-btn-active on :root, only when saved). Before, both read `--dm-primary`
 * with no fallback: on a site where nothing defines it the value is invalid ⇒ the button simply
 * inherits its parent's colour (MEASURED #333), so the «رنگ فعال» setting had no effect at all,
 * and `border:none` made the active button 2px narrower than the normal one. `--dm-primary`
 * (defined by some house plugins' token sheets) stays as the fallback, so a site that relied on
 * it looks exactly as it did unless its admin saved an active colour.
 */
.dm-waitlist-btn:hover, .dm-wishlist-btn:hover {
    color: var(--dm-primary, var(--dm-btn-text, #333));
}

.dm-waitlist-btn.active, .dm-wishlist-btn.active {
    /* same 1px border as the normal state, only its colour changes — the box never jumps */
    border-color: var(--dm-btn-active, transparent);
    color: var(--dm-btn-active, var(--dm-primary));
}

/* آیکون SVG */
.dm-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    transition: fill 0.3s ease;
    margin-top: 6px;
}

.dm-waitlist-btn.active .dm-icon svg,
.dm-wishlist-btn.active .dm-icon svg {
    fill: currentColor;
}

/* 3.5.2: the front-end waitlist modal styles were removed with the dead template
   (templates/waitlist-modal.php, never included since 3.x — the guest list is cookie-based). */

/* 3.5.2: replaces a <br> between the two lists in the customer panel. */
.dm-panel-heading-gap {
    margin-top: 28px;
}

/* --- استایل جداول پنل کاربری --- */
.dm-panel-wrapper {
    margin-bottom: 30px;
    overflow-x: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.dm-custom-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
    margin: 0;
}

.dm-custom-table th, .dm-custom-table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid #f1f1f1;
    vertical-align: middle;
}

.dm-custom-table thead th {
    background-color: #f8f9fa;
    color: #444;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid #eee;
}

.dm-product-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    color: #333;
}

.dm-product-link:hover {
    color: #007cba;
}

.dm-product-link img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
    display: block;
}

.dm-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
}

.dm-badge-success {
    background-color: #e6fffa;
    color: #047481;
}

.dm-badge-danger {
    background-color: #fff5f5;
    color: #c53030;
}

@media screen and (max-width: 768px) {
    .dm-custom-table thead {
        display: none;
    }

    .dm-custom-table tbody, .dm-custom-table tr, .dm-custom-table td {
        display: block;
        width: 100%;
    }

    .dm-custom-table tr {
        margin-bottom: 15px;
        border: 1px solid #eee;
        border-radius: 8px;
        padding: 10px;
    }

    .dm-custom-table td {
        text-align: right;
        padding: 10px 0;
        border-bottom: 1px dashed #eee;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .dm-custom-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #777;
        font-size: 12px;
        margin-left: 10px;
    }

    .dm-td-product {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dm-td-product::before {
        display: none;
    }

    .dm-custom-table .dm-waitlist-btn, .dm-custom-table .dm-wishlist-btn {
        width: 100%;
        justify-content: center;
    }
}

/* --- استایل جدول پنل کاربری --- */
.dm-dashboard-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.dm-dashboard-table th {
    /* استفاده از رنگ پس‌زمینه انتخابی کاربر برای هدر جدول */
    background: var(--dm-btn-bg, #f4f4f4);

    /* استفاده از رنگ متن انتخابی کاربر */
    color: var(--dm-btn-text, #333);

    padding: 15px;
    text-align: right;
    font-weight: 600;
    border-bottom: 2px solid #eee;
}

.dm-dashboard-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    color: #555;
}

/* --- استایل دکمه حذف در جدول --- */
.dm-btn-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #dc3545; /* رنگ قرمز برای حذف به صورت پیش‌فرض */
    transition: all 0.2s;
    cursor: pointer;
}

.dm-btn-remove:hover {
    /* در حالت هاور، از رنگ تنظیم شده (مثلا رنگ اصلی سایت) استفاده شود */
    background: var(--dm-btn-bg, #dc3545);
    color: var(--dm-btn-text, #fff);
    border-color: var(--dm-btn-bg, #dc3545);
}

/* --- استایل بج‌های وضعیت (Badges) --- */
.dm-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

/* حالت‌های خاص بج */
.dm-status-badge.in-stock {
    /* استفاده از رنگ اکتیو (معمولا سبز) برای موجود */
    background-color: var(--dm-btn-active, #28a745);
    color: #fff;
}

.dm-status-badge.out-of-stock {
    /* برای ناموجود بهتر است قرمز بماند یا از رنگ متن استفاده شود */
    background-color: #dc3545;
    color: #fff;
}

/* اگر دکمه‌های دیگری در پنل هستند */
.dm-dashboard-actions a.button {
    background: var(--dm-btn-bg, #eee);
    color: var(--dm-btn-text, #333);
    border: 1px solid #ddd;
}

.dm-sp-info {
    position: relative;
}

.dm-sp-save-btn {
    position: absolute;
    left: 16px;
}

.dm-sp-save-btn .dm-wishlist-btn {
    border: none !important;
    outline: none !important;
    background-color: transparent;
    cursor: pointer;
}

.dm-sp-social-btn {
    border-radius: 50%;
}

body.theme-dark .dm-icon svg {
    stroke: var(--dm-text) !important;
}

.dm-waitlist-archive-btn {
    background: transparent;
    border: none;
}
/*
 * 3.7.0 — the sentence shown when a waitlist sign-up cannot be reached yet.
 *
 * Deliberately plain and theme-agnostic: it inherits the surrounding colour rather than bringing
 * its own, because this plugin ships onto themes whose palettes it cannot know, and a hardcoded
 * ground is how a message ends up unreadable on somebody else's site.
 */
.dm-eng-notice {
	margin: 8px 0 0;
	font-size: .875em;
	line-height: 1.8;
	opacity: .85;
}

/*
 * 3.8.0 — the phone modal for «خبرم کن» (opt-in, admin setting). Same layout as the 2.x modal it
 * replaces: centred white card, blue full-width submit. Every colour reads a role-named custom
 * property with the literal as fallback (+SKINNABLE): --dm-eng-phone-surface · --dm-eng-phone-accent ·
 * --dm-eng-phone-on-accent · --dm-eng-phone-ink · --dm-eng-phone-line. Everything sits under ONE
 * prefixed root (+CSS-SCOPE); RTL by logical properties, the phone field itself is LTR.
 */
.dm-eng-phone-modal,
.dm-eng-phone-modal *,
.dm-eng-phone-modal *::before,
.dm-eng-phone-modal *::after {
	box-sizing: border-box;
}

.dm-eng-phone-modal[hidden],
.dm-eng-phone-modal [hidden] {
	display: none !important;
}

.dm-eng-phone-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	direction: rtl;
	text-align: start;
	font-family: inherit;
}

.dm-eng-phone-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .6);
	backdrop-filter: blur(2px);
}

.dm-eng-phone-dialog {
	position: relative;
	width: min(400px, 100%);
	max-height: calc(100vh - 32px);
	overflow: auto;
	border-radius: 12px;
	background: var(--dm-eng-phone-surface, #fff);
	color: var(--dm-eng-phone-ink, #333);
	box-shadow: 0 10px 25px rgba(0, 0, 0, .2);
	animation: dm-eng-phone-in .3s ease;
}

@keyframes dm-eng-phone-in {
	from { opacity: 0; transform: translateY(20px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.dm-eng-phone-dialog {
		animation: none !important;
	}
}

.dm-eng-phone-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 15px 20px;
	border-block-end: 1px solid var(--dm-eng-phone-line, #eee);
	background: rgba(0, 0, 0, .025);
}

.dm-eng-phone-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.6;
	color: inherit;
}

.dm-eng-phone-x {
	flex: 0 0 auto;
	min-width: 32px;
	min-height: 32px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	opacity: .6;
}

.dm-eng-phone-x:hover,
.dm-eng-phone-x:focus-visible {
	opacity: 1;
}

.dm-eng-phone-body {
	margin: 0;
	padding: 20px;
	text-align: center;
}

.dm-eng-phone-desc {
	margin: 0 0 16px;
	font-size: 14px;
	line-height: 1.9;
	opacity: .8;
}

.dm-eng-phone-label {
	display: block;
	margin-block-end: 6px;
	font-size: 13px;
	text-align: start;
}

.dm-eng-phone-input {
	display: block;
	width: 100%;
	min-width: 0;
	padding: 12px;
	border: 2px solid var(--dm-eng-phone-line, #eee);
	border-radius: 8px;
	background: #fff;
	color: #222;
	font-size: 16px;
	letter-spacing: .04em;
	text-align: center;
	direction: ltr;
	outline: none;
	transition: border-color .3s;
}

/* a Persian placeholder inside the LTR field: direction from its first strong character */
.dm-eng-phone-input::placeholder {
	unicode-bidi: plaintext;
	opacity: .55;
}

.dm-eng-phone-input:focus {
	border-color: var(--dm-eng-phone-accent, #007cba);
}

.dm-eng-phone-input[aria-invalid="true"] {
	border-color: #b32d2e;
}

.dm-eng-phone-msg {
	margin: 12px 0 0;
	padding: 10px;
	border-radius: 6px;
	font-size: 13px;
	line-height: 1.8;
	color: #721c24;
	background: #f8d7da;
	border: 1px solid #f5c6cb;
}

.dm-eng-phone-msg.is-success {
	color: #155724;
	background: #d4edda;
	border-color: #c3e6cb;
}

.dm-eng-phone-submit {
	display: block;
	width: 100%;
	margin-block-start: 15px;
	padding: 12px;
	border: 0;
	border-radius: 8px;
	background: var(--dm-eng-phone-accent, #007cba);
	color: var(--dm-eng-phone-on-accent, #fff);
	font: inherit;
	font-size: 15px;
	cursor: pointer;
	transition: filter .3s;
}

.dm-eng-phone-submit:hover {
	filter: brightness(.9);
}

.dm-eng-phone-submit:disabled {
	opacity: .65;
	cursor: wait;
}

.dm-eng-phone-x:focus-visible,
.dm-eng-phone-submit:focus-visible {
	outline: 2px solid var(--dm-eng-phone-accent, #007cba);
	outline-offset: 2px;
}

body.dm-eng-phone-open {
	overflow: hidden;
}
