/* =========================================================================
 * سلام‌گیت – web panel shell (Figma "پنل سلام‌گیت": bs-header + Vendor Menu).
 * The app itself keeps the plugin's admin.css; this file only lays out the page around it.
 * ========================================================================= */

html, body { margin: 0; padding: 0; }

.sgp-body {
	--sgp-border: #e7e7e9;
	--sgp-title: #252438;
	--sgp-title-1: #0d0c22;
	--sgp-caption: #6e6d7a;
	--sgp-active: rgba(209, 227, 240, .5);
	--sgp-yellow: #ffc800;
	--sgp-yellow-hover: #f0bb00;
	background: #fff;
	color: var(--sgp-title);
	font-family: 'Salamgate Vazirmatn', Vazirmatn, Tahoma, sans-serif;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
}

.sgp-body *, .sgp-body *::before, .sgp-body *::after { box-sizing: border-box; }

/* ---------- header (bs-header, 97px) ---------- */

.sgp-header {
	display: flex; align-items: center; justify-content: space-between;
	height: 97px; padding: 0 40px;
	background: #fff; border-bottom: 1px solid var(--sgp-border);
}
.sgp-header img { display: block; }

.sgp-account { position: relative; }
.sgp-account summary {
	display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer;
	height: 40px; min-width: 163px; padding: 9px 16px;
	border: 1px solid var(--sgp-border); border-radius: 8px; background: #fff;
	color: #3d3d4e; font-size: 14px; font-weight: 500; line-height: 22.4px;
}
.sgp-account summary::-webkit-details-marker { display: none; }
.sgp-account__menu {
	position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 50; min-width: 163px;
	background: #fff; border: 1px solid var(--sgp-border); border-radius: 8px;
	box-shadow: 0 12px 32px rgba(16, 24, 40, .12); overflow: hidden;
}
.sgp-account__menu a, .sgp-account__menu button {
	display: block; width: 100%; padding: 10px 16px; border: 0; background: none; text-align: start;
	font: inherit; font-size: 14px; color: var(--sgp-title); text-decoration: none; cursor: pointer;
}
.sgp-account__menu a:hover, .sgp-account__menu button:hover { background: #f5f6f8; }
.sgp-account__menu button { color: #c8281c; }

/* ---------- layout: Vendor Menu (360) beside the content (1010) ---------- */

.sgp-layout {
	display: flex; gap: 32px; align-items: flex-start;
	max-width: 1402px; margin: 20px auto 40px; padding: 0 24px;
}
.sgp-side { flex: 0 0 360px; position: sticky; top: 20px; }
.sgp-main.salamgate-wrap { flex: 1; min-width: 0; margin: 0; }
.sgp-main #salamgate-app { max-width: none; margin: 0; }

/* ---------- Vendor Menu ---------- */

.sgp-menu {
	border: 1px solid var(--sgp-border); border-radius: 16px; overflow: hidden; background: #fff;
}
.sgp-profile {
	display: flex; align-items: center; justify-content: flex-end; flex-direction: row-reverse; gap: 12px;
	padding: 24px 24px 16px;
}
.sgp-profile__text { flex: 1; min-width: 0; line-height: 1.6; }
.sgp-profile__name {
	font-size: 16px; font-weight: 500; color: var(--sgp-title);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sgp-profile__shop { font-size: 14px; color: var(--sgp-caption); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sgp-profile__avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.sgp-profile__avatar--empty {
	display: inline-flex; align-items: center; justify-content: center;
	background: #eceefb; color: #1c2575; font-size: 24px; font-weight: 700;
}

.sgp-row {
	display: flex; align-items: center; gap: 8px; padding: 12px 24px;
	color: var(--sgp-title); text-decoration: none; font-size: 16px; font-weight: 500; line-height: 1.6;
	transition: background 150ms;
}
.sgp-row > img { flex-shrink: 0; }
.sgp-row__title { flex: 1; }
.sgp-row__value { display: inline-flex; align-items: center; gap: 4px; }
.sgp-row__value b { font-size: 14px; font-weight: 700; color: var(--sgp-title-1); }
.sgp-row--link:hover { background: #f7f9fb; }
.sgp-row.is-active { background: var(--sgp-active); }
a.sgp-row[data-sgp-balance]:hover { background: #f7f9fb; }

.sgp-divider { height: 1px; background: var(--sgp-border); }
.sgp-send { padding: 16px 24px 8px; }
.sgp-send .sg-btn { width: 100%; }

/* Yellow call to action of the design ("ارسال مرسوله"). */
.sgp-body .sgp-btn-yellow {
	min-height: 48px; border-color: var(--sgp-yellow); background: var(--sgp-yellow);
	color: #1c2575 !important; border-radius: 8px; font-size: 16px;
}
.sgp-body .sgp-btn-yellow:hover { background: var(--sgp-yellow-hover); border-color: var(--sgp-yellow-hover); color: #1c2575 !important; }

/* ---------- login ---------- */

.sgp-login.salamgate-wrap { margin: 0; }
.sgp-login #salamgate-app { max-width: 640px; margin: 48px auto; padding: 0 16px; }
.sgp-login .sg-landing__logo { width: auto; height: auto; }
.sgp-login .sgp-btn-yellow { min-width: 240px; }

/* ---------- «گیرنده‌های قبلی» picker (Basalam salam-gate send page) ---------- */
#salamgate-app .sg-prev-receivers__open { margin-bottom: 16px; }
.sg-prev-receivers__search {
	display: flex; align-items: center; gap: 10px; padding: 0 14px; margin: 12px 0 16px;
	background: #f3f4f6; border-radius: 8px; color: #6e6d7a;
}
#salamgate-app .sg-prev-receivers__search input {
	flex: 1; border: 0; background: transparent; min-height: 44px; padding: 0; font: inherit; color: #252438; box-shadow: none; outline: none;
}
.sg-prev-receivers__list { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 2px; }
.sg-prev-receivers__empty { text-align: center; padding: 24px 0; }
.sg-prev-receiver {
	display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; cursor: pointer;
	border: 1.4px solid #e2e4e9; border-radius: 12px; background: #fff; transition: border-color 150ms;
}
.sg-prev-receiver:hover { border-color: #c9cde8; }
.sg-prev-receiver.is-selected { border-color: #1c2575; box-shadow: 0 0 0 3px rgba(28, 37, 117, .08); }
.sg-prev-receiver__head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sg-prev-receiver__head input { margin: 0; accent-color: #1c2575; width: 18px; height: 18px; }
.sg-prev-receiver__row { color: #55595f; font-size: 13px; line-height: 1.7; padding-inline-start: 28px; }
.sg-prev-receiver__row.sg-ltr-num { direction: ltr; text-align: right; unicode-bidi: plaintext; }

/* Mixin «در انتظار ارسال»: without bulk sending there is nothing to pick. */
#salamgate-app .sg-no-pick .sg-col-check { display: none; }

/* ---------- admin panel ---------- */
.sgp-group__title { color: var(--sgp-title); }
.sgp-group__chevron { flex-shrink: 0; transition: transform 150ms; }
.sgp-group.is-open .sgp-group__chevron { transform: rotate(180deg); }
.sgp-group:not(.is-open) .sgp-row--sub { display: none; }
.sgp-row--sub { padding-inline-start: 52px; font-size: 15px; font-weight: 400; }
.sgp-row--sub.is-active { font-weight: 700; }
.sgp-admin-search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.sgp-admin-search .sg-input { flex: 1 1 220px; width: auto; }
.sgp-admin-search select.sg-input { flex: 0 1 160px; }
.sgp-grant { display: inline-flex; gap: 6px; align-items: center; }
#salamgate-app .sgp-grant .sg-input { flex: 0 0 76px; width: 76px; min-height: 36px; padding: 4px 8px; text-align: center; }
.sgp-pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }
.sg-col-actions form { display: inline-flex; }
#salamgate-app .sgp-grant select.sg-input { flex: 0 1 auto; width: auto; min-width: 130px; text-align: start; }
.sgp-sub-actions { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.sgp-sub-actions .sgp-grant { flex-wrap: wrap; }
.sgp-sub-actions .sg-field__label { flex-basis: 100%; margin: 0; }
#salamgate-app .sgp-role .sg-input { min-height: 36px; padding: 4px 8px; width: auto; min-width: 120px; }

/* Plans: admin editor rows and the user's plan cards. */
.sgp-plan-fields { display: grid; grid-template-columns: 2fr 1fr 1.4fr .8fr auto auto; gap: 12px; align-items: end; margin-bottom: 12px; }
.sgp-plan-form .sgp-plan-fields { grid-template-columns: 2fr 1fr 1.4fr .8fr; }
#salamgate-app .sgp-plan-fields .sg-field { margin: 0; }
#salamgate-app .sgp-plan-fields .sg-check { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.sgp-plan-actions { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.sgp-plan-row { border-bottom: 1px solid var(--sgp-border, #eee); padding-top: 12px; }
.sgp-plan-row:last-child { border-bottom: 0; }
.sgp-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.sgp-plan { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1.5px solid #e2e2e2; border-radius: 12px; cursor: pointer; }
.sgp-plan input { position: absolute; inset-inline-end: 12px; top: 14px; }
.sgp-plan:has(input:checked) { border-color: #f5b800; background: #fffaeb; }
.sgp-plan__title { font-weight: 700; }
.sgp-plan__price { font-size: 20px; font-weight: 700; }
.sgp-plan__price small { font-size: 13px; font-weight: 400; }
.sgp-plan__days { color: #888; font-size: 13px; }
.sg-settings--one { max-width: 760px; }
.sgp-sub-left { font-size: 15px; margin-bottom: 8px; }
.sgp-sub-left b { font-size: 28px; font-weight: 800; margin-inline-end: 4px; }
@media (max-width: 960px) {
	.sgp-plan-fields, .sgp-plan-form .sgp-plan-fields { grid-template-columns: 1fr 1fr; }
	.sgp-plan-fields .sg-field:first-child { grid-column: 1 / -1; }
	.sgp-plan-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* Desktop: the drawer/tab-bar parts of the shell stay hidden. */
.sgp-side__close, .sgp-backdrop, .sgp-fab, .sgp-tabbar { display: none; }
button.sgp-row { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: start; }
.sgp-row--logout { color: #c8281c; }

/* ---------- mobile (Figma 375px frames) ----------
 * Content takes the full width; the side menu becomes a drawer opened from the tab bar;
 * a floating yellow "ارسال مرسوله" and a bottom tab bar replace the desktop menu. */
@media (max-width: 960px) {
	.sgp-header { height: 60px; padding: 0 16px; position: sticky; top: 0; z-index: 30; }
	.sgp-header > a img { width: 104px; height: auto; }
	.sgp-account { display: none; }

	.sgp-layout { display: block; margin: 12px 0 0; padding: 0 12px 140px; }
	.sgp-main.salamgate-wrap { width: 100%; }

	/* drawer */
	.sgp-side {
		position: fixed; inset: 0 0 0 auto; z-index: 60; width: min(88vw, 360px);
		transform: translateX(105%); transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
		overflow-y: auto; background: #fff; box-shadow: -12px 0 32px rgba(16, 24, 40, .18);
	}
	.sgp-body.sgp-drawer-open .sgp-side { transform: none; }
	.sgp-menu { border: 0; border-radius: 0; min-height: 100%; position: relative; padding-bottom: 24px; }
	.sgp-side__close {
		display: inline-flex; position: absolute; top: 12px; inset-inline-end: 12px; z-index: 1;
		width: 40px; height: 40px; align-items: center; justify-content: center;
		border: 0; border-radius: 50%; background: #f5f6f8; color: #3d3d4e; cursor: pointer;
	}
	.sgp-profile { padding-top: 56px; }
	.sgp-send { display: none; }
	.sgp-backdrop {
		display: block; position: fixed; inset: 0; z-index: 55; background: rgba(13, 12, 34, .45);
		opacity: 0; pointer-events: none; transition: opacity 200ms;
	}
	.sgp-body.sgp-drawer-open .sgp-backdrop { opacity: 1; pointer-events: auto; }
	.sgp-body.sgp-drawer-open { overflow: hidden; }

	/* floating send button + bottom tab bar */
	.sgp-fab {
		display: inline-flex; align-items: center; gap: 8px; position: fixed; z-index: 40;
		left: 16px; bottom: calc(76px + env(safe-area-inset-bottom));
		height: 48px; padding: 0 18px; border-radius: 12px; background: #ffc800; color: #1c2575;
		font-weight: 700; font-size: 15px; text-decoration: none; box-shadow: 0 8px 20px rgba(16, 24, 40, .18);
	}
	.sgp-body.sgp-no-fab .sgp-fab { display: none; }
	.sgp-tabbar {
		display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 40; inset: auto 0 0 0;
		height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
		background: #fff; border-top: 1px solid #e7e7e9;
	}
	.sgp-tabbar a, .sgp-tabbar button {
		display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
		border: 0; background: none; font: inherit; font-size: 11px; color: #6e6d7a; text-decoration: none;
		cursor: pointer; position: relative; padding: 0;
	}
	.sgp-tabbar img { opacity: .75; }
	.sgp-tabbar .is-active { color: #1c2575; font-weight: 700; }
	.sgp-tabbar .is-active img { opacity: 1; }
	.sgp-tabbar .is-active::before {
		content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: #ffc800;
	}

	/* app content */
	.sgp-main #salamgate-app { font-size: 14px; }
	.sgp-main .sg-card { padding: 16px; }
	.sgp-main .sg-header { margin-bottom: 16px; }
	.sgp-main .sg-header h1 { font-size: 18px; }
	.sgp-main .sg-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
	.sgp-main .sg-tabs::-webkit-scrollbar { display: none; }
	.sgp-main .sg-tabs > * { flex-shrink: 0; }
	.sgp-main .sg-toolbar, .sgp-main .sg-toolbar__group { flex-wrap: wrap; }

	/* tables become cards; each cell is labelled with its column title (data-label, set by panel.js) */
	.sgp-main .sg-table-wrap { margin: 0; padding: 0; overflow: visible; }
	.sgp-main .sg-table, .sgp-main .sg-table tbody { display: block; width: 100%; }
	.sgp-main .sg-table thead { display: none; }
	.sgp-main .sg-table tbody tr {
		display: block; border: 1px solid #e2e4e9; border-radius: 12px; padding: 8px 14px; margin-bottom: 12px; background: #fff;
	}
	.sgp-main .sg-table tbody tr.is-selected { border-color: #1c2575; }
	.sgp-main .sg-table td {
		display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 12px; align-items: center;
		padding: 7px 0; border: 0; border-bottom: 1px dashed #eef0f3; text-align: end;
	}
	.sgp-main .sg-table td::before {
		content: attr(data-label); grid-column: 1; grid-row: 1 / span 6; align-self: start;
		color: #6e6d7a; font-size: 12px; text-align: start; padding-top: 2px;
	}
	.sgp-main .sg-table td > * { grid-column: 2; justify-self: end; max-width: 100%; }
	.sgp-main .sg-table td:not([data-label])::before, .sgp-main .sg-table td[data-label=""]::before { content: none; }
	.sgp-main .sg-table td:not([data-label]) > *, .sgp-main .sg-table td[data-label=""] > * { grid-column: 1 / -1; }
	.sgp-main .sg-table td.sg-col-check, .sgp-main .sg-table td.sg-col-actions { display: flex; gap: 8px; align-items: center; }
	.sgp-main .sg-table td.sg-col-actions { justify-content: flex-end; border-bottom: 0; padding-top: 10px; }
	.sgp-main .sg-table td.sg-col-check { border-bottom: 0; }
	.sgp-main .sg-table td.sg-col-check::before, .sgp-main .sg-table td.sg-col-actions::before { content: none; }
	/* admin.css sizes the actions column to 1% of a desktop row; a card needs the full width */
	.sgp-main .sg-table td, .sgp-main .sg-table .sg-col-actions, .sgp-main .sg-table .sg-col-check { width: auto; white-space: normal; }
	.sgp-main .sg-table td.sg-col-actions { flex-wrap: wrap; gap: 8px; }
	.sgp-main .sg-table td.sg-col-actions > * { margin: 0; }
	.sgp-main .sg-table td.sg-col-actions .sg-btn:not(.sg-btn--icon) { flex: 1 1 auto; min-height: 40px; }
	.sgp-main .sg-table td.sg-col-actions form { flex: 1 1 auto; display: flex; gap: 8px; }
	.sgp-main .sg-table td.sg-col-actions form .sg-btn { flex: 1 1 auto; }
	/* buttons in page headers and toolbars wrap instead of running off the screen */
	.sgp-main .sg-header .sg-toolbar__group, .sgp-main .sg-toolbar { width: 100%; }
	.sgp-main .sg-header .sg-toolbar__group .sg-btn, .sgp-main .sg-toolbar__group > .sg-btn { flex: 1 1 auto; }
	.sgp-main .sg-btn { white-space: normal; text-align: center; line-height: 1.4; }
	/* parcels list: «چاپ گروهی برچسب» and the market filter share one row */
	.sgp-main .sg-toolbar--row { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
	.sgp-main .sg-toolbar--row > .sg-toolbar__group { flex: 1 1 0; min-width: 0; width: auto; flex-wrap: nowrap; }
	.sgp-main .sg-toolbar--row > .sg-toolbar__group:empty { display: none; }
	.sgp-main .sg-toolbar--row .sg-btn { width: 100%; min-height: 40px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
	#salamgate-app .sg-toolbar--row select.sg-input { width: 100% !important; min-height: 40px !important; font-size: 13px; }
	.sgp-main .sg-table td[colspan] { display: block; grid-column: 1 / -1; }
}

@media (max-width: 420px) {
	.sgp-tabbar a span, .sgp-tabbar button span { font-size: 10px; }
}
