/* ===================================================
   manager.css – Layout & components cho trang manager
   Dùng chung cho: login.php, index.php, edit.php, accounts.php
   Phụ thuộc: kq-vars.css, kq-typography.css, kq-brand.css
   =================================================== */

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

/* ── Topbar ── */
.mgr-topbar {
	background: #fff;
	border-bottom: 1px solid #e5e7eb;
	padding: 12px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 14px;
}
.mgr-topbar .mgr-brand {
	font-family: Barlow, sans-serif;
	font-weight: 700;
	color: var(--primary-color);
	font-size: 16px;
	text-decoration: none;
}
.mgr-topbar .mgr-nav {
	display: flex;
	gap: 18px;
	align-items: center;
	flex-wrap: wrap;
}
.mgr-topbar .mgr-nav a {
	font-weight: 600;
	text-decoration: none;
}
.mgr-topbar .mgr-hi {
	color: #555;
	font-weight: normal;
}

/* ── Page wrap & Card ── */
.mgr-wrap {
	max-width: 1080px;
	margin: 24px auto;
	padding: 0 16px;
}
.mgr-card {
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
	padding: 24px 28px;
}
.mgr-card-sm {
	max-width: 540px;
	margin-left: auto;
	margin-right: auto;
}

/* ── Page header ── */
.mgr-page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
	gap: 12px;
	flex-wrap: wrap;
}
.mgr-page-header h1 {
	color: var(--primary-color);
	font-size: 22px;
	margin: 0;
}
.mgr-page-header .mgr-sub {
	font-size: 13px;
	color: #888;
	font-weight: normal;
	margin-left: 8px;
}

/* ── Search bar ── */
.mgr-search-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: 18px;
}
.mgr-search-bar .mgr-input {
	flex: 1 1 180px;
	min-width: 160px;
}

/* ── Input ── */
.mgr-input {
	padding: 9px 12px;
	border: 1.5px solid #d0d0d0;
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	background: #fff;
	color: #333;
	transition: border-color 0.2s, box-shadow 0.2s;
	width: 100%;
}
.mgr-input:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 3px rgba(45, 110, 54, 0.12);
}
.mgr-input[type="date"] {
	-webkit-appearance: textfield;
	-moz-appearance: textfield;
}

/* ── Form field ── */
.mgr-form-field {
	margin-bottom: 14px;
}
.mgr-form-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 6px;
	color: #444;
}

/* ── Table ── */
.mgr-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}
.mgr-table thead th {
	background: var(--primary-color);
	color: #fff;
	padding: 10px 14px;
	text-align: left;
	font-weight: 600;
	font-family: Barlow, sans-serif;
	white-space: nowrap;
}
.mgr-table tbody td {
	padding: 10px 14px;
	border-bottom: 1px solid #ececec;
	vertical-align: middle;
}
.mgr-table tbody tr:nth-child(even) { background: #f9f9f9; }
.mgr-table tbody tr:hover           { background: #f0f7f1; }

.mgr-table .col-num    { width: 52px;  text-align: center; color: #888; }
.mgr-table .col-action { width: 140px; text-align: center; }
.mgr-table .col-pass   { color: #ccc;  letter-spacing: 3px; }

.mgr-table .mgr-row-action {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	justify-content: center;
}
.mgr-table a.mgr-link {
	color: var(--primary-color);
	font-weight: 600;
	text-decoration: none;
}
.mgr-table a.mgr-link:hover { text-decoration: underline; }

/* ── Buttons (bổ sung cho kq-brand.css) ── */
.btn-danger,
input[type="button"].btn-danger {
	background: #e53935;
	color: #fff;
	border: none;
	padding: 7px 16px;
	border-radius: 6px;
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.85; }

.btn-ghost,
input[type="reset"].btn-ghost,
input[type="button"].btn-ghost {
	background: #fff;
	color: #444;
	border: 1.5px solid #ccc;
	padding: 7px 16px;
	border-radius: 6px;
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s;
}
.btn-ghost:hover { background: #f5f5f5; }

.btn-sm {
	padding: 5px 12px;
	font-size: 12px;
	border-radius: 4px;
}

/* Ghi đè nhẹ cho nút Flatsome trong manager (giữ nguyên màu brand từ kq-brand.css) */
.mgr-wrap .button,
.mgr-topbar .button,
.mgr-modal .button,
.mgr-login-card .button {
	border-radius: 6px;
	padding: 8px 20px;
	margin: 0;
	font-size: 14px;
	line-height: 1.2;
}

/* kq-brand.css chỉ set background cho nút primary/submit, không set color
   → ép text trắng để đảm bảo contrast trên nền xanh brand (#2d6e36) */
.mgr-wrap .button.primary,
.mgr-topbar .button.primary,
.mgr-modal .button.primary,
.mgr-login-card .button.primary,
.mgr-wrap button[type="submit"],
.mgr-modal button[type="submit"],
.mgr-login-card button[type="submit"] {
	color: #fff;
}
.mgr-wrap .button.primary:hover,
.mgr-modal .button.primary:hover,
.mgr-login-card .button.primary:hover {
	color: #fff;
	opacity: 0.92;
}

/* ── Flash messages ── */
.mgr-flash {
	padding: 11px 16px;
	border-radius: 6px;
	margin-bottom: 16px;
	font-size: 14px;
}
.mgr-flash.success {
	background: #e8f5e9;
	color: var(--primary-color);
	border: 1px solid #a5d6a7;
}
.mgr-flash.error {
	background: #fdecea;
	color: #c62828;
	border: 1px solid #ef9a9a;
}

/* ── Tag (protected row) ── */
.mgr-tag {
	font-size: 12px;
	color: #9aa0a6;
	font-style: italic;
}

/* ── Pagination (tương thích với classes do perpage.php sinh ra) ── */
.mgr-pagination {
	display: inline-flex;
	gap: 6px;
	flex-wrap: wrap;
	align-items: center;
	padding: 4px 0;
}
.mgr-pagination .perpage-link,
.mgr-pagination .current-page,
.mgr-page-btn {
	padding: 5px 11px;
	border: 1.5px solid #d2d6dd;
	border-radius: 4px;
	background: #fff;
	font-size: 13px;
	cursor: pointer;
	font-family: inherit;
	color: #333;
	min-width: 32px;
	text-align: center;
}
.mgr-pagination .perpage-link:hover,
.mgr-page-btn:hover {
	background: #f5f5f5;
	border-color: var(--primary-color);
}
.mgr-pagination .current-page,
.mgr-page-btn.active {
	background: var(--primary-color);
	color: #fff;
	border-color: var(--primary-color);
	font-weight: 600;
	cursor: default;
}

/* ── Password wrapper (modal accounts) ── */
.mgr-pw-wrap { position: relative; }
.mgr-pw-wrap .mgr-input { padding-right: 40px; }
.mgr-pw-toggle {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	font-size: 15px;
	color: #999;
	padding: 0;
	line-height: 1;
}

/* ── Modal ── */
.mgr-modal {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 1000;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.mgr-modal.open { display: flex; }

.mgr-modal-box {
	background: #fff;
	border-radius: 10px;
	padding: 24px 28px;
	width: 100%;
	max-width: 420px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
.mgr-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
}
.mgr-modal-header h2 {
	margin: 0;
	font-size: 18px;
	color: var(--primary-color);
}
.mgr-modal-close {
	background: none;
	border: none;
	font-size: 22px;
	cursor: pointer;
	color: #888;
	line-height: 1;
	padding: 0;
}
.mgr-modal-footer {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 20px;
}

/* ── Login page ── */
.mgr-login-wrap {
	min-height: calc(100vh - 60px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
}
.mgr-login-card {
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	padding: 32px 32px 28px;
	width: 100%;
	max-width: 380px;
	text-align: center;
}
.mgr-login-card .mgr-avatar {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	object-fit: cover;
	margin-bottom: 12px;
	border: 3px solid #f0f2f5;
}
.mgr-login-card h2 {
	color: var(--primary-color);
	margin: 0 0 4px;
	font-size: 22px;
}
.mgr-login-card .mgr-subtitle {
	font-size: 13px;
	color: #888;
	margin-bottom: 20px;
}
.mgr-login-card form { text-align: left; }
.mgr-login-card .mgr-remember {
	font-size: 13px;
	color: #555;
	margin: 6px 0 16px;
	display: flex;
	align-items: center;
	gap: 6px;
}
.mgr-login-card .mgr-remember input { margin: 0; }

/* Nút login full-width */
.mgr-login-card button[type="submit"] {
	width: 100%;
	padding: 11px 16px;
	font-size: 15px;
}

/* ── Edit back link ── */
.mgr-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
	text-decoration: none;
	margin-bottom: 16px;
}
.mgr-back:hover { text-decoration: underline; }

/* ── Standalone page title (ngoài .mgr-page-header) ── */
.mgr-title {
	color: var(--primary-color);
	font-size: 22px;
	margin: 0 0 18px;
}

/* ── Form actions row ── */
.mgr-form-actions {
	display: flex;
	gap: 10px;
	margin-top: 20px;
}
.mgr-form-actions .button.primary { flex: 1; }

/* ── Utility ── */
.mgr-empty {
	text-align: center;
	padding: 24px;
	color: #aaa;
}

/* ── Pagination cell trong tfoot ── */
.mgr-pagination-cell {
	text-align: right;
	padding-top: 14px !important;
	border-bottom: none !important;
}

/* ── Nút-link (<a> render như button) ── */
.mgr-btn-link {
	display: inline-block;
	text-decoration: none;
}
.mgr-btn-link:hover { text-decoration: none; }

/* ── Responsive ── */
@media (max-width: 640px) {
	.mgr-topbar {
		padding: 10px 14px;
	}
	.mgr-topbar .mgr-nav {
		gap: 12px;
	}
	.mgr-card {
		padding: 18px 16px;
	}
	.mgr-table thead th,
	.mgr-table tbody td {
		padding: 8px 10px;
		font-size: 13px;
	}
	.mgr-table {
		display: block;
		overflow-x: auto;
	}
}
