/* Parnova manager panel – same layout and components as the user panel, plus styles for the table based editors */

:root {
	--pn-primary: #2456a6;
	--pn-primary-dark: #1b417d;
	--pn-primary-soft: #e8eef9;
	--pn-accent: #2e8b3a;
	--pn-bg: #f4f6fb;
	--pn-border: #e3e7ef;
	--pn-text: #1f2937;
	--pn-muted: #6b7280;
	--pn-sidebar-width: 260px;
	--pn-navbar-height: 64px;

	--bs-primary: var(--pn-primary);
	--bs-primary-rgb: 36, 86, 166;
	--bs-link-color: var(--pn-primary);
	--bs-link-color-rgb: 36, 86, 166;
	--bs-link-hover-color: var(--pn-primary-dark);
	--bs-body-font-family: IRANSans, Tahoma, sans-serif;
	--bs-body-color: var(--pn-text);
	--bs-border-radius: .6rem;
	--bs-border-radius-lg: .9rem;
}

html, body { min-height: 100%; }
body {
	background: var(--pn-bg);
	font-family: var(--bs-body-font-family);
	font-size: .95rem;
	-webkit-text-size-adjust: 100%;
}

/* Bootstrap components in brand color */
.btn-primary {
	--bs-btn-bg: var(--pn-primary);
	--bs-btn-border-color: var(--pn-primary);
	--bs-btn-hover-bg: var(--pn-primary-dark);
	--bs-btn-hover-border-color: var(--pn-primary-dark);
	--bs-btn-active-bg: var(--pn-primary-dark);
	--bs-btn-active-border-color: var(--pn-primary-dark);
	--bs-btn-disabled-bg: var(--pn-primary);
	--bs-btn-disabled-border-color: var(--pn-primary);
}
.btn-outline-primary {
	--bs-btn-color: var(--pn-primary);
	--bs-btn-border-color: var(--pn-primary);
	--bs-btn-hover-bg: var(--pn-primary);
	--bs-btn-hover-border-color: var(--pn-primary);
	--bs-btn-active-bg: var(--pn-primary);
	--bs-btn-active-border-color: var(--pn-primary);
}
.btn { font-weight: 500; }
.form-control, .form-select { padding-top: .55rem; padding-bottom: .55rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
	border-color: #8aa6d6;
	box-shadow: 0 0 0 .2rem rgba(36, 86, 166, .15);
}
.form-check-input:checked { background-color: var(--pn-primary); border-color: var(--pn-primary); }
.form-control::placeholder { color: #b3bac6; opacity: 1; }
.ltr { direction: ltr; text-align: left; }
input.ltr::placeholder { text-align: left; }

/* ---------- top navbar ---------- */
.pn-navbar {
	height: var(--pn-navbar-height);
	background: #fff;
	border-bottom: 1px solid var(--pn-border);
	position: sticky;
	top: 0;
	z-index: 1030;
}
.pn-brand img { height: 38px; width: auto; }
.pn-brand span { color: var(--pn-muted); font-size: .85rem; border-inline-start: 1px solid var(--pn-border); padding-inline-start: .75rem; }
.pn-cart-link { position: relative; }
.pn-cart-link .badge { position: absolute; top: -4px; inset-inline-end: -6px; font-size: .65rem; }

/* ---------- sidebar ---------- */
.pn-sidebar { width: var(--pn-sidebar-width); }
@media (min-width: 992px) {
	.pn-sidebar {
		position: fixed;
		top: var(--pn-navbar-height);
		bottom: 0;
		right: 0;
		background: #fff;
		border-inline-end: 1px solid var(--pn-border);
		overflow-y: auto;
	}
	.pn-main { margin-right: var(--pn-sidebar-width); }
}
.pn-menu-title {
	font-size: .75rem;
	color: var(--pn-muted);
	margin: 1.25rem 1rem .4rem;
	font-weight: 500;
}
.pn-menu .nav-link {
	color: var(--pn-text);
	border-radius: .5rem;
	margin: 2px .5rem;
	padding: .6rem .75rem;
	display: flex;
	align-items: center;
	gap: .65rem;
}
.pn-menu .nav-link i { font-size: 1.1rem; color: var(--pn-muted); }
.pn-menu .nav-link:hover { background: var(--pn-bg); }
.pn-menu .nav-link.active { background: var(--pn-primary-soft); color: var(--pn-primary); font-weight: 500; }
.pn-menu .nav-link.active i { color: var(--pn-primary); }

/* ---------- content ---------- */
.pn-main { min-height: calc(100vh - var(--pn-navbar-height)); display: flex; flex-direction: column; }
.pn-content { flex: 1; padding: 1.5rem; max-width: 1200px; width: 100%; }
@media (max-width: 575.98px) { .pn-content { padding: 1rem .75rem; } }
.pn-page-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; display: flex; align-items: center; gap: .5rem; }
.pn-page-title i { color: var(--pn-primary); }
.pn-footer { color: var(--pn-muted); font-size: .8rem; padding: 1rem 1.5rem; text-align: center; }

.card { border-color: var(--pn-border); border-radius: var(--bs-border-radius-lg); }
.card-header { background: #fff; border-bottom-color: var(--pn-border); font-weight: 500; padding: .9rem 1.25rem; }
.card-header:first-child { border-radius: var(--bs-border-radius-lg) var(--bs-border-radius-lg) 0 0; }
.pn-card-shadow { box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }

.pn-empty { text-align: center; color: var(--pn-muted); padding: 3rem 1rem; }
.pn-empty i { font-size: 2.5rem; display: block; margin-bottom: .75rem; color: #c3cad6; }

/* dashboard tiles */
.pn-tile { display: flex; flex-direction: row; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; color: inherit; text-decoration: none; height: 100%; transition: box-shadow .15s, transform .15s; }
.pn-tile:hover { box-shadow: 0 6px 18px rgba(36, 86, 166, .12); transform: translateY(-1px); color: inherit; }
.pn-tile-icon { width: 48px; height: 48px; border-radius: .75rem; display: grid; place-items: center; font-size: 1.4rem; flex-shrink: 0; background: var(--pn-primary-soft); color: var(--pn-primary); }
.pn-tile-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.pn-tile-label { color: var(--pn-muted); font-size: .85rem; }

/* store */
.pn-product img { width: 100%; height: 200px; object-fit: contain; background: #fff; border-radius: var(--bs-border-radius-lg) var(--bs-border-radius-lg) 0 0; padding: .75rem; }
.pn-product .card-title { font-size: .95rem; font-weight: 500; min-height: 2.8em; }
.pn-price { font-weight: 700; color: var(--pn-text); }
.pn-price small { font-weight: 400; color: var(--pn-muted); }

/* cart */
.pn-cart-item { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--pn-border); }
.pn-cart-item:last-child { border-bottom: 0; }
.pn-cart-item-name { flex: 1 1 220px; font-weight: 500; }
.pn-qty { display: inline-flex; align-items: center; border: 1px solid var(--pn-border); border-radius: .6rem; overflow: hidden; }
.pn-qty button { border: 0; background: #fff; padding: .35rem .6rem; color: var(--pn-text); min-width: 38px; }
.pn-qty button:hover { background: var(--pn-bg); }
.pn-qty button:disabled { color: #c3cad6; }
.pn-qty .pn-qty-value { min-width: 44px; text-align: center; font-weight: 700; }
.pn-cart-item-total { min-width: 120px; text-align: left; font-weight: 700; }
.pn-summary dl { display: grid; grid-template-columns: 1fr auto; gap: .6rem 1rem; margin: 0; }
.pn-summary dt { font-weight: 400; color: var(--pn-muted); }
.pn-summary dd { margin: 0; text-align: left; }
.pn-summary .pn-summary-final { font-size: 1.1rem; font-weight: 700; color: var(--pn-text); }

/* key/value lists (receipt, profile) */
.pn-kv { display: grid; grid-template-columns: minmax(120px, 35%) 1fr; margin: 0; }
.pn-kv dt, .pn-kv dd { padding: .65rem 1.25rem; margin: 0; border-bottom: 1px solid var(--pn-border); }
.pn-kv dt { color: var(--pn-muted); font-weight: 400; }
.pn-kv dt:last-of-type, .pn-kv dd:last-of-type { border-bottom: 0; }

/* stacked tables on small screens: each row becomes a card */
@media (max-width: 767.98px) {
	.pn-table-stack thead { display: none; }
	.pn-table-stack, .pn-table-stack tbody, .pn-table-stack tr, .pn-table-stack td { display: block; width: 100%; }
	.pn-table-stack tr { border-bottom: 1px solid var(--pn-border); padding: .5rem 0; }
	.pn-table-stack td { border: 0; padding: .3rem 1rem; display: flex; justify-content: space-between; gap: 1rem; text-align: left; }
	.pn-table-stack td::before { content: attr(data-label); color: var(--pn-muted); text-align: right; flex-shrink: 0; }
	.pn-table-stack td[data-label=""]::before { content: none; }
	.pn-table-stack td.pn-td-actions { justify-content: flex-start; }
}

/* test pages */
/* scroll target sits below the sticky navbar and the sticky progress bar */
.pn-question { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--pn-border); scroll-margin-top: calc(var(--pn-navbar-height) + 4.5rem); }
.pn-question:last-child { border-bottom: 0; }
.pn-question.is-answered .pn-question-no { background: var(--pn-accent); color: #fff; }
.pn-question-no { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 50%; background: var(--pn-primary-soft); color: var(--pn-primary); font-weight: 700; font-size: .85rem; margin-inline-end: .5rem; }
.pn-question-text { font-weight: 500; line-height: 1.9; }
.pn-options { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.pn-options .btn { flex: 1 1 auto; min-width: 90px; }
.pn-options-vertical { flex-direction: column; }
.pn-options-vertical .btn { text-align: right; }
.btn-check:checked + .btn-outline-primary { background: var(--pn-primary); color: #fff; }
.pn-test-progress { position: sticky; top: var(--pn-navbar-height); z-index: 10; background: var(--pn-bg); padding: .5rem 0; }
.pn-test-actions { position: sticky; bottom: 0; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--pn-border); padding: .75rem 1rem; z-index: 10; backdrop-filter: blur(4px); }

/* auth pages (login / register) */
.pn-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem .75rem; background: linear-gradient(160deg, #eaf0fa 0%, var(--pn-bg) 55%); }
.pn-auth-card { width: 100%; max-width: 420px; }
.pn-auth-card.pn-auth-wide { max-width: 760px; }
.pn-auth-logo { height: 56px; width: auto; }
.pn-auth .card { box-shadow: 0 10px 30px rgba(36, 86, 166, .08); }

.input-group .btn-toggle-password { border-color: var(--bs-border-color); background: #fff; color: var(--pn-muted); }

@media print {
	.pn-navbar, .pn-sidebar, .pn-footer, .pn-test-actions, .btn { display: none !important; }
	.pn-main { margin: 0 !important; }
	body { background: #fff; }
}

/* ---------- table based editors (tests.php, center.php) ---------- */
.pn-legacy .card-body { overflow-x: auto; }
.pn-legacy .text { font-size: .9rem; }
.pn-legacy table.reference, .pn-legacy table.reference3 { border-collapse: collapse; background: #fff; margin: 0 auto 1rem; max-width: none; }
.pn-legacy table.reference th, .pn-legacy table.reference3 th { background: var(--pn-primary-soft); color: var(--pn-text); font-weight: 500; padding: .55rem .6rem; border: 1px solid var(--pn-border); text-align: center; white-space: nowrap; }
.pn-legacy table.reference td, .pn-legacy table.reference3 td { padding: .4rem .6rem; border: 1px solid var(--pn-border); vertical-align: middle; }
.pn-legacy table.reference tr:hover td { background: #f8fafd; }
.pn-legacy input[type="text"], .pn-legacy input[type="input"], .pn-legacy input[type="number"], .pn-legacy select, .pn-legacy textarea {
	border: 1px solid var(--bs-border-color); border-radius: .45rem; padding: .3rem .5rem; font: inherit; font-size: .9rem; background: #fff; max-width: 100%;
}
.pn-legacy input[type="text"]:focus, .pn-legacy input[type="input"]:focus, .pn-legacy select:focus, .pn-legacy textarea:focus { outline: 0; border-color: #8aa6d6; box-shadow: 0 0 0 .2rem rgba(36, 86, 166, .15); }
.pn-legacy input[type="submit"], .pn-legacy button[type="submit"] {
	border: 1px solid var(--pn-primary); background: var(--pn-primary); color: #fff; border-radius: .45rem; padding: .3rem .8rem; font: inherit; font-size: .85rem; min-width: 70px; width: auto !important; cursor: pointer;
}
.pn-legacy input[type="submit"]:hover { background: var(--pn-primary-dark); }
.pn-legacy input[type="submit"]:disabled { opacity: .5; cursor: default; }
.pn-legacy input[type="submit"][value="حذف"] { background: #fff; color: #dc3545; border-color: #dc3545; }
.pn-legacy input[type="submit"][value*="بازگشت"], .pn-legacy input[type="submit"][value="انصراف"] { background: #fff; color: var(--pn-text); border-color: var(--bs-border-color); }
.pn-legacy input[type="radio"], .pn-legacy input[type="checkbox"] { margin-inline-end: .25rem; }
.pn-legacy input[name^="struct_name"], .pn-legacy input[name^="dimens_name"] { min-width: 14rem; }
.pn-legacy table[width="50%"] { width: auto; min-width: min(100%, 560px); margin-right: 0 !important; margin-left: auto !important; }

/* ---------- separate scrolling of the menu and the content (desktop) ----------
   the content scrolls by itself, so its scroll bar is at its own (left) edge; the menu's scroll bar is moved to the
   right edge of the screen */
@media screen and (min-width: 992px) {
	html:has(.pn-main), html:has(.pn-main) body { height: 100%; overflow: hidden; }
	.pn-main { height: calc(100vh - var(--pn-navbar-height)); min-height: 0; overflow-y: auto; }
	.pn-sidebar { direction: ltr; }
	.pn-sidebar > * { direction: rtl; }
	.pn-test-progress { top: 0; }
	.pn-question { scroll-margin-top: 4.5rem; }
}

/* page title in the top bar: "panel / title" */
.pn-crumb { display: flex; align-items: center; gap: .5rem; min-width: 0; color: var(--pn-text); }
.pn-crumb-sep { color: #c3cad6; font-size: 1.1rem; }
.pn-crumb i { color: var(--pn-primary); font-size: 1.1rem; }
.pn-crumb h1 { font-size: 1rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* desktop: the logo is above the menu and the page title starts in line with the content */
@media (min-width: 992px) {
	.pn-navbar:has(.pn-crumb) .pn-brand { width: calc(var(--pn-sidebar-width) - 1rem); flex-shrink: 0; margin-inline-end: 0; }
	.pn-navbar .pn-crumb { padding-inline-start: 1rem; }
	.pn-navbar .pn-crumb-sep { display: none; }
}
.pn-content:has(.pn-content-wide) { max-width: none; }

/* search forms of the lists */
.pn-search { background: var(--pn-bg); border: 1px solid var(--pn-border); border-radius: var(--bs-border-radius-lg); padding: .65rem 1rem .8rem; margin: 0 0 .75rem; text-align: right; }
.pn-search .form-label { font-size: .8rem; color: var(--pn-muted); margin-bottom: .15rem; }
.pn-search .form-control-sm, .pn-search .form-select-sm { padding-top: .35rem; padding-bottom: .35rem; font-size: .85rem; }
.pn-search .input-group-sm .btn { padding-top: .2rem; padding-bottom: .2rem; }
.pn-content:has(.pn-search) .table th { white-space: nowrap; }

/* page links and rows per page */
.pn-pagination .page-link { min-width: 2.2rem; text-align: center; color: var(--pn-primary); }
.pn-pagination .page-item.active .page-link { background: var(--pn-primary); border-color: var(--pn-primary); color: #fff; }
.pn-pagination .page-item.disabled .page-link { color: #b3bac6; }
.pn-pagination .form-select-sm { padding-top: .2rem; padding-bottom: .2rem; font-size: .85rem; min-width: 4.5rem; }

/* Jalali date picker (data-jdate) */
.pn-jdate { position: fixed; z-index: 2000; width: 272px; background: #fff; border: 1px solid var(--pn-border); border-radius: .8rem; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: .6rem; direction: rtl; font-size: .85rem; user-select: none; }
.pn-jdate-head { display: flex; align-items: center; gap: .15rem; margin-bottom: .4rem; }
.pn-jdate-title { flex: 1; text-align: center; font-weight: 700; color: var(--pn-text); }
.pn-jdate-nav { border: 0; background: transparent; color: var(--pn-muted); width: 28px; height: 28px; border-radius: .45rem; display: grid; place-items: center; padding: 0; }
.pn-jdate-nav:hover { background: var(--pn-primary-soft); color: var(--pn-primary); }
.pn-jdate-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.pn-jdate-dayname { text-align: center; font-size: .75rem; color: var(--pn-muted); padding: .2rem 0 .35rem; }
.pn-jdate-day { border: 0; background: transparent; height: 32px; border-radius: .45rem; color: var(--pn-text); padding: 0; }
.pn-jdate-day:hover { background: var(--pn-primary-soft); color: var(--pn-primary); }
.pn-jdate .is-friday { color: #dc3545; }
.pn-jdate-day.is-today { box-shadow: inset 0 0 0 1px var(--pn-primary); font-weight: 700; }
.pn-jdate-day.is-selected, .pn-jdate-day.is-selected:hover { background: var(--pn-primary); color: #fff; font-weight: 700; }
.pn-jdate-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--pn-border); margin-top: .45rem; padding-top: .45rem; }

/* ---------- table based editors (tests.php, center.php): the whole width, tables in the middle ---------- */
.pn-content:has(.pn-legacy) { max-width: none; }
/* lists: as wide as the page, compact rows, short values on one line */
.pn-legacy table.pn-list { width: 100%; font-size: .85rem; }
.pn-legacy table.pn-list th, .pn-legacy table.pn-list td { width: auto !important; padding: .4rem .45rem; }
.pn-legacy table.pn-list td { white-space: nowrap; }
.pn-legacy table.pn-list td.pn-wrap { white-space: normal; min-width: 11rem; max-width: 18rem; }
.pn-legacy table.pn-list td form { margin: 0; }
.pn-legacy table.pn-list td input[type="submit"], .pn-legacy table.pn-list td button { padding: .2rem .6rem; min-width: 0; }
.pn-legacy .card-body:has(table.pn-list) { padding-left: .75rem; padding-right: .75rem; }
.pn-legacy table.reference, .pn-legacy table.reference3, .pn-legacy table[width] { margin-left: auto !important; margin-right: auto !important; }
.pn-content:has(.pn-legacy) { padding-bottom: .75rem; }
.pn-main:has(.pn-legacy) .pn-footer { padding-top: .25rem; padding-bottom: .75rem; }

/* every page starts next to the menu (no centred column of at most 1200px); small forms keep their own width, on the right */
.pn-content { max-width: none; }
