@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap");

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: "DM Sans", sans-serif;
	background: linear-gradient(
		135deg,
		var(--accent) 0%,
		var(--accent-light) 100%
	);
	min-height: 100vh;
	overflow: hidden;
}

/* =============================================
   LAYOUT
   ============================================= */

.dashboard-container {
	position: relative;
	display: flex;
	height: 100vh;
	gap: 0;
	padding-bottom: 40px;
}

/* =============================================
   SIDEBAR
   ============================================= */

.sidebar {
	position: absolute;
	left: 0%;
	bottom: 0%;
	width: 260px;
	min-width: 260px;
	background: linear-gradient(
		180deg,
		var(--sidebar-bg-start) 0%,
		var(--sidebar-bg-end) 100%
	);
	border-right: none;
	display: flex;
	flex-direction: column;
	transition:
		width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
		min-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
		border-radius 0.35s;
	overflow: hidden;
	position: relative;
	z-index: 10;
}

.sidebar.collapsed {
	width: 0;
	min-width: 0;
	border-width: 0;
}

.sidebar-header {
	padding: 13px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.18);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	white-space: nowrap;
}

.sidebar-logo {
	width: 34px;
	height: 34px;
	object-fit: contain;
	flex: 0 0 34px;
}

.sidebar-header h2 {
	color: white;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.3px;
}

.sidebar-nav {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 8px 0;
	overflow: hidden;
}

.nav-item {
	padding: 12px 25px;
	color: rgba(255, 255, 255, 0.88);
	text-decoration: none;
	font-size: 15px;
	font-weight: 500;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	transition:
		background-color 0.2s,
		color 0.2s,
		padding-left 0.2s;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 10px;
}

.nav-item:hover {
	background-color: white;
	color: var(--sidebar-bg-start);
	padding-left: 32px;
}

.nav-item.active {
	background-color: white;
	color: var(--sidebar-bg-start);
	font-weight: 700;
}

.nav-item .nav-icon {
	font-size: 18px;
	width: 22px;
	text-align: center;
	flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
	padding: 18px 25px;
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	color: rgba(255, 255, 255, 0.5);
	font-size: 12px;
	white-space: nowrap;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.main-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	background-color: white;
	overflow: hidden;
	border-left: none;
	transition: border-radius 0.35s;
	min-width: 0;
}

/* =============================================
   DASHBOARD HEADER
   ============================================= */

.dashboard-header {
	background: linear-gradient(135deg, var(--accent), var(--accent-light));
	padding: 20px 28px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 3px solid var(--accent-dark);
	flex-shrink: 0;
	gap: 16px;
}

/* Sidebar toggle button */
.sidebar-toggle {
	background: rgba(255, 255, 255, 0.18);
	border: none;
	border-radius: 10px;
	width: 42px;
	height: 42px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	transition: background 0.2s;
	flex-shrink: 0;
}

.sidebar-toggle:hover {
	background: rgba(255, 255, 255, 0.3);
}

.fa-bars,
.fa-xmark {
	color: #fff;
}

/* Animate to X when sidebar is open (optional) */
.sidebar-toggle.open .toggle-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}
.sidebar-toggle.open .toggle-bar:nth-child(2) {
	opacity: 0;
}
.sidebar-toggle.open .toggle-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

.header-title {
	flex: 1;
}

.dashboard-header h1 {
	color: white;
	font-size: 24px;
	font-weight: 700;
}

.dashboard-header .subtitle {
	color: rgba(255, 255, 255, 0.7);
	font-size: 13px;
	margin-top: 2px;
}

/* User menu */
.user-menu {
	position: relative;
	display: flex;
	align-items: center;
}

.user-badge {
	background-color: var(--text-muted);
	padding: 10px 20px;
	border-radius: 25px;
	color: var(--text);
	font-weight: 700;
	font-size: 15px;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 8px;
	transition: all 0.2s;
	white-space: nowrap;
}

.user-badge:hover {
	background-color: var(--text-muted);
}

.dropdown-arrow {
	font-size: 11px;
	transition: transform 0.3s;
}

.user-badge.active .dropdown-arrow {
	transform: rotate(180deg);
}

.user-dropdown {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	background: white;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
	min-width: 180px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: all 0.2s;
	z-index: 1000;
	overflow: hidden;
	border: 1.5px solid var(--surface-alt);
}

.user-dropdown.active {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.dropdown-item {
	display: block;
	padding: 13px 20px;
	color: var(--text);
	text-decoration: none;
	font-size: 14px;
	border-bottom: 1px solid var(--surface-alt);
	transition: all 0.2s;
}

.dropdown-item:last-child {
	border-bottom: none;
}

.dropdown-item:hover {
	background-color: var(--accent);
	color: white;
}

/* =============================================
   SCROLLABLE CONTENT AREA
   ============================================= */

.dashboard-content {
	flex: 1;
	padding: 24px 28px;
	overflow-y: auto;
	background: linear-gradient(
		160deg,
		var(--surface-alt) 0%,
		var(--surface-alt) 100%
	);
	scrollbar-width: thin;
	scrollbar-color: var(--accent) var(--surface-alt);
}

.dashboard-content::-webkit-scrollbar {
	width: 6px;
}
.dashboard-content::-webkit-scrollbar-track {
	background: transparent;
}
.dashboard-content::-webkit-scrollbar-thumb {
	background: var(--accent);
	border-radius: 3px;
}

/* =============================================
   SUMMARY CARDS
   ============================================= */

.summary-cards {
	display: grid;
	grid-template-columns: repeat(3, minmax(220px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.summary-card {
	background: white;
	border-radius: 14px;
	padding: 20px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
	display: flex;
	align-items: center;
	gap: 16px;
	transition: all 0.25s;
	border: 1.5px solid transparent;
}

.summary-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	border-color: var(--accent-light);
}

.card-icon {
	width: 52px;
	height: 52px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	flex-shrink: 0;
}

.sales-icon {
	background: linear-gradient(135deg, var(--accent), var(--success));
}
.customers-icon {
	background: linear-gradient(135deg, var(--primary), var(--primary));
}
.products-icon {
	background: linear-gradient(135deg, var(--warning), var(--warning));
}
.alert-icon {
	background: linear-gradient(135deg, var(--danger), #c62828);
}

.alert-icon i {
	font-size: 20px;
	color: white;
}

.card-content h3 {
	font-size: 12px;
	color: var(--text-muted);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 6px;
}

.card-value {
	font-size: 22px;
	font-weight: 700;
	color: var(--text);
	margin: 0;
	line-height: 1;
}

.card-trend {
	font-size: 12px;
	margin-top: 5px;
	display: block;
	font-weight: 600;
}

.card-trend.positive {
	color: var(--success);
}
.card-trend.negative {
	color: #d9534f;
}

.dashboard-highlights {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.highlight-card {
	min-height: 220px;
}

.priority-list,
.snapshot-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.priority-item,
.snapshot-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px 14px;
	border-radius: 12px;
	background: var(--surface-alt);
}

.priority-item p,
.snapshot-item span {
	font-size: 13px;
	color: var(--text-muted);
}

.priority-item strong,
.snapshot-item strong {
	color: var(--text);
	font-size: 14px;
}

.priority-item-details {
	display: flex;
	align-items: center;
	gap: 12px;
}

.priority-icon {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	flex-shrink: 0;
	font-size: 16px;
}

.priority-icon.warning {
	background: rgba(255, 152, 0, 0.15);
}

.priority-icon.critical {
	background: rgba(217, 83, 79, 0.15);
}

.priority-icon.ok {
	background: rgba(76, 175, 80, 0.15);
}

.snapshot-item {
	justify-content: space-between;
	align-items: center;
}

.card-trend.positive {
	color: var(--success);
}
.card-trend.negative {
	color: var(--danger);
}

/* =============================================
   CARDS
   ============================================= */

.card {
	background: white;
	border-radius: 14px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
	overflow: hidden;
	margin-bottom: 20px;
	border: 1.5px solid var(--surface-alt);
}

.card-header {
	padding: 18px 22px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1.5px solid var(--surface-alt);
	background: var(--surface-alt);
}

.card-header h2 {
	font-size: 16px;
	font-weight: 700;
	color: var(--accent-dark);
	display: flex;
	align-items: center;
	gap: 8px;
}

.card-header h2::before {
	content: "";
	display: inline-block;
	width: 4px;
	height: 18px;
	background: linear-gradient(180deg, var(--accent), var(--sidebar-bg-end));
	border-radius: 2px;
}

.card-body {
	padding: 22px;
}

/* =============================================
   CHARTS ROW
   ============================================= */

.charts-row {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 20px;
	margin-bottom: 20px;
}

.chart-card {
	height: 360px;
}
.chart-card .card-body {
	height: calc(100% - 62px);
	padding: 16px 22px;
}

.chart-filter {
	padding: 7px 12px;
	border: 1.5px solid var(--surface-alt);
	border-radius: 8px;
	background: white;
	color: var(--text);
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	transition: border-color 0.2s;
}

.chart-filter:hover,
.chart-filter:focus {
	outline: none;
	border-color: var(--accent);
}

/* =============================================
   INFO ROW
   ============================================= */

.info-row {
	display: grid;
	grid-template-columns: 3fr 2fr;
	gap: 20px;
	margin-bottom: 20px;
}

/* Activities */
.activities-list {
	max-height: 320px;
	overflow-y: auto;
}

.activity-item {
	display: flex;
	align-items: center;
	padding: 13px 0;
	border-bottom: 1px solid var(--surface-alt);
	gap: 14px;
}

.activity-item:last-child {
	border-bottom: none;
}

.activity-icon {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 15px;
	flex-shrink: 0;
}
.activity-icon i {
	display: inline-block;
	line-height: 1;
	font-size: 16px;
}

.activity-icon.sale {
	background: linear-gradient(135deg, var(--success), var(--success));
}
.activity-icon.stock {
	background: linear-gradient(135deg, var(--primary), var(--primary));
}
.activity-icon.expiry {
	background: linear-gradient(135deg, var(--warning), var(--warning));
}

.activity-content {
	flex: 1;
	min-width: 0;
}
.activity-content p {
	margin: 0 0 3px;
	font-size: 13px;
	color: var(--text);
}
.activity-time {
	font-size: 11px;
	color: var(--text-muted);
}
.activity-amount {
	font-weight: 700;
	color: var(--success);
	font-size: 13px;
	white-space: nowrap;
}

.alerts-list {
	max-height: 320px;
	overflow-y: auto;
}

.alert-item {
	padding: 13px 0;
	border-bottom: 1px solid var(--surface-alt);
	display: flex;
	align-items: center;
	gap: 12px;
}

.alert-item:last-child {
	border-bottom: none;
}

.alert-icon {
	color: var(--danger);
	font-size: 18px;
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50px;
	border-radius: 50px;
}
.alert-content {
	flex: 1;
}
.alert-content p {
	margin: 0;
	font-size: 13px;
	color: var(--text);
}
.alert-product {
	font-weight: 700;
	margin-bottom: 3px !important;
}
.alert-stock {
	color: var(--danger) !important;
	font-size: 12px !important;
}

/* =============================================
   EXPIRY TABLE
   ============================================= */

.table-responsive {
	overflow-x: auto;
}

.expiry-table {
	width: 100%;
	border-collapse: collapse;
}

.expiry-table th,
.expiry-table td {
	padding: 13px 16px;
	text-align: left;
	font-size: 13px;
	border-bottom: 1px solid var(--surface-alt);
}

.expiry-table th {
	background: var(--surface-alt);
	font-weight: 700;
	color: var(--text-muted);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}

.expiry-table tr:last-child td {
	border-bottom: none;
}
.expiry-table tr:hover td {
	background: var(--surface-alt);
}

.expiry-table .urgent {
	color: var(--danger);
	font-weight: 700;
}
.expiry-table .warning {
	color: var(--warning);
	font-weight: 700;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
	padding: 8px 18px;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-weight: 600;
	font-family: inherit;
	transition: all 0.2s;
	font-size: 13px;
}

.btn-outline {
	background: transparent;
	border: 1.5px solid var(--accent);
	color: var(--accent);
}

.btn-outline:hover {
	background: var(--accent);
	color: white;
}

/* =============================================
   NOTIFICATION ICON & BADGE
   ============================================= */

.notification-icon-wrapper {
	display: flex;
	align-items: center;
	position: relative;
}

.notification-icon {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 22px;
	color: var(--primary);
	position: relative;
	padding: 8px;
	margin-right: 12px;
	transition: color 0.3s;
}

.notification-icon:hover {
	color: aqua;
}

.notification-badge {
	position: absolute;
	top: 2px;
	right: 2px;
	background: var(--danger);
	color: white;
	border-radius: 50%;
	width: 18px;
	height: 18px;
	display: none;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: bold;
}

/* Onboarding tour trigger button (small) */
.onboarding-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 18px;
	color: var(--primary);
	padding: 8px;
	margin-right: 8px;
	border-radius: 8px;
	transition:
		background-color 0.15s,
		transform 0.12s;
}
.onboarding-btn:hover {
	background: rgba(75, 85, 99, 0.06);
	transform: translateY(-1px);
}

/* Ensure visibility in all viewports during development */
.user-menu .onboarding-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	z-index: 20 !important;
	color: var(--surface) !important;
}

/* =============================================
   NOTIFICATION POPOVER
   ============================================= */

.notification-popover {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: min(360px, calc(100vw - 24px));
	max-height: 380px;
	background: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(148, 163, 184, 0.25);
	border-radius: 14px;
	box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-6px);
	transition:
		opacity 0.18s ease,
		transform 0.18s ease;
	z-index: 1000;
}

.notification-popover.open {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}

.notification-popover-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	border-bottom: 1px solid var(--border);
	background: rgba(248, 250, 252, 0.96);
}

.notification-popover-header h3 {
	margin: 0;
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	gap: 8px;
}

.notification-popover-markall {
	background: none;
	border: none;
	color: var(--accent);
	font-size: 11px;
	font-weight: 700;
	cursor: pointer;
	padding: 0;
	white-space: nowrap;
}

.notification-popover-markall:hover {
	color: var(--accent-dark);
}

.notification-popover-list {
	overflow-y: auto;
	max-height: 320px;
	display: flex;
	flex-direction: column;
	padding: 8px;
	gap: 6px;
}

.notification-item {
	padding: 10px 10px 10px 8px;
	border: 1px solid rgba(148, 163, 184, 0.2);
	border-radius: 12px;
	display: flex;
	gap: 10px;
	align-items: center;
	cursor: pointer;
	transition:
		background 0.2s ease,
		border-color 0.2s ease;
	background: rgba(255, 255, 255, 0.9);
}

.notification-item:hover {
	background: rgba(248, 250, 252, 0.95);
	border-color: rgba(148, 163, 184, 0.35);
}

.notification-item:last-child {
	border-bottom: none;
}

.notification-item-icon {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
}

.notification-item-icon.normal {
	background: rgba(16, 185, 129, 0.12);
	color: var(--success);
}

.notification-item-icon.warning {
	background: rgba(245, 158, 11, 0.12);
	color: var(--warning);
}

.notification-item-icon.critical {
	background: rgba(239, 68, 68, 0.12);
	color: var(--danger);
}

.notification-item-content {
	flex: 1;
	min-width: 0;
}

.notification-item-message {
	font-size: 12px;
	color: var(--text);
	line-height: 1.4;
	margin-bottom: 2px;
	word-break: break-word;
}

.notification-item-time {
	font-size: 10px;
	color: var(--text-muted);
}

.notification-item-actions {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-left: 4px;
}

.notification-item-dismiss {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--text-muted);
	font-size: 11px;
	padding: 5px;
	border-radius: 8px;
}

.notification-item-dismiss:hover {
	background: rgba(15, 23, 42, 0.05);
	color: var(--text);
}

/* =============================================
   NOTIFICATION POP ANIMATIONS
   ============================================= */

@keyframes notifIn {
	from {
		opacity: 0;
		transform: translateX(20px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes notifOut {
	from {
		opacity: 1;
		transform: translateX(0);
	}
	to {
		opacity: 0;
		transform: translateX(20px);
	}
}

@keyframes slideInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 1024px) {
	body {
		overflow: auto;
	}

	.dashboard-container {
		flex-direction: column;
		height: auto;
	}

	.sidebar {
		position: fixed;
		left: 0;
		top: 0;
		width: 50%;
		min-width: 55%;
		height: 100vh;
		z-index: 1000;
		transform: translateX(0);
		transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	}

	.sidebar.collapsed {
		width: 100%;
		min-width: 100%;
		height: 0;
		overflow: hidden;
		transform: translateX(-100%);
	}

	#sidebarToggle {
		display: block;
	}

	.header-title {
		display: none;
	}

	.main-content {
		border-radius: 0 0 20px 20px;
		border-left: 3px solid var(--accent-dark);
		border-top: none;
	}

	.summary-cards {
		display: flex;
		flex-direction: column;
	}

	.dashboard-highlights {
		display: flex;
		flex-direction: column;
	}

	.charts-row {
		grid-template-columns: 1fr;
	}

	.info-row {
		grid-template-columns: 1fr;
	}

	.dashboard-header h1 {
		font-size: 18px;
	}

	.notification-popover {
		right: -10px;
		
		width: min(280px, calc(100vw - 22px));
		max-height: 300px;
	}

	.priority-item {
		flex-direction: column;
		align-items: flex-start;
	}
}
