/*!
 * Smart Stock Manager - Admin Styles
 * Author: Esmaeel Shojaei (TO3E) — https://to3edev.ir
 * Copyright (c) 2026 TO3E. All rights reserved.
 * License: Commercial
 */

/* فونت وزیرمتن */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* رنگ‌ها و پایه */
.ssm-wrap {
    --ssm-primary: #4f46e5;
    --ssm-primary-hover: #4338ca;
    --ssm-primary-soft: rgba(79, 70, 229, 0.12);
    --ssm-bg: #f1f5f9;
    --ssm-card: #ffffff;
    --ssm-border: #e2e8f0;
    --ssm-border-strong: #cbd5e1;
    --ssm-text: #0f172a;
    --ssm-text-soft: #475569;
    --ssm-muted: #64748b;
    --ssm-radius: 14px;
    --ssm-radius-sm: 10px;
    --ssm-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.15);
    --ssm-shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.12);
}

.ssm-wrap,
.ssm-wrap * {
    box-sizing: border-box;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.ssm-wrap {
    direction: rtl;
    text-align: right;
    margin: 20px 20px 40px 0;
}

.ssm-container {
    max-width: 1040px;
    background: var(--ssm-card);
    border: 1px solid var(--ssm-border);
    border-radius: var(--ssm-radius);
    padding: 28px;
    box-shadow: var(--ssm-shadow);
}

/* نوار ریست دمو — جدا از notice وردپرس تا روی h1 هدر نیفتد */
.ssm-demo-reset-bar {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-right: 4px solid #2563eb;
    border-radius: var(--ssm-radius-sm);
    padding: 12px 16px;
    margin: 0 0 14px;
    color: #1e3a8a;
    direction: rtl;
    text-align: right;
    position: relative;
    z-index: 2;
}

.ssm-demo-reset-bar-main {
    font-size: 13px;
    line-height: 1.8;
    margin: 0;
}

.ssm-demo-reset-bar-warn {
    margin-top: 8px;
    color: #b45309;
    font-size: 13px;
    line-height: 1.7;
}

.ssm-demo-reset-bar-actions {
    margin-top: 10px;
}

/* هدر برند */
.ssm-brand-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    margin: 0 0 18px;
    border-radius: var(--ssm-radius-sm);
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #7c3aed 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.ssm-brand-header::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    top: -90px;
    left: -60px;
    pointer-events: none;
}

.ssm-brand-mark {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.ssm-brand-text {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.ssm-brand-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.4;
    color: #fff;
}

.ssm-ver-badge {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.ssm-screen-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ssm-plugin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
    padding: 0;
}

.ssm-plugin-tab {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #334155 !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.ssm-plugin-tab:hover {
    border-color: #818cf8;
    color: #3730a3 !important;
}

.ssm-plugin-tab.is-active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff !important;
}

.ssm-brand-kicker {
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #c7d2fe;
}

.ssm-brand-meta {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: #e0e7ff;
    line-height: 1.6;
}

.ssm-section-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--ssm-text);
}

.ssm-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--ssm-border);
    border-radius: var(--ssm-radius-sm);
    background: #fff;
}

.ssm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 !important;
    border: none !important;
    direction: rtl;
    text-align: right;
}

.ssm-table th,
.ssm-table td {
    padding: 12px 14px !important;
    vertical-align: middle !important;
    font-size: 13px;
}

.ssm-table th {
    background: #f1f5f9 !important;
    font-weight: 600;
    color: var(--ssm-text);
}

.ssm-empty-cell {
    text-align: center !important;
    color: var(--ssm-muted);
    padding: 28px !important;
}

.ssm-muted {
    color: var(--ssm-muted);
    font-size: 12px;
}

.ssm-check-cell label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}

.ssm-form-actions {
    margin-top: 18px;
}

.ssm-log-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: #eef2ff;
    color: #4338ca;
}

.ssm-log-stock_increase { background: #dcfce7; color: #166534; }
.ssm-log-stock_decrease { background: #fee2e2; color: #991b1b; }
.ssm-log-stock_update { background: #e0e7ff; color: #3730a3; }
.ssm-log-price_update { background: #ffedd5; color: #c2410c; }

.ssm-fields-group input:disabled,
.ssm-fields-group input[readonly] {
    background: #f1f5f9;
    color: var(--ssm-muted);
    cursor: not-allowed;
}

.ssm-brand-meta a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.ssm-brand-meta a:hover {
    border-bottom-color: #fff;
}

.ssm-brand-dot {
    margin: 0 6px;
    opacity: 0.6;
}

.ssm-brand-header .ssm-help {
    position: relative;
    z-index: 2;
    margin-right: auto;
}

.ssm-brand-header .ssm-help-icon {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.ssm-brand-header .ssm-help:hover .ssm-help-icon,
.ssm-brand-header .ssm-help.is-open .ssm-help-icon {
    background: #fff;
    color: #4f46e5;
}

.ssm-page-title {
    margin: 0 0 6px 0;
    font-size: 26px;
    font-weight: 600;
    color: var(--ssm-text);
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ssm-page-subtitle {
    margin: 0 0 22px 0;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--ssm-muted);
    line-height: 1.9;
}

/* پنل‌های اصلی (باکس ۱ و ۲) */
.ssm-panel {
    border: 1px solid var(--ssm-border);
    border-radius: var(--ssm-radius);
    background: #f8fafc;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: var(--ssm-shadow-sm);
}

.ssm-panel-edit {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 40%);
}

.ssm-panel-quick {
    background: linear-gradient(180deg, #fff7ed 0%, #ffffff 45%);
    border-color: #fed7aa;
}

.ssm-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.ssm-panel-badge {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--ssm-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}

.ssm-panel-badge-alt {
    background: #ea580c;
}

.ssm-panel-head h2 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ssm-text);
}

.ssm-panel-head p {
    margin: 0;
    font-size: 12.5px;
    color: var(--ssm-muted);
    line-height: 1.8;
}

.ssm-panel .ssm-search-box {
    margin-bottom: 0;
}

.ssm-panel .ssm-results {
    margin-top: 16px;
}

.ssm-panel .ssm-results:empty {
    margin-top: 0;
}

/* جستجوی سریع با کد */
.ssm-code-search {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

#ssm-code-input {
    flex: 1;
    min-width: 0;
    height: 46px;
    border: 1px solid #fdba74;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: #fff;
    color: var(--ssm-text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#ssm-code-input:focus {
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

#ssm-code-preview-btn {
    height: 46px !important;
    padding: 0 22px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    background-color: #ea580c !important;
    border-color: #ea580c !important;
    white-space: nowrap;
}

#ssm-code-preview-btn:hover {
    background-color: #c2410c !important;
    border-color: #c2410c !important;
}

.ssm-code-preview {
    margin-top: 12px;
}

.ssm-code-preview:empty {
    margin-top: 0;
}

.ssm-quick-card {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px;
    background: #fff;
    border: 1px solid #fed7aa;
    border-radius: var(--ssm-radius-sm);
    box-shadow: var(--ssm-shadow-sm);
}

.ssm-quick-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--ssm-border);
    flex-shrink: 0;
    background: #fff;
}

.ssm-quick-info {
    flex: 1;
    min-width: 160px;
}

.ssm-quick-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ssm-text);
    line-height: 1.8;
    word-break: break-word;
}

.ssm-quick-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--ssm-muted);
}

.ssm-quick-stock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 64px;
    padding: 6px 12px;
    background: #fff7ed;
    border-radius: 8px;
    border: 1px solid #fed7aa;
}

.ssm-quick-stock-label {
    font-size: 10.5px;
    color: var(--ssm-muted);
    font-weight: 500;
}

.ssm-quick-stock-value {
    font-size: 18px;
    font-weight: 700;
    color: #c2410c;
    line-height: 1.3;
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}

.ssm-decrease-btn {
    height: 42px !important;
    padding: 0 18px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #fff !important;
    white-space: nowrap;
    box-shadow: none !important;
}

.ssm-decrease-btn:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

.ssm-decrease-btn.saving {
    background: #94a3b8 !important;
    border-color: #94a3b8 !important;
    cursor: not-allowed;
}

/* راهنمای شناور کنار عنوان */
.ssm-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    outline: none;
}

.ssm-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ssm-primary-soft);
    color: var(--ssm-primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.ssm-help:hover .ssm-help-icon,
.ssm-help:focus .ssm-help-icon,
.ssm-help.is-open .ssm-help-icon {
    background: var(--ssm-primary);
    color: #fff;
    transform: scale(1.05);
}

.ssm-help-tip {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    max-width: 78vw;
    background: #0f172a;
    color: #f1f5f9;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 2;
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: var(--ssm-shadow);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    text-align: right;
    white-space: normal;
}

.ssm-help-tip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    right: 8px;
    border: 7px solid transparent;
    border-bottom-color: #0f172a;
}

.ssm-help:hover .ssm-help-tip,
.ssm-help:focus .ssm-help-tip,
.ssm-help.is-open .ssm-help-tip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* جستجو و نتایج */
.ssm-search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 26px;
    position: relative;
    align-items: stretch;
}

.ssm-search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

#ssm-search-input {
    width: 100%;
    height: 48px;
    border: 1px solid var(--ssm-border-strong);
    border-radius: var(--ssm-radius-sm);
    padding: 0 16px;
    font-size: 14px;
    font-weight: 400;
    color: var(--ssm-text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background: #fff;
}

#ssm-search-input::placeholder {
    color: #94a3b8;
}

#ssm-search-input:focus {
    border-color: var(--ssm-primary);
    box-shadow: 0 0 0 4px var(--ssm-primary-soft);
}

#ssm-search-button {
    height: 48px;
    padding: 0 28px !important;
    border-radius: var(--ssm-radius-sm) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #fff !important;
    background-color: var(--ssm-primary) !important;
    border-color: var(--ssm-primary) !important;
    box-shadow: none !important;
    white-space: nowrap;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

#ssm-search-button:hover {
    background-color: var(--ssm-primary-hover) !important;
    border-color: var(--ssm-primary-hover) !important;
}

#ssm-search-button:active {
    transform: translateY(1px);
}

/* استایل لیست شناور نتایج جستجوی زنده */
#ssm-live-results-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--ssm-border);
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 460px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: var(--ssm-shadow);
    border-radius: var(--ssm-radius-sm);
    animation: ssm-dropdown-in 0.16s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--ssm-border-strong) transparent;
}

@keyframes ssm-dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

#ssm-live-results-list::-webkit-scrollbar {
    width: 8px;
}

#ssm-live-results-list::-webkit-scrollbar-thumb {
    background: var(--ssm-border-strong);
    border-radius: 999px;
}

#ssm-live-results-list > li {
    list-style: none;
}

/* گروه یک محصول (محصول اصلی + متغیرها) */
.ssm-live-group + .ssm-live-group {
    margin-top: 4px;
    border-top: 1px solid #f1f5f9;
    padding-top: 4px;
}

/* آیتم قابل کلیک لیست زنده */
.ssm-live-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 10px;
    text-decoration: none;
    transition: background-color 0.13s ease;
    cursor: pointer;
}

.ssm-live-item:hover,
.ssm-live-item:focus {
    background-color: #eef2ff;
    box-shadow: none;
    outline: none;
}

.ssm-live-thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--ssm-border);
    background: #fff;
    flex-shrink: 0;
}

.ssm-live-thumb-sm {
    width: 36px;
    height: 36px;
    border-radius: 6px;
}

.ssm-live-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.ssm-live-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ssm-text);
    line-height: 1.7;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ssm-live-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--ssm-muted);
}

.ssm-live-sku {
    color: var(--ssm-muted);
}

.ssm-live-price {
    color: var(--ssm-primary);
    font-weight: 600;
}

.ssm-live-price del {
    color: var(--ssm-muted);
    font-weight: 400;
    margin-left: 4px;
}

.ssm-live-price ins {
    text-decoration: none;
}

.ssm-live-side {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* نشان نوع محصول (متغیر) */
.ssm-type-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--ssm-primary-soft);
    color: var(--ssm-primary);
    white-space: nowrap;
}

/* نشان موجودی با سطوح هشدار */
.ssm-stock-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.ssm-stock-badge.stock-ok,
.ssm-stock-badge.in {
    background: #dcfce7;
    color: #166534;
}

.ssm-stock-badge.stock-warn {
    background: #fef3c7;
    color: #92400e;
}

.ssm-stock-badge.stock-danger,
.ssm-stock-badge.out {
    background: #fee2e2;
    color: #991b1b;
}

/* باکس موجودی سریع */
.ssm-quick-stock.stock-ok {
    background: #dcfce7;
    border-color: #86efac;
}
.ssm-quick-stock.stock-ok .ssm-quick-stock-value { color: #166534; }

.ssm-quick-stock.stock-warn {
    background: #fef3c7;
    border-color: #fcd34d;
}
.ssm-quick-stock.stock-warn .ssm-quick-stock-value { color: #92400e; }

.ssm-quick-stock.stock-danger {
    background: #fee2e2;
    border-color: #fca5a5;
}
.ssm-quick-stock.stock-danger .ssm-quick-stock-value { color: #991b1b; }

/* استپر موجودی رنگی */
.ssm-stepper.ssm-stock-level.stock-ok,
input.ssm-stock-level.stock-ok {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}
.ssm-stepper.ssm-stock-level.stock-ok .ssm-stock-qty {
    border-color: #86efac;
    background: #f0fdf4;
}

.ssm-stepper.ssm-stock-level.stock-warn,
input.ssm-stock-level.stock-warn {
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.28);
}
.ssm-stepper.ssm-stock-level.stock-warn .ssm-stock-qty {
    border-color: #fcd34d;
    background: #fffbeb;
}

.ssm-stepper.ssm-stock-level.stock-danger,
input.ssm-stock-level.stock-danger {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.28);
}
.ssm-stepper.ssm-stock-level.stock-danger .ssm-stock-qty {
    border-color: #fca5a5;
    background: #fef2f2;
}

/* لیست متغیرها درون دراپ‌داون */
.ssm-live-variations {
    list-style: none;
    margin: 2px 0 0 0;
    padding: 0;
    border-right: 2px solid #e0e7ff;
    margin-right: 22px;
}

.ssm-live-variations li {
    list-style: none;
}

.ssm-live-subitem {
    padding: 6px 10px;
}

.ssm-live-subitem .ssm-live-name {
    font-size: 12px;
    font-weight: 500;
    -webkit-line-clamp: 1;
    color: var(--ssm-text-soft);
}

/* حالت لودینگ و بدون نتیجه */
.ssm-live-loading,
#ssm-live-results-list .no-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--ssm-muted);
    text-align: center;
    padding: 18px;
    font-size: 13px;
    list-style: none;
}

.ssm-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid var(--ssm-border-strong);
    border-top-color: var(--ssm-primary);
    border-radius: 50%;
    animation: ssm-spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes ssm-spin {
    to { transform: rotate(360deg); }
}

/* دکمه بارگذاری صفحات بیشتر درون لیست کشویی */
.ssm-load-more-trigger {
    width: 100%;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px dashed var(--ssm-border-strong);
    cursor: pointer;
    text-align: center;
    color: var(--ssm-muted);
    font-size: 12px;
    border-radius: 8px;
    transition: all 0.15s ease;
    list-style: none;
    margin-top: 4px;
}

.ssm-load-more-trigger:hover {
    background: #eef2ff;
    color: var(--ssm-primary);
    border-color: var(--ssm-primary);
}

/* کارت محصول */
.ssm-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ssm-product-card {
    border: 1px solid var(--ssm-border);
    border-radius: var(--ssm-radius);
    padding: 22px;
    background: var(--ssm-card);
    box-shadow: var(--ssm-shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ssm-product-card:hover {
    box-shadow: var(--ssm-shadow);
}

.ssm-product-header {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ssm-border);
}

.ssm-product-image {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: var(--ssm-radius-sm);
    border: 1px solid var(--ssm-border);
    background: #fff;
    flex-shrink: 0;
}

.ssm-product-meta {
    min-width: 0;
    flex: 1;
}

.ssm-product-meta h3 {
    margin: 0 0 8px 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--ssm-text);
    line-height: 1.8;
    word-break: break-word;
}

.ssm-badge-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ssm-badge {
    background: #f1f5f9;
    color: var(--ssm-text-soft);
    font-size: 11.5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
    line-height: 1.8;
    border: 1px solid var(--ssm-border);
}

/* گروه فیلدهای ورودی (موجودی و قیمت) */
.ssm-fields-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.ssm-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 130px;
}

.ssm-input-wrapper label {
    font-size: 12px;
    font-weight: 500;
    color: var(--ssm-text-soft);
}

.ssm-fields-group input {
    width: 140px;
    height: 42px;
    border: 1px solid var(--ssm-border-strong);
    border-radius: 8px;
    padding: 0 12px;
    background: #ffffff;
    font-size: 14px;
    font-weight: 500;
    color: var(--ssm-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ssm-fields-group input:focus {
    outline: none;
    border-color: var(--ssm-primary);
    box-shadow: 0 0 0 3px var(--ssm-primary-soft);
}

/* استپر موجودی: دکمه‌های + و - در دو طرف ورودی */
.ssm-stepper {
    display: flex;
    align-items: stretch;
    gap: 6px;
    width: 140px;
}

.ssm-stepper .ssm-stock-qty {
    width: auto;
    flex: 1;
    min-width: 0;
    text-align: center;
    -moz-appearance: textfield;
}

.ssm-stepper .ssm-stock-qty::-webkit-outer-spin-button,
.ssm-stepper .ssm-stock-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ssm-step {
    flex-shrink: 0;
    width: 40px;
    height: 42px;
    border: 1px solid var(--ssm-border-strong);
    background: #fff;
    color: var(--ssm-text);
    border-radius: 8px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: background-color 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}

.ssm-step:hover {
    background: var(--ssm-primary);
    border-color: var(--ssm-primary);
    color: #fff;
}

.ssm-step:active {
    transform: translateY(1px);
}

.ssm-step-down:hover {
    background: #ef4444;
    border-color: #ef4444;
}

.ssm-save-button {
    height: 42px !important;
    border-radius: 8px !important;
    padding: 0 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #fff !important;
    background-color: var(--ssm-primary) !important;
    border-color: var(--ssm-primary) !important;
    box-shadow: none !important;
    white-space: nowrap;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.ssm-save-button:hover {
    background-color: var(--ssm-primary-hover) !important;
    border-color: var(--ssm-primary-hover) !important;
}

.ssm-save-button:active {
    transform: translateY(1px);
}

/* متغیرها */
.ssm-variations {
    margin-top: 4px;
}

.ssm-variations h4 {
    margin: 0 0 14px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ssm-text-soft);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ssm-variation-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px;
    border: 1px solid var(--ssm-border);
    border-radius: var(--ssm-radius-sm);
    background: #f8fafc;
    margin-bottom: 10px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ssm-variation-row:last-child {
    margin-bottom: 0;
}

.ssm-variation-row:hover {
    border-color: var(--ssm-border-strong);
    background: #fff;
}

/* بلوک اطلاعات متغیر: عکس + متن‌ها */
.ssm-variation-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.ssm-variation-image {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--ssm-border);
    background: #fff;
    flex-shrink: 0;
}

.ssm-variation-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.ssm-variation-text strong {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ssm-text);
    line-height: 1.9;
    word-break: break-word;
}

.ssm-variation-text span {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--ssm-muted);
    line-height: 1.7;
    word-break: break-word;
}

/* پیام‌ها */
.ssm-notice {
    padding: 14px 18px;
    border-radius: var(--ssm-radius-sm);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.9;
}

.ssm-notice-warning {
    background: #fef3c7;
    color: #78350f;
    border: 1px solid #fde68a;
}

.ssm-notice-info {
    background: #f0fdf4;
    color: #14532d;
    border: 1px solid #bbf7d0;
}

/* باکس راهنما (آکاردئون) */
.ssm-guide-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    border: 1px solid #bae6fd;
    border-right: 4px solid #0284c7;
    border-radius: var(--ssm-radius-sm);
    padding: 0;
    margin: 0 0 18px;
}

.ssm-guide-accordion > summary.ssm-guide-title {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
}

.ssm-guide-accordion > summary.ssm-guide-title::-webkit-details-marker {
    display: none;
}

.ssm-guide-accordion > summary.ssm-guide-title::after {
    content: "+";
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 16px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}

.ssm-guide-accordion[open] > summary.ssm-guide-title::after {
    content: "−";
}

.ssm-guide-toggle-hint {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    margin-right: auto;
    margin-left: 8px;
}

.ssm-guide-accordion .ssm-guide-list {
    padding: 0 18px 14px 0;
    margin: 0;
}

.ssm-guide-title {
    font-size: 14px;
    font-weight: 700;
    color: #0c4a6e;
    margin: 0 0 10px;
    line-height: 1.6;
}

.ssm-guide-list {
    margin: 0;
    padding: 0 18px 0 0;
    list-style: disc;
}

.ssm-guide-list li {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    line-height: 1.9;
    margin: 0 0 4px;
}

/* صفحه آموزش */
.ssm-help-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.ssm-help-block {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-right: 4px solid #4f46e5;
    border-radius: var(--ssm-radius-sm);
    padding: 16px 18px;
}

.ssm-help-block-demo {
    border-right-color: #2563eb;
    background: #f8fafc;
}

.ssm-help-block h3 {
    margin: 0 0 10px;
    font-size: 15px;
    color: #1e293b;
}

.ssm-help-block p {
    margin: 0;
    font-size: 13px;
    line-height: 1.9;
    color: #334155;
}

.ssm-help-steps,
.ssm-help-list {
    margin: 0;
    padding: 0 18px 0 0;
    font-size: 13px;
    line-height: 1.95;
    color: #334155;
}

.ssm-help-steps li,
.ssm-help-list li {
    margin-bottom: 6px;
}

.ssm-guide-list li:last-child {
    margin-bottom: 0;
}

/* هدف بارکدخوان */
.ssm-scanner-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 12px 16px;
    margin: 0 0 18px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--ssm-radius-sm);
}

.ssm-scanner-label {
    font-size: 13px;
    font-weight: 700;
    color: #9a3412;
}

.ssm-scanner-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #431407;
    cursor: pointer;
}

.ssm-scanner-hint {
    font-size: 12px;
    color: #9a3412;
    opacity: 0.85;
}

.ssm-panel.ssm-scan-active {
    box-shadow: 0 0 0 2px #fb923c;
}

.ssm-variation-focus {
    outline: 2px solid #0284c7;
    background: #f0f9ff !important;
    border-radius: 8px;
}

.ssm-log-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.ssm-log-filter {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.ssm-log-filter:hover {
    border-color: #94a3b8;
    color: #0f172a;
}

.ssm-log-filter.is-active {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

/* جستجوی کاربر در تنظیمات دسترسی */
.ssm-user-search {
    background: #fff;
    border: 1px solid var(--ssm-border);
    border-radius: var(--ssm-radius-sm);
    padding: 14px 16px;
    margin: 0 0 16px;
}

.ssm-user-search-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ssm-text);
    margin: 0 0 8px;
}

.ssm-user-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ssm-user-search-row input[type="search"] {
    flex: 1 1 240px;
    min-height: 40px;
    border: 1px solid var(--ssm-border-strong);
    border-radius: 8px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 13px;
}

.ssm-demo-badge {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fdba74;
}

.ssm-guide-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fde68a;
    border-right-color: #d97706;
}

.ssm-guide-warning .ssm-guide-title {
    color: #92400e;
}

.ssm-guide-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #bbf7d0;
    border-right-color: #16a34a;
}

.ssm-guide-success .ssm-guide-title {
    color: #14532d;
}

.ssm-perm-hint {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: #b45309;
    line-height: 1.6;
}

.ssm-perm-hint-inline {
    align-self: center;
    margin-top: 0;
    padding: 8px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--ssm-radius-sm);
}

/* دکمه بارگذاری موارد بیشتر در لیست اصلی */
.ssm-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.ssm-load-more-button {
    height: 44px !important;
    border-radius: var(--ssm-radius-sm) !important;
    padding: 0 28px !important;
    font-weight: 600 !important;
}

/* دکمه‌ها */
.ssm-save-button.saving {
    background: #94a3b8 !important;
    border-color: #94a3b8 !important;
    cursor: not-allowed;
    opacity: 0.9;
}

.ssm-save-button.success-pulse {
    background: #16a34a !important;
    border-color: #16a34a !important;
    animation: ssm-pulse 0.4s ease;
}

@keyframes ssm-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ریسپانسیو */
@media (max-width: 782px) {
    .ssm-wrap {
        margin: 12px 10px 30px 0;
    }

    .ssm-container {
        padding: 18px;
        border-radius: var(--ssm-radius-sm);
    }

    .ssm-page-title {
        font-size: 21px;
    }

    .ssm-page-subtitle {
        margin-bottom: 20px;
    }

    .ssm-brand-header {
        flex-wrap: wrap;
        padding: 16px;
        gap: 12px;
    }

    .ssm-brand-title {
        font-size: 18px;
    }

    .ssm-brand-meta {
        font-size: 11.5px;
    }

    .ssm-code-search {
        flex-direction: column;
    }

    #ssm-code-preview-btn {
        width: 100%;
    }

    .ssm-panel {
        padding: 14px;
    }

    .ssm-quick-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .ssm-quick-thumb {
        margin: 0 auto;
    }

    .ssm-quick-stock {
        width: 100%;
    }

    .ssm-decrease-btn {
        width: 100% !important;
    }

    /* جستجو: دکمه زیر ورودی، تمام عرض */
    .ssm-search-box {
        flex-direction: column;
        gap: 10px;
    }

    #ssm-search-button {
        width: 100%;
    }

    #ssm-live-results-list {
        max-height: 62vh;
    }

    .ssm-live-thumb {
        width: 40px;
        height: 40px;
    }

    .ssm-live-thumb-sm {
        width: 32px;
        height: 32px;
    }

    .ssm-live-item {
        gap: 10px;
        padding: 8px;
    }

    .ssm-live-variations {
        margin-right: 14px;
    }

    /* روی موبایل قیمت زیر نام و badge کوچک بماند تا شلوغ نشود */
    .ssm-live-meta {
        gap: 8px;
    }

    /* هدر محصول: عکس بالا و متن وسط‌چین */
    .ssm-product-card {
        padding: 16px;
    }

    .ssm-product-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    .ssm-product-meta {
        width: 100%;
    }

    .ssm-badge-container {
        justify-content: center;
    }

    /* ردیف متغیر: چیدمان عمودی و تمام عرض */
    .ssm-variation-row {
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
        gap: 14px;
    }

    .ssm-variation-info {
        min-width: 100%;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--ssm-border);
    }

    /* فیلدها: موجودی و قیمت کنار هم، دکمه تمام عرض */
    .ssm-fields-group {
        width: 100%;
        gap: 10px;
    }

    .ssm-input-wrapper {
        flex: 1;
        min-width: 0;
    }

    .ssm-fields-group input {
        width: 100%;
    }

    .ssm-stepper {
        width: 100%;
    }

    .ssm-step {
        width: 48px;
    }

    .ssm-save-button {
        width: 100% !important;
        margin-top: 2px;
    }

    /* راهنما روی موبایل: عرض بیشتر و چیدمان بهینه */
    .ssm-help-tip {
        width: 84vw;
        max-width: 84vw;
    }
}

/* موبایل کوچک: فیلدها هم زیر هم */
@media (max-width: 480px) {
    .ssm-fields-group {
        flex-direction: column;
        align-items: stretch;
    }

    .ssm-input-wrapper {
        width: 100%;
    }

    .ssm-variation-info {
        flex-direction: column;
        text-align: center;
    }

    .ssm-variation-text {
        align-items: center;
    }
}
