/* Mascom admin panel - built on the storefront's Bootstrap 4 and palette (neo_site/assets/css/style.css) */
:root {
	--navy: #252b61;
	--navy-dark: #1b2050;
	--accent: #c008b7;
	--accent-soft: rgba(192, 8, 183, 0.08);
	--bg: #f7f8fb;
	--surface: #ffffff;
	--border: #e6e8ee;
	--text: #1f2233;
	--muted: #6b7080;
	--radius: 14px;
	--sidebar-w: 248px;
	--shadow: 0 1px 3px rgba(60, 64, 67, 0.08), 0 1px 2px rgba(60, 64, 67, 0.04);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.admin {
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 15px;
}
a { color: var(--navy); }
a:hover { color: var(--accent); text-decoration: none; }

/* ---------------------------------------------------------------- Shell */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
	position: fixed; top: 0; bottom: 0; left: 0;
	width: var(--sidebar-w);
	background: var(--navy);
	color: #fff;
	display: flex; flex-direction: column;
	z-index: 1040;
	transition: transform 0.2s ease;
	overflow-y: auto;
}
.admin-brand {
	display: flex; align-items: center; gap: 10px;
	padding: 18px 20px;
	color: #fff; font-weight: 700; letter-spacing: 0.02em;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-brand:hover { color: #fff; }
.admin-brand img { height: 34px; }
.admin-brand span { font-size: 13px; text-transform: uppercase; opacity: 0.75; }

.admin-nav { padding: 10px 0; flex: 1; }
.admin-nav-section {
	padding: 18px 26px 6px;
	font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
	color: rgba(255, 255, 255, 0.45);
}
.admin-nav-link {
	display: flex; align-items: center; gap: 12px;
	margin: 2px 12px; padding: 9px 14px;
	border-radius: 10px;
	color: rgba(255, 255, 255, 0.8);
	font-size: 14.5px;
}
.admin-nav-link .mdi { font-size: 20px; line-height: 1; }
.admin-nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.admin-nav-link.active { background: #fff; color: var(--navy); font-weight: 600; }
.admin-nav-link.active .mdi { color: var(--accent); }
.admin-nav-badge {
	margin-left: auto;
	background: var(--accent); color: #fff;
	border-radius: 999px; padding: 1px 8px;
	font-size: 12px; font-weight: 700;
}
.admin-sidebar-footer { padding: 10px 0 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

.admin-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }

.admin-topbar {
	position: sticky; top: 0; z-index: 1020;
	height: 62px;
	display: flex; align-items: center; gap: 12px;
	padding: 0 24px;
	background: var(--surface);
	border-top: 3px solid var(--accent);
	border-bottom: 1px solid var(--border);
}
.admin-topbar-title { font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-icon-btn {
	border: 0; background: transparent; color: var(--navy);
	width: 40px; height: 40px; border-radius: 10px; font-size: 24px; line-height: 1;
}
.admin-icon-btn:hover { background: var(--bg); }
.admin-user {
	display: flex; align-items: center; gap: 8px;
	border: 1px solid var(--border); background: var(--surface);
	border-radius: 999px; padding: 4px 12px 4px 4px;
	color: var(--text); font-weight: 500;
}
.admin-avatar {
	width: 30px; height: 30px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--navy); color: #fff; font-weight: 700; font-size: 13px;
}

.admin-content { padding: 24px; max-width: 1440px; }

.page-header {
	display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px;
	margin-bottom: 20px;
}
.page-header h1 { font-size: 1.55rem; font-weight: 700; margin: 0; color: var(--navy); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-backdrop { display: none; }

@media (max-width: 991.98px) {
	.admin-sidebar { transform: translateX(-100%); box-shadow: none; }
	.sidebar-open .admin-sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, 0.3); }
	.sidebar-open .admin-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 18, 45, 0.45); z-index: 1030; }
	.admin-main { margin-left: 0; }
	.admin-content { padding: 16px; }
	.admin-topbar { padding: 0 12px; }
}

/* ---------------------------------------------------------------- Cards */
.card {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	background: var(--surface);
}
.card-header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	border-radius: var(--radius) var(--radius) 0 0 !important;
	padding: 14px 20px;
	font-weight: 600;
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-header .mdi { color: var(--accent); margin-right: 6px; }
.card-body { padding: 20px; }
.card + .card { margin-top: 20px; }
.media-grid > .card + .card { margin-top: 0; }

.stat-card { display: flex; flex-direction: row; align-items: center; gap: 16px; padding: 18px 20px; height: 100%; color: var(--text); }
a.stat-card:hover { color: var(--text); box-shadow: 0 4px 14px rgba(37, 43, 97, 0.12); }
.stat-icon {
	flex: none; width: 50px; height: 50px; border-radius: 14px;
	display: flex; align-items: center; justify-content: center; font-size: 26px;
	background: rgba(37, 43, 97, 0.08); color: var(--navy);
}
.stat-icon.accent { background: var(--accent-soft); color: var(--accent); }
.stat-icon.success { background: rgba(13, 160, 60, 0.1); color: #0d8a37; }
.stat-icon.danger { background: rgba(220, 53, 69, 0.1); color: #c82333; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-card-sm { padding: 14px 16px; gap: 12px; }
.stat-card-sm .stat-icon { width: 40px; height: 40px; border-radius: 12px; font-size: 21px; }
.stat-card-sm .stat-value { font-size: 1.3rem; }
.stat-card-sm .stat-value small { font-size: 0.8rem; }
.stat-card-sm .stat-label { font-size: 12.5px; line-height: 1.25; display: block; }
.stat-label { color: var(--muted); font-size: 13.5px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .mdi { font-size: 48px; color: #c5c9d6; display: block; margin-bottom: 8px; }
.empty-state h2 { font-size: 1.2rem; color: var(--text); }

/* ---------------------------------------------------------------- Buttons */
.btn { border-radius: 999px; font-weight: 500; padding: 0.45rem 1.1rem; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 13px; }
.btn .mdi { font-size: 1.1em; line-height: 1; vertical-align: -0.1em; }
.btn-brand { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--navy-dark); border-color: var(--navy-dark); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover, .btn-accent:focus { background: #a0069a; border-color: #a0069a; color: #fff; }
.btn-outline-brand { border: 2px solid var(--navy); color: var(--navy); background: transparent; padding: calc(0.45rem - 1px) 1.1rem; }
.btn-outline-brand:hover { background: var(--navy); color: #fff; }
.btn-light { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-light:hover { background: var(--bg); border-color: #d5d8e0; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn:focus, .btn.focus { box-shadow: 0 0 0 0.2rem rgba(37, 43, 97, 0.2); }

/* ---------------------------------------------------------------- Forms */
label { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.form-control, .custom-select {
	border-radius: 10px; border-color: #d9dce5;
	min-height: 40px;
}
.form-control:focus, .custom-select:focus { border-color: var(--navy); box-shadow: 0 0 0 0.2rem rgba(37, 43, 97, 0.12); }
.form-text { color: var(--muted); font-size: 12.5px; }
.form-control.is-invalid { border-color: #dc3545; }
.required::after { content: " *"; color: var(--accent); }
.custom-control-input:checked ~ .custom-control-label::before { background-color: var(--navy); border-color: var(--navy); }
.custom-control-input:focus ~ .custom-control-label::before { box-shadow: 0 0 0 0.2rem rgba(37, 43, 97, 0.2); }
.custom-control-label { cursor: pointer; }
.input-group-text { border-radius: 10px; background: var(--bg); border-color: #d9dce5; }
.input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input-group-prepend > .input-group-text { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input-group-prepend + .form-control { border-top-left-radius: 0; border-bottom-left-radius: 0; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar .form-control, .filter-bar .custom-select { width: auto; min-width: 160px; }
.filter-bar .search { flex: 1 1 260px; }

.form-actions {
	position: sticky; bottom: 0; z-index: 10;
	display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap;
	margin: 24px -24px -24px; padding: 14px 24px;
	background: rgba(255, 255, 255, 0.96);
	border-top: 1px solid var(--border);
	backdrop-filter: blur(4px);
}
@media (max-width: 991.98px) { .form-actions { margin: 16px -16px -16px; padding: 12px 16px; } }

/* Image upload slots (product form) */
.image-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.image-slot {
	position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
	aspect-ratio: 1 / 1;
	border: 2px dashed #d5d8e0; border-radius: 14px; background: var(--bg);
	color: var(--muted); cursor: pointer; overflow: hidden; text-align: center; font-size: 13px; font-weight: 500;
	margin: 0;
}
.image-slot:hover { border-color: var(--navy); color: var(--navy); }
.image-slot .mdi { font-size: 30px; }
.image-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 8px; }
.image-slot input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.image-slot .slot-tag {
	position: absolute; left: 8px; top: 8px; z-index: 2;
	background: var(--navy); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 8px;
}
.image-slot.has-image .slot-empty { visibility: hidden; }
.image-slot .slot-change {
	position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
	background: rgba(37, 43, 97, 0.85); color: #fff; font-size: 12px; padding: 4px; display: none;
}
.image-slot.has-image:hover .slot-change { display: block; }

/* Rich text editor (nicEdit) */
.editor-wrap { border: 1px solid #d9dce5; border-radius: 10px; overflow: hidden; background: #fff; }
.editor-wrap > div { border-left: 0 !important; border-right: 0 !important; max-width: 100%; }
.editor-wrap > div:first-child { border-top: 0 !important; background: var(--bg) !important; }
.editor-wrap .nicEdit-main { outline: none; min-height: 120px; padding: 4px 6px; margin: 8px !important; }

/* ---------------------------------------------------------------- Tables */
.table-admin { margin: 0; }
.table-admin thead th {
	background: #fafbfd; color: var(--muted);
	font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
	border-top: 0; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-admin td { vertical-align: middle; border-top: 1px solid #f0f1f5; }
.table-admin tbody tr:hover { background: #fbfbfe; }
.table-admin .cell-title { font-weight: 600; color: var(--text); }
.table-admin .cell-sub { font-size: 12.5px; color: var(--muted); }
.table-admin .row-actions { white-space: nowrap; text-align: right; }
.table-admin tr.row-highlight { background: #fff8e6; }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }

.thumb {
	width: 52px; height: 52px; object-fit: contain;
	border-radius: 10px; border: 1px solid var(--border); background: #fff; padding: 3px;
}
.thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: #c5c9d6; font-size: 24px; }

.avail-select { min-width: 150px; font-size: 13px; min-height: 34px; padding-top: 4px; padding-bottom: 4px; }

/* ---------------------------------------------------------------- Badges */
.badge { border-radius: 999px; padding: 0.35em 0.75em; font-weight: 600; font-size: 12px; }
.badge-soft-success { background: rgba(13, 160, 60, 0.12); color: #0b7a31; }
.badge-soft-danger { background: rgba(220, 53, 69, 0.12); color: #b42130; }
.badge-soft-warning { background: rgba(255, 170, 0, 0.16); color: #9a6300; }
.badge-soft-info { background: rgba(37, 43, 97, 0.1); color: var(--navy); }
.badge-soft-muted { background: #eef0f4; color: var(--muted); }

/* ---------------------------------------------------------------- Media grid (adverts, picks) */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.media-card { overflow: hidden; display: flex; flex-direction: column; }
.media-card .media-img { aspect-ratio: 16 / 9; background: #eef0f4; display: flex; align-items: center; justify-content: center; }
.media-card .media-img img { width: 100%; height: 100%; object-fit: cover; }
.media-card.is-hidden .media-img img { opacity: 0.45; filter: grayscale(0.6); }
.media-card .card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.media-name { font-size: 12.5px; color: var(--muted); word-break: break-all; }

.dropzone {
	position: relative;
	border: 2px dashed #cfd3de; border-radius: var(--radius); background: var(--surface);
	padding: 28px; text-align: center; color: var(--muted);
}
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone .mdi { font-size: 40px; color: var(--navy); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------------------------------------------------------------- Order view */
.detail-list { margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 500; font-size: 13px; }
.detail-list dd { margin-bottom: 12px; font-weight: 500; }
.totals td { border: 0; padding: 4px 0; }
.totals tr.grand td { font-size: 1.1rem; font-weight: 700; border-top: 1px solid var(--border); padding-top: 10px; }

/* ---------------------------------------------------------------- Toasts */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.admin-toast {
	min-width: 260px; max-width: 360px;
	background: var(--navy); color: #fff;
	border-radius: 12px; padding: 12px 16px;
	box-shadow: 0 8px 24px rgba(15, 18, 45, 0.25);
	display: flex; gap: 10px; align-items: flex-start;
	animation: toast-in 0.2s ease;
}
.admin-toast.error { background: #b42130; }
.admin-toast .mdi { font-size: 20px; line-height: 1.2; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.admin-flash { border-radius: 12px; border: 0; box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- Login */
.auth-page {
	min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
	background: linear-gradient(135deg, var(--navy) 0%, #3b2d7a 55%, rgba(192, 8, 183, 0.85) 100%);
	font-family: var(--font);
}
.auth-card { width: 100%; max-width: 400px; border-radius: 20px; border: 0; box-shadow: 0 20px 60px rgba(10, 12, 40, 0.35); }
.auth-card .card-body { padding: 32px; }
.auth-logo { height: 42px; margin-bottom: 18px; }
.auth-card h1 { font-size: 1.4rem; font-weight: 700; color: var(--navy); }

/* ---------------------------------------------------------------- News & blog editor (admin/pages/posts.php) */
.post-title-input { font-size: 1.5rem; font-weight: 700; border: 0; padding: 4px 0; min-height: 48px; box-shadow: none !important; }
.post-title-input:focus { border-bottom: 2px solid var(--navy); border-radius: 0; }
.post-title-input.is-invalid { border-bottom: 2px solid #dc3545; border-radius: 0; }
.post-slug .input-group-text { font-size: 12.5px; color: var(--muted); }
.post-slug .form-control { font-size: 13px; min-height: 31px; }
.post-thumb { width: 76px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #eef0f4; }
.cover-slot { aspect-ratio: 16 / 9; }
.cover-slot img { object-fit: cover; padding: 0; }

.note-editor.note-frame { border: 1px solid #d9dce5; border-radius: 10px; overflow: hidden; }
.note-editor .note-toolbar { background: var(--bg); border-bottom: 1px solid var(--border); padding: 6px 8px 2px; }
.note-editor .note-toolbar .note-btn { border-radius: 8px; border-color: #d9dce5; background: #fff; }
.note-editor .note-toolbar .note-btn:hover { background: #eef0f7; }
.note-editor .note-editing-area .note-editable { font-size: 16px; line-height: 1.65; padding: 18px 22px; color: var(--text); }
.note-editor .note-editable img { max-width: 100%; height: auto; }
.note-editor .note-editable iframe, .note-editor .note-editable video { max-width: 100%; }
.note-editor .note-statusbar { background: var(--bg); }
.note-editor.is-invalid { border-color: #dc3545; }
.note-modal .modal-content { border-radius: 14px; }
.note-upload-progress { font-size: 13px; color: var(--muted); padding: 6px 2px 0; }
