/* =========================================================
   WP CRM Pro – Frontend Dashboard
   Layout kiểu Hotel PMS Lite (sidebar + topbar)
   ========================================================= */

:root {
	--wpcrm-sidebar: #0f172a;
	--wpcrm-sidebar-hover: #1e293b;
	--wpcrm-accent: #2563eb;
	--wpcrm-accent-2: #3b82f6;
	--wpcrm-bg: #f1f5f9;
	--wpcrm-card: #ffffff;
	--wpcrm-text: #0f172a;
	--wpcrm-muted: #64748b;
	--wpcrm-border: #e2e8f0;
	--wpcrm-radius: 12px;
	--wpcrm-sidebar-w: 260px;
	--wpcrm-success: #059669;
	--wpcrm-alert: #dc2626;
	--wpcrm-warning: #d97706;
	--wpcrm-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
	--wpcrm-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
	--wpcrm-font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body.wpcrm-frontend-page {
	margin: 0 !important;
	padding: 0 !important;
	background: var(--wpcrm-bg) !important;
	font-family: var(--wpcrm-font) !important;
	color: var(--wpcrm-text);
	width: 100% !important;
	max-width: 100% !important;
	overflow-x: hidden;
}

body.wpcrm-frontend-page #wpadminbar { display: none !important; }
body.wpcrm-frontend-page { margin-top: 0 !important; }

.wpcrm-fe {
	display: flex;
	min-height: 100vh;
	width: 100%;
	font-family: var(--wpcrm-font);
	background: var(--wpcrm-bg);
	color: var(--wpcrm-text);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

/* ===== Sidebar ===== */
.wpcrm-fe-sidebar {
	width: var(--wpcrm-sidebar-w);
	background: var(--wpcrm-sidebar);
	color: #e2e8f0;
	display: flex;
	flex-direction: column;
	position: fixed;
	top: 0; left: 0; bottom: 0;
	z-index: 100;
	transition: transform 0.25s ease;
}

.wpcrm-fe-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 22px 20px;
	border-bottom: 1px solid rgba(255,255,255,0.08);
}

.wpcrm-fe-logo {
	width: 42px; height: 42px;
	background: linear-gradient(135deg, #2563eb, #7c3aed);
	border-radius: 10px;
	display: flex; align-items: center; justify-content: center;
	font-size: 18px; color: #fff;
	flex-shrink: 0;
}

.wpcrm-fe-brand strong {
	display: block;
	font-size: 15px;
	color: #fff;
}

.wpcrm-fe-brand span {
	font-size: 11px;
	color: #94a3b8;
}

.wpcrm-fe-nav {
	flex: 1;
	padding: 16px 12px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wpcrm-fe-nav-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 14px;
	border-radius: 8px;
	color: #94a3b8;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	background: transparent;
	border: none;
	cursor: pointer;
	width: 100%;
	text-align: left;
	transition: all 0.15s;
	font-family: inherit;
}

.wpcrm-fe-nav-item i {
	width: 20px;
	text-align: center;
	font-size: 15px;
}

.wpcrm-fe-nav-item:hover {
	background: var(--wpcrm-sidebar-hover);
	color: #fff;
}

.wpcrm-fe-nav-item.is-active {
	background: var(--wpcrm-accent);
	color: #fff;
}

.wpcrm-fe-sidebar-foot {
	padding: 12px;
	border-top: 1px solid rgba(255,255,255,0.08);
}

/* ===== Body / Topbar ===== */
.wpcrm-fe-body {
	flex: 1;
	margin-left: var(--wpcrm-sidebar-w);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	width: calc(100% - var(--wpcrm-sidebar-w));
}

.wpcrm-fe-topbar {
	background: #fff;
	border-bottom: 1px solid var(--wpcrm-border);
	padding: 14px 28px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: sticky;
	top: 0;
	z-index: 50;
	gap: 16px;
	flex-wrap: wrap;
}

.wpcrm-fe-topbar-left {
	display: flex;
	align-items: center;
	gap: 14px;
}

.wpcrm-fe-page-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	color: var(--wpcrm-text);
}

.wpcrm-fe-sidebar-toggle {
	display: none;
	background: none;
	border: 1px solid var(--wpcrm-border);
	border-radius: 8px;
	width: 38px; height: 38px;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	color: var(--wpcrm-text);
}

.wpcrm-fe-topbar-right {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.wpcrm-fe-topbar-date {
	font-size: 13px;
	color: var(--wpcrm-muted);
	display: flex;
	align-items: center;
	gap: 6px;
}

.wpcrm-fe-user-chip {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #f8fafc;
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 500;
	color: var(--wpcrm-text);
}

/* ===== Main content ===== */
.wpcrm-fe-main {
	padding: 24px 28px 40px;
	flex: 1;
}

.wpcrm-fe-view { display: none; }
.wpcrm-fe-view.is-active { display: block; }

.wpcrm-fe-welcome {
	margin-bottom: 24px;
}
.wpcrm-fe-welcome h1 {
	margin: 0 0 6px;
	font-size: 24px;
	font-weight: 700;
}
.wpcrm-fe-welcome p {
	margin: 0;
	color: var(--wpcrm-muted);
	font-size: 14px;
}
.wpcrm-fe-welcome-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

/* ===== Buttons ===== */
.wpcrm-fe-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 16px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	border: none;
	cursor: pointer;
	text-decoration: none;
	font-family: inherit;
	transition: all 0.15s;
	line-height: 1.3;
}
.wpcrm-fe-btn-primary {
	background: var(--wpcrm-accent);
	color: #fff;
}
.wpcrm-fe-btn-primary:hover { background: #1d4ed8; color: #fff; }
.wpcrm-fe-btn-ghost {
	background: transparent;
	color: var(--wpcrm-muted);
	border: 1px solid var(--wpcrm-border);
}
.wpcrm-fe-btn-ghost:hover { background: #f8fafc; color: var(--wpcrm-text); }
.wpcrm-fe-btn.is-loading { opacity: 0.7; pointer-events: none; }

.wpcrm-fe-link {
	background: none;
	border: none;
	color: var(--wpcrm-accent);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
	font-family: inherit;
}
.wpcrm-fe-link:hover { text-decoration: underline; }

/* ===== Stats ===== */
.wpcrm-fe-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.wpcrm-fe-stat-card {
	background: var(--wpcrm-card);
	border-radius: var(--wpcrm-radius);
	padding: 18px;
	display: flex;
	align-items: center;
	gap: 14px;
	border: 1px solid var(--wpcrm-border);
	box-shadow: var(--wpcrm-shadow);
}
.wpcrm-fe-stat-icon {
	width: 48px; height: 48px;
	border-radius: 12px;
	display: flex; align-items: center; justify-content: center;
	background: #eff6ff;
	color: var(--wpcrm-accent);
	flex-shrink: 0;
}
.wpcrm-fe-stat-primary .wpcrm-fe-stat-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; }
.wpcrm-fe-stat-success .wpcrm-fe-stat-icon { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; }
.wpcrm-fe-stat-alert .wpcrm-fe-stat-icon { background: linear-gradient(135deg, #f87171, #dc2626); color: #fff; }

.wpcrm-fe-stat-label {
	display: block;
	font-size: 12px;
	color: var(--wpcrm-muted);
	margin-bottom: 2px;
}
.wpcrm-fe-stat-value {
	display: block;
	font-size: 22px;
	font-weight: 700;
	color: var(--wpcrm-text);
}
.wpcrm-fe-stat-sub {
	display: block;
	font-size: 12px;
	color: var(--wpcrm-muted);
	margin-top: 2px;
}

/* ===== Grid / Panels ===== */
.wpcrm-fe-grid {
	display: grid;
	grid-template-columns: 1.4fr 1fr;
	gap: 20px;
}
@media (max-width: 1100px) {
	.wpcrm-fe-grid { grid-template-columns: 1fr; }
}

.wpcrm-fe-panel {
	background: var(--wpcrm-card);
	border-radius: var(--wpcrm-radius);
	border: 1px solid var(--wpcrm-border);
	box-shadow: var(--wpcrm-shadow);
	margin-bottom: 20px;
	overflow: hidden;
}
.wpcrm-fe-panel-header {
	padding: 16px 20px;
	border-bottom: 1px solid var(--wpcrm-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.wpcrm-fe-panel-header h2 {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
}
.wpcrm-fe-panel-body { padding: 18px 20px; }
.wpcrm-fe-panel-chart .wpcrm-fe-panel-body { min-height: 280px; }

/* ===== Quick actions ===== */
.wpcrm-fe-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.wpcrm-fe-action-btn {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border-radius: 10px;
	border: 1px solid var(--wpcrm-border);
	background: #fff;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: var(--wpcrm-text);
	font-family: inherit;
	text-align: left;
	transition: all 0.15s;
	width: 100%;
}
.wpcrm-fe-action-btn:hover {
	border-color: var(--wpcrm-accent);
	background: #eff6ff;
}
.wpcrm-fe-action-icon {
	width: 36px; height: 36px;
	border-radius: 10px;
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
}
.wpcrm-fe-icon-blue { background: #dbeafe; color: #2563eb; }
.wpcrm-fe-icon-violet { background: #ede9fe; color: #7c3aed; }
.wpcrm-fe-icon-green { background: #d1fae5; color: #059669; }
.wpcrm-fe-icon-amber { background: #fef3c7; color: #d97706; }
.wpcrm-fe-icon-slate { background: #f1f5f9; color: #475569; }

/* ===== Lists ===== */
.wpcrm-fe-list { padding: 0 !important; }
.wpcrm-fe-list-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 20px;
	border-bottom: 1px solid var(--wpcrm-border);
	text-decoration: none;
	color: inherit;
	transition: background 0.12s;
}
.wpcrm-fe-list-item:last-child { border-bottom: none; }
.wpcrm-fe-list-item:hover { background: #f8fafc; }
.wpcrm-fe-list-item.is-overdue .wpcrm-fe-list-title { color: var(--wpcrm-alert); }
.wpcrm-fe-list-main { min-width: 0; }
.wpcrm-fe-list-title {
	display: block;
	font-weight: 600;
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.wpcrm-fe-list-meta {
	display: block;
	font-size: 12px;
	color: var(--wpcrm-muted);
	margin-top: 2px;
}
.wpcrm-fe-list-badge {
	font-size: 11px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 20px;
	background: #f1f5f9;
	color: var(--wpcrm-muted);
	white-space: nowrap;
}
.wpcrm-fe-empty {
	padding: 24px;
	text-align: center;
	color: var(--wpcrm-muted);
	font-size: 14px;
	margin: 0;
}

/* ===== Table ===== */
.wpcrm-fe-table-wrap { overflow-x: auto; }
.wpcrm-fe-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}
.wpcrm-fe-table th {
	text-align: left;
	padding: 12px 16px;
	background: #f8fafc;
	border-bottom: 2px solid var(--wpcrm-border);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--wpcrm-muted);
	font-weight: 600;
}
.wpcrm-fe-table td {
	padding: 12px 16px;
	border-bottom: 1px solid var(--wpcrm-border);
	vertical-align: middle;
}
.wpcrm-fe-table tr:hover td { background: #f8fafc; }
.wpcrm-fe-table a {
	color: var(--wpcrm-accent);
	text-decoration: none;
	font-weight: 600;
}
.wpcrm-fe-table a:hover { text-decoration: underline; }

/* ===== Kanban ===== */
.wpcrm-fe-kanban {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	padding-bottom: 12px;
	align-items: flex-start;
}
.wpcrm-fe-kanban-column {
	min-width: 260px;
	max-width: 280px;
	background: #f8fafc;
	border-radius: var(--wpcrm-radius);
	border: 1px solid var(--wpcrm-border);
	flex-shrink: 0;
}
.wpcrm-fe-kanban-header {
	padding: 14px 14px 6px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.wpcrm-fe-kanban-header strong { font-size: 13px; }
.wpcrm-fe-kanban-count {
	background: #e2e8f0;
	color: var(--wpcrm-muted);
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 10px;
}
.wpcrm-fe-kanban-total {
	padding: 0 14px 10px;
	font-size: 12px;
	color: var(--wpcrm-muted);
	font-weight: 600;
}
.wpcrm-fe-kanban-cards {
	padding: 0 10px 12px;
	min-height: 80px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.wpcrm-fe-kanban-card {
	background: #fff;
	border: 1px solid var(--wpcrm-border);
	border-radius: 10px;
	padding: 12px;
	cursor: grab;
	box-shadow: var(--wpcrm-shadow);
	transition: box-shadow 0.15s, transform 0.15s;
}
.wpcrm-fe-kanban-card:hover {
	box-shadow: var(--wpcrm-shadow-md);
}
.wpcrm-fe-kanban-card.dragging {
	opacity: 0.5;
}
.wpcrm-fe-kanban-card-title {
	font-weight: 600;
	font-size: 13px;
	margin-bottom: 4px;
}
.wpcrm-fe-kanban-card-meta {
	font-size: 12px;
	color: var(--wpcrm-muted);
	margin-bottom: 6px;
}
.wpcrm-fe-kanban-card-value {
	font-size: 13px;
	font-weight: 700;
	color: var(--wpcrm-accent);
}

/* ===== Footer ===== */
.wpcrm-fe-footer {
	padding: 16px 28px;
	border-top: 1px solid var(--wpcrm-border);
	background: #fff;
}
.wpcrm-fe-footer-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: var(--wpcrm-muted);
}
.wpcrm-fe-footer a {
	color: var(--wpcrm-muted);
	text-decoration: none;
}
.wpcrm-fe-footer a:hover { color: var(--wpcrm-accent); }
.wpcrm-fe-footer-sep { opacity: 0.5; }

/* ===== Modals ===== */
.wpcrm-fe-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.wpcrm-fe-modal.is-open { display: flex; }
.wpcrm-fe-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
}
.wpcrm-fe-modal-box {
	position: relative;
	background: #fff;
	border-radius: 14px;
	width: 100%;
	max-width: 480px;
	max-height: 90vh;
	overflow: auto;
	box-shadow: 0 20px 50px rgba(0,0,0,0.2);
	z-index: 1;
}
.wpcrm-fe-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid var(--wpcrm-border);
}
.wpcrm-fe-modal-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
}
.wpcrm-fe-modal-close {
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: var(--wpcrm-muted);
	padding: 4px 8px;
}
.wpcrm-fe-modal-close:hover { color: var(--wpcrm-text); }
.wpcrm-fe-form-body {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.wpcrm-fe-form-body label {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--wpcrm-text);
}
.wpcrm-fe-form-body input,
.wpcrm-fe-form-body select,
.wpcrm-fe-form-body textarea {
	padding: 10px 12px;
	border: 1px solid var(--wpcrm-border);
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	background: #fff;
	color: var(--wpcrm-text);
}
.wpcrm-fe-form-body input:focus,
.wpcrm-fe-form-body select:focus,
.wpcrm-fe-form-body textarea:focus {
	outline: none;
	border-color: var(--wpcrm-accent);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.wpcrm-fe-form-msg {
	margin: 0;
	font-size: 13px;
	min-height: 18px;
}
.wpcrm-fe-form-msg.is-success { color: var(--wpcrm-success); }
.wpcrm-fe-form-msg.is-error { color: var(--wpcrm-alert); }
.wpcrm-fe-modal-footer {
	padding: 14px 20px;
	border-top: 1px solid var(--wpcrm-border);
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

/* ===== Locked / login ===== */
.wpcrm-fe-locked {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
}
.wpcrm-fe-locked-card {
	background: #fff;
	border-radius: 16px;
	padding: 40px;
	text-align: center;
	max-width: 400px;
	box-shadow: var(--wpcrm-shadow-md);
	border: 1px solid var(--wpcrm-border);
}
.wpcrm-fe-locked-icon { font-size: 40px; margin-bottom: 12px; }
.wpcrm-fe-locked-card h2 { margin: 0 0 8px; }
.wpcrm-fe-locked-card p { color: var(--wpcrm-muted); margin: 0 0 20px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
	.wpcrm-fe-sidebar {
		transform: translateX(-100%);
	}
	.wpcrm-fe.sidebar-open .wpcrm-fe-sidebar {
		transform: translateX(0);
	}
	.wpcrm-fe-body {
		margin-left: 0;
		width: 100%;
	}
	.wpcrm-fe-sidebar-toggle {
		display: inline-flex;
	}
	.wpcrm-fe-main { padding: 16px; }
	.wpcrm-fe-topbar { padding: 12px 16px; }
	.wpcrm-fe-topbar-date { display: none; }
}

/* Overlay when sidebar open on mobile */
.wpcrm-fe-sidebar-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(15,23,42,0.4);
	z-index: 90;
}
.wpcrm-fe.sidebar-open .wpcrm-fe-sidebar-overlay {
	display: block;
}
