/* ==========================================================================
   MAER Backoffice theme
   --------------------------------------------------------------------------
   All visual styling of the BO lives in this one file. The PHP pages only use
   the semantic class names listed below (no inline styles), so to give the BO a
   brand new look, replace this file with a new one that styles the same classes.

   Quick tweaks: change the variables in :root (colors, radius, blur, font...).

   Fonts & icons are self-hosted in css/vendor/ (Poppins + Remix Icon "ri-*").

   CLASS INVENTORY
   Page:        body.page-app (logged in) / body.page-guest (login page)
                .bg-decor > span           decorative background shapes
                body.sidebar-open          set by js/bo.js on mobile when the menu is open
   Layout:      .sidebar .sidebar-brand .sidebar-close .nav-list (li.current) .nav-label
                .nav-badge .sidebar-footer .sidebar-overlay
                .main .topbar .topbar-burger .page-title .topbar-right .lang-switch (a.current)
                .user-chip .user-avatar .user-info .user-name .user-level .content
   Cards:       .card .card-header .card-title .card-subtitle .card-body .card-footer
   Toolbar:     .toolbar .toolbar-left .toolbar-right .search-form
   Buttons:     .btn .btn-primary .btn-light .btn-danger .btn-success .btn-sm .btn-icon
                .actions (group of buttons inside a table cell)
   Tables:      .table-wrap .data-table (tr.row-muted, tr.row-highlight) .text-right .nowrap
                .empty-state .pagination (a.current)
   Badges:      .badge .badge-success .badge-danger .badge-warning .badge-info .badge-muted
   Forms:       .form-grid .form-group .form-group-full .form-label .form-control .form-help
                .input-group .input-unit (unit label at the end of a textbox, eg: %, CNY)
                .input-short (narrow input) .input-stack (inputs stacked, eg: EN + 中文) .form-section .form-section-title (titled group of fields)
                .form-grid-compact (more columns, more space between rows)
                .form-check .form-actions .form-static .radio-group .radio-option
                (.radio-approve .radio-reject) .required
   Alerts:      .alert .alert-success .alert-danger .alert-warning .alert-info .alert-list
   KYC:         .kyc-box .kyc-photos .kyc-photo .kyc-photo-label .kyc-file
   Lightbox:    .lightbox .lightbox-close
   Login:       .login-wrap .login-card .login-brand .login-title .login-footer
   Misc:        .muted .text-small .mono .welcome
   ========================================================================== */

:root {
	--font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;

	--bg: #f3f5fa;
	--surface: rgba(255, 255, 255, 0.72);
	--surface-strong: rgba(255, 255, 255, 0.92);
	--surface-hover: rgba(255, 255, 255, 0.95);
	--border: rgba(255, 255, 255, 0.85);
	--line: rgba(30, 41, 59, 0.07);
	--blur: 18px;

	--text: #2b2f3a;
	--text-muted: #8b91a1;
	--text-faint: #b3b8c5;

	--accent: #f6a33b;
	--accent-strong: #ec8d17;
	--accent-soft: rgba(246, 163, 59, 0.13);
	--success: #22b07d;
	--success-soft: rgba(34, 176, 125, 0.12);
	--danger: #ef4f5f;
	--danger-soft: rgba(239, 79, 95, 0.12);
	--warning: #e9a01a;
	--warning-soft: rgba(246, 163, 59, 0.15);
	--info: #4f8ef7;
	--info-soft: rgba(79, 142, 247, 0.12);
	--muted-soft: rgba(139, 145, 161, 0.14);

	--radius: 14px;
	--radius-sm: 9px;
	--shadow: 0 10px 30px rgba(30, 41, 59, 0.06);
	--shadow-lg: 0 20px 50px rgba(30, 41, 59, 0.12);

	--sidebar-w: 240px;
	--topbar-h: 68px;
	--gap: 24px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	min-height: 100vh;
	font-family: var(--font);
	font-size: 14px;
	line-height: 1.55;
	color: var(--text);
	background:
		radial-gradient(1100px 600px at -10% -10%, #fde7ea 0%, transparent 60%),
		radial-gradient(900px 600px at 110% 0%, #e6efff 0%, transparent 55%),
		radial-gradient(900px 700px at 50% 120%, #dfeaf7 0%, transparent 60%),
		var(--bg);
	background-attachment: fixed;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
[hidden] { display: none !important; }

/* soft diagonal streaks in the background */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-decor span {
	position: absolute;
	width: 46vmax;
	height: 7vmax;
	border-radius: 999px;
	background: linear-gradient(90deg, rgba(247, 168, 178, 0.0), rgba(247, 168, 178, 0.35), rgba(247, 168, 178, 0.0));
	filter: blur(6px);
	transform: rotate(-38deg);
}
.bg-decor span:nth-child(1) { top: -6vmax; left: 8vmax; }
.bg-decor span:nth-child(2) { bottom: 6vmax; right: -12vmax; transform: rotate(-38deg) scale(1.2); }
.bg-decor span:nth-child(3) {
	bottom: -4vmax; left: -10vmax; transform: rotate(38deg);
	background: linear-gradient(90deg, rgba(150, 190, 245, 0), rgba(150, 190, 245, 0.3), rgba(150, 190, 245, 0));
}

/* ---------- sidebar ---------- */
.sidebar {
	position: fixed;
	top: 0; bottom: 0; left: 0;
	z-index: 40;
	width: var(--sidebar-w);
	display: flex;
	flex-direction: column;
	padding: 22px 0 18px;
	background: var(--surface);
	backdrop-filter: blur(var(--blur));
	-webkit-backdrop-filter: blur(var(--blur));
	border-right: 1px solid var(--border);
	box-shadow: var(--shadow);
}
.sidebar-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 26px 26px;
	font-size: 20px;
	font-weight: 600;
	letter-spacing: 0.5px;
}
.sidebar-brand > i { color: var(--accent); font-size: 24px; }
.sidebar-brand small { font-size: 12px; opacity: 0.6; text-transform: uppercase; }
.sidebar-close {
	display: none;
	margin-left: auto;
	border: 0;
	background: none;
	font-size: 22px;
	color: var(--text-muted);
	cursor: pointer;
}
.nav-list { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.nav-list a, .sidebar-footer a {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 26px;
	color: var(--text);
	font-weight: 500;
}
.nav-list a > i, .sidebar-footer a > i { font-size: 18px; color: var(--text-muted); }
.nav-list a:hover { background: var(--accent-soft); color: var(--text); }
.nav-list li.current a { color: var(--accent-strong); background: linear-gradient(90deg, var(--accent-soft), transparent); }
.nav-list li.current a > i { color: var(--accent); }
.nav-list li.current a::before {
	content: "";
	position: absolute;
	left: 0; top: 8px; bottom: 8px;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: var(--accent);
}
.nav-label { flex: 1; }
.nav-badge {
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--danger);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	line-height: 20px;
	text-align: center;
}
.sidebar-footer { padding-top: 10px; border-top: 1px solid var(--line); margin: 0 14px; }
.sidebar-footer a { padding-left: 12px; border-radius: var(--radius-sm); }
.sidebar-footer a:hover { background: var(--danger-soft); color: var(--danger); }
.sidebar-footer a:hover > i { color: var(--danger); }
.sidebar-overlay { display: none; }

/* ---------- main & topbar ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
	position: sticky;
	top: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 14px;
	height: var(--topbar-h);
	padding: 0 var(--gap);
	background: var(--surface);
	backdrop-filter: blur(var(--blur));
	-webkit-backdrop-filter: blur(var(--blur));
	border-bottom: 1px solid var(--border);
}
.topbar-burger {
	display: none;
	width: 40px; height: 40px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--surface-strong);
	font-size: 20px;
	color: var(--text);
	cursor: pointer;
}
.page-title { font-size: 18px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.lang-switch { display: flex; padding: 3px; border-radius: 999px; background: var(--muted-soft); }
.lang-switch a { padding: 3px 11px; border-radius: 999px; font-size: 12px; color: var(--text-muted); }
.lang-switch a.current { background: var(--surface-strong); color: var(--text); box-shadow: var(--shadow); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
	display: grid; place-items: center;
	width: 38px; height: 38px;
	border-radius: 50%;
	background: linear-gradient(135deg, #ffc276, var(--accent-strong));
	color: #fff;
	font-weight: 600;
}
.user-info { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-weight: 500; }
.user-level { font-size: 12px; color: var(--text-muted); }
.content { flex: 1; padding: var(--gap); }

/* ---------- cards ---------- */
.card {
	background: var(--surface);
	backdrop-filter: blur(var(--blur));
	-webkit-backdrop-filter: blur(var(--blur));
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	margin-bottom: var(--gap);
}
.card-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 22px;
	border-bottom: 1px solid var(--line);
}
.card-title { font-size: 16px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.card-body { padding: 22px; }
.card-footer { padding: 16px 22px; border-top: 1px solid var(--line); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search-form { display: flex; gap: 8px; flex-wrap: wrap; }
.search-form .form-control { width: 280px; max-width: 100%; }

/* ---------- buttons ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 18px;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	background: var(--surface-strong);
	color: var(--text);
	font: inherit;
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn > i { font-size: 16px; }
.btn:hover { box-shadow: var(--shadow); }
.btn-primary { background: linear-gradient(135deg, #ffb455, var(--accent-strong)); color: #fff; }
.btn-primary:hover { color: #fff; box-shadow: 0 8px 20px rgba(236, 141, 23, 0.3); }
.btn-light { border-color: var(--line); color: var(--text); }
.btn-light:hover { color: var(--text); background: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; box-shadow: 0 8px 20px rgba(239, 79, 95, 0.3); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-sm > i { font-size: 14px; }
.btn-icon { padding: 5px 8px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.actions { display: inline-flex; flex-wrap: nowrap; gap: 6px; align-items: center; }
.actions form { display: inline; margin: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.data-table th {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--text-muted);
	white-space: nowrap;
	background: rgba(255, 255, 255, 0.35);
}
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr.row-muted td { opacity: 0.55; }
.data-table tr.row-highlight { background: var(--danger-soft); }
.text-right { text-align: right !important; }
.nowrap { white-space: nowrap; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.pagination { display: flex; flex-wrap: wrap; gap: 6px; padding: 16px 22px; }
.pagination a {
	min-width: 34px;
	padding: 5px 10px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	background: var(--surface-strong);
	color: var(--text);
	text-align: center;
}
.pagination a.current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- badges ---------- */
.badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.5;
	white-space: nowrap;
	background: var(--muted-soft);
	color: var(--text-muted);
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--muted-soft); color: var(--text-muted); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-right: 10px; }
.form-group-full { grid-column: 1 / -1; }
.form-label { font-weight: 500; font-size: 13px; }
.required { color: var(--danger); }
.form-control {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--surface-strong);
	color: var(--text);
	font: inherit;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-control[readonly], .form-control[disabled] { background: rgba(255, 255, 255, 0.4); color: var(--text-muted); }
select.form-control { appearance: auto; }
.input-short { width: 100%; max-width: 300px; }
.input-stack { display: flex; flex-direction: column; gap: 8px; }
.form-grid-compact { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 30px 32px; }
.form-grid-compact .form-label { min-height: 1.1em; display: flex; align-items: flex-end; }
.form-section + .form-section { margin-top: 70px; }
.form-section-title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
	font-size: 18px;
	font-weight: 1000;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--accent-strong);
}

.form-section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.input-group { display: flex; align-items: stretch; }
.input-group .form-control { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .form-control:only-child { border-radius: var(--radius-sm); }
.input-unit {
	display: flex;
	align-items: center;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-left: 0;
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	background: var(--muted-soft);
	color: var(--text-muted);
	font-weight: 500;
	white-space: nowrap;
}
.form-help { font-size: 12px; color: var(--text-muted); }
.form-static { padding: 10px 0; font-weight: 500; }
.form-check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; padding: 8px 0; }
.form-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-option {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--surface-strong);
	cursor: pointer;
	font-weight: 500;
}
.radio-option input { width: 16px; height: 16px; margin: 0; }
.radio-approve input { accent-color: var(--success); }
.radio-reject input { accent-color: var(--danger); }
.radio-approve:has(input:checked) { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.radio-reject:has(input:checked) { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

/* ---------- alerts ---------- */
.alert {
	padding: 13px 18px;
	margin-bottom: 18px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	background: var(--info-soft);
	color: var(--info);
	font-weight: 500;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(34, 176, 125, 0.25); }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(239, 79, 95, 0.25); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(246, 163, 59, 0.3); }
.alert-list { margin: 0; padding-left: 18px; }

/* ---------- KYC ---------- */
.kyc-box { padding: 18px; border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.45); }
.kyc-box > * + * { margin-top: 16px; }
.kyc-photos { display: flex; flex-wrap: wrap; gap: 16px; }
.kyc-photo { display: flex; flex-direction: column; gap: 6px; width: 240px; max-width: 100%; }
.kyc-photo img {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	cursor: zoom-in;
	background: #fff;
	transition: transform 0.15s, box-shadow 0.15s;
}
.kyc-photo img:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kyc-photo-label { font-size: 12px; color: var(--text-muted); }
.kyc-file {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
	aspect-ratio: 16 / 10;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	background: #fff;
	font-weight: 500;
}
.kyc-file > i { font-size: 32px; color: var(--danger); }

/* ---------- lightbox ---------- */
.lightbox {
	position: fixed; inset: 0; z-index: 100;
	display: flex; align-items: center; justify-content: center;
	padding: 40px 16px;
	background: rgba(20, 24, 33, 0.75);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); background: #fff; }
.lightbox-close {
	position: absolute; top: 14px; right: 16px;
	width: 42px; height: 42px;
	border: 0; border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	font-size: 22px;
	cursor: pointer;
}

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
	width: 400px;
	max-width: 100%;
	padding: 36px 32px;
	background: var(--surface);
	backdrop-filter: blur(var(--blur));
	-webkit-backdrop-filter: blur(var(--blur));
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) + 4px);
	box-shadow: var(--shadow-lg);
}
.login-card .form-group + .form-group { margin-top: 16px; }
.login-card .btn { width: 100%; margin-top: 24px; padding: 12px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.login-brand > i { color: var(--accent); font-size: 26px; }
.login-title { color: var(--text-muted); margin-bottom: 26px; }
.login-footer { display: flex; justify-content: center; margin-top: 22px; }

/* ---------- misc ---------- */
.muted { color: var(--text-muted); }
.text-small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.welcome { display: flex; align-items: center; gap: 18px; }
.welcome > i { font-size: 40px; color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 991px) {
	.sidebar { transform: translateX(-100%); transition: transform 0.25s ease; background: var(--surface-strong); }
	.sidebar-close { display: block; }
	body.sidebar-open .sidebar { transform: none; }
	body.sidebar-open .sidebar-overlay {
		display: block;
		position: fixed; inset: 0; z-index: 35;
		background: rgba(20, 24, 33, 0.35);
	}
	body.sidebar-open { overflow: hidden; }
	.main { margin-left: 0; }
	.topbar-burger { display: inline-grid; place-items: center; }
}
@media (max-width: 767px) {
	:root { --gap: 16px; --topbar-h: 60px; }
	.topbar { gap: 10px; }
	.page-title { font-size: 16px; }
	.user-info { display: none; }
	.form-grid { grid-template-columns: 1fr; }
	.form-grid-compact .form-label { min-height: 0; }
	.input-short { max-width: none; }
	.card-body { padding: 16px; }
	.card-header { padding: 14px 16px; }
	.search-form { width: 100%; flex-wrap: nowrap; }
	.search-form .form-control { width: auto; flex: 1; min-width: 0; }
}
