/* ===========================================================================
   Asmi Wellness — shared UI theme
   Loaded by BOTH the client dashboard (/app) and the admin panel
   (/asmi-admin), so the two areas are the same product with different URLs.

   Layer order:  bootstrap 5.3  ->  theme.css (this file)  ->  app.css / admin.css

   Spacing is deliberately compact: tokens below drive every inset, so density
   can be retuned in one place rather than per component.
   =========================================================================== */

:root {
	/* -- Brand (taken from the public site, assets/css/style.css) ---------- */
	--asmi-plum-900: #500d3a;
	--asmi-plum-700: #5b1f46;
	--asmi-plum-600: #742c5b;
	--asmi-plum-500: #783766;
	--asmi-rose:     #c497a2;
	--asmi-rose-100: #f6ecee;

	/* -- Surfaces --------------------------------------------------------- */
	--asmi-bg:        #f7f5f2;
	--asmi-surface:   #ffffff;
	--asmi-border:    #e7e2dc;
	--asmi-ink:       #221820;
	--asmi-ink-muted: #7a6f76;

	/* -- Density knobs ---------------------------------------------------- */
	--asmi-pad-xs:  .35rem;
	--asmi-pad-sm:  .5rem;
	--asmi-pad:     .75rem;
	--asmi-pad-lg:  1rem;
	--asmi-gap:     .75rem;
	--asmi-radius:  10px;
	--asmi-sidebar-w: 236px;
	--asmi-topbar-h:  52px;

	--asmi-shadow: 0 1px 2px rgba(34,24,32,.04), 0 4px 16px rgba(34,24,32,.05);

	/* -- Bootstrap overrides ---------------------------------------------- */
	--bs-primary:      var(--asmi-plum-700);
	--bs-primary-rgb:  91, 31, 70;
	--bs-body-bg:      var(--asmi-bg);
	--bs-body-color:   var(--asmi-ink);
	--bs-border-color: var(--asmi-border);
	--bs-body-font-size: .875rem;

	/* Bootstrap 5.3 resolves link colour from the -rgb tokens, so both the
	   named colour and its triplet have to be set. */
	--bs-link-color:           var(--asmi-plum-600);
	--bs-link-color-rgb:       116, 44, 91;
	--bs-link-hover-color:     var(--asmi-plum-900);
	--bs-link-hover-color-rgb: 80, 13, 58;

	--bs-font-sans-serif: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
		Roboto, Helvetica, Arial, sans-serif;
}

body {
	background: var(--asmi-bg);
	color: var(--asmi-ink);
	font-family: var(--bs-font-sans-serif);
	font-size: .875rem;
	-webkit-font-smoothing: antialiased;
}

/* =========================================================== app shell === */

.app-sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	width: var(--asmi-sidebar-w);
	background: linear-gradient(180deg, var(--asmi-plum-700) 0%, var(--asmi-plum-900) 100%);
	color: #fff;
	display: flex;
	flex-direction: column;
	z-index: 1045;
	transition: transform .2s ease;
}

.app-sidebar__brand {
	display: flex;
	align-items: center;
	gap: .55rem;
	padding: var(--asmi-pad) var(--asmi-pad-lg);
	min-height: var(--asmi-topbar-h);
	color: #fff;
	text-decoration: none;
	border-bottom: 1px solid rgba(255,255,255,.12);
}

.app-sidebar__brand-mark {
	width: 30px; height: 30px;
	border-radius: 8px;
	background: var(--asmi-rose);
	color: var(--asmi-plum-900);
	display: grid; place-items: center;
	font-weight: 700; font-size: .9rem;
	flex: 0 0 auto;
}

.app-sidebar__brand-name { font-weight: 600; font-size: .9rem; line-height: 1.15; }
.app-sidebar__brand-sub  { font-size: .68rem; color: var(--asmi-rose); }

.app-nav { padding: var(--asmi-pad-sm); overflow-y: auto; flex: 1 1 auto; }

.app-nav__label {
	font-size: .64rem;
	text-transform: uppercase;
	letter-spacing: .09em;
	color: rgba(255,255,255,.45);
	padding: var(--asmi-pad) var(--asmi-pad-sm) var(--asmi-pad-xs);
}

.app-nav__link {
	display: flex;
	align-items: center;
	gap: .6rem;
	padding: var(--asmi-pad-xs) var(--asmi-pad-sm);
	margin-bottom: 1px;
	border-radius: 7px;
	color: rgba(255,255,255,.78);
	text-decoration: none;
	font-size: .82rem;
	font-weight: 500;
	line-height: 1.6;
	transition: background-color .12s ease, color .12s ease;
}

.app-nav__link i { width: 1rem; text-align: center; font-size: .9rem; flex: 0 0 auto; }
.app-nav__link:hover { background: rgba(255,255,255,.09); color: #fff; }

.app-nav__link.active {
	background: rgba(255,255,255,.14);
	color: #fff;
	box-shadow: inset 2px 0 0 var(--asmi-rose);
}

.app-sidebar__foot {
	padding: var(--asmi-pad-sm) var(--asmi-pad-lg);
	border-top: 1px solid rgba(255,255,255,.12);
	font-size: .7rem;
	color: rgba(255,255,255,.5);
}

.app-main {
	margin-left: var(--asmi-sidebar-w);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.app-topbar {
	position: sticky; top: 0; z-index: 1030;
	min-height: var(--asmi-topbar-h);
	background: rgba(255,255,255,.9);
	backdrop-filter: saturate(180%) blur(8px);
	border-bottom: 1px solid var(--asmi-border);
	padding: var(--asmi-pad-sm) var(--asmi-pad-lg);
	display: flex; align-items: center; gap: var(--asmi-gap);
}

.app-topbar__title { font-size: .95rem; font-weight: 600; margin: 0; }
.app-content { padding: var(--asmi-pad-lg); flex: 1 1 auto; }

.app-avatar {
	width: 30px; height: 30px;
	border-radius: 50%;
	background: var(--asmi-rose-100);
	color: var(--asmi-plum-700);
	display: grid; place-items: center;
	font-weight: 600; font-size: .72rem;
	flex: 0 0 auto;
}

.app-backdrop { position: fixed; inset: 0; background: rgba(34,24,32,.45); z-index: 1040; display: none; }

@media (max-width: 991.98px) {
	.app-sidebar { transform: translateX(-100%); }
	.app-sidebar.is-open { transform: translateX(0); }
	.app-main { margin-left: 0; }
	.app-backdrop.is-visible { display: block; }
	.app-content { padding: var(--asmi-pad); }
}

/* =========================================================== components == */

.card {
	border: 1px solid var(--asmi-border);
	border-radius: var(--asmi-radius);
	box-shadow: var(--asmi-shadow);
	background: var(--asmi-surface);
}

.card-header {
	background: transparent;
	border-bottom: 1px solid var(--asmi-border);
	padding: var(--asmi-pad) var(--asmi-pad-lg);
	font-weight: 600;
	font-size: .85rem;
}

.card-body { padding: var(--asmi-pad-lg); }

.stat-card__value { font-size: 1.4rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-card__label { font-size: .68rem; color: var(--asmi-ink-muted); text-transform: uppercase; letter-spacing: .06em; }

.stat-card__icon {
	width: 36px; height: 36px;
	border-radius: 9px;
	display: grid; place-items: center;
	font-size: .95rem;
	background: var(--asmi-rose-100);
	color: var(--asmi-plum-700);
	flex: 0 0 auto;
}

.stat-card__icon--sage { background: #e8efe9; color: #3f6b4c; }
.stat-card__icon--sand { background: #f4eee2; color: #8a6d33; }
.stat-card__icon--sky  { background: #e7eef6; color: #35577e; }

.btn { --bs-btn-padding-y: .35rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .82rem; }

.btn-primary {
	--bs-btn-bg: var(--asmi-plum-700);            --bs-btn-border-color: var(--asmi-plum-700);
	--bs-btn-hover-bg: var(--asmi-plum-900);      --bs-btn-hover-border-color: var(--asmi-plum-900);
	--bs-btn-active-bg: var(--asmi-plum-900);     --bs-btn-active-border-color: var(--asmi-plum-900);
	--bs-btn-disabled-bg: var(--asmi-plum-700);   --bs-btn-disabled-border-color: var(--asmi-plum-700);
}

.btn-outline-primary {
	--bs-btn-color: var(--asmi-plum-700);         --bs-btn-border-color: var(--asmi-plum-700);
	--bs-btn-hover-bg: var(--asmi-plum-700);      --bs-btn-hover-border-color: var(--asmi-plum-700);
	--bs-btn-active-bg: var(--asmi-plum-900);     --bs-btn-active-border-color: var(--asmi-plum-900);
}

.form-control, .form-select { font-size: .82rem; padding: .35rem .6rem; }

.form-control:focus, .form-select:focus {
	border-color: var(--asmi-rose);
	box-shadow: 0 0 0 .18rem rgba(196,151,162,.3);
}

.form-label { font-size: .78rem; font-weight: 500; margin-bottom: .25rem; }

.table { --bs-table-bg: transparent; font-size: .82rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .5rem .75rem; }

.table thead th {
	font-size: .68rem;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: var(--asmi-ink-muted);
	font-weight: 600;
	border-bottom-color: var(--asmi-border);
	white-space: nowrap;
}

/* Wide tables scroll inside their own container, never the page body. */
.table-scroll, .table-responsive { overflow-x: auto; }

.badge-soft { font-weight: 600; font-size: .68rem; padding: .3em .6em; border-radius: 999px; display: inline-block; }
.badge-soft--success { background: #e4f1e8; color: #2f6b43; }
.badge-soft--warning { background: #fbf0da; color: #8a6320; }
.badge-soft--danger  { background: #fbe4e6; color: #97283a; }
.badge-soft--muted   { background: #ecebe9; color: #6b6469; }

.empty-state { padding: 2rem 1rem; text-align: center; color: var(--asmi-ink-muted); }
.empty-state i { font-size: 1.6rem; color: var(--asmi-rose); margin-bottom: .5rem; display: block; }

.hero-panel { background: linear-gradient(120deg, var(--asmi-plum-700), var(--asmi-plum-500)); color: #fff; border: 0; }
.hero-panel .text-muted-light { color: rgba(255,255,255,.72); }

/* ======================================================== accessibility == */

a:focus-visible, button:focus-visible, .app-nav__link:focus-visible {
	outline: 2px solid var(--asmi-rose);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.app-sidebar { transition: none; }
}

/* ============================================== overflow containment ===== */

/* Grid columns are flex items, which default to min-width:auto and therefore
   refuse to shrink below their content. A wide table or chart inside one then
   stretches the whole document instead of scrolling in its own container --
   the usual cause of a horizontally scrolling page on phones. */
.row > [class*="col-"],
.card,
.card-body,
.table-scroll,
.table-responsive { min-width: 0; }

/* The page itself must never scroll sideways; wide content scrolls inside
   .table-scroll instead. */
html, body { max-width: 100%; overflow-x: clip; }
/* ================================================= collapsible sidebar === */

/* One custom property drives the sidebar, topbar, content and footer offsets,
   so collapsing is a single variable change rather than four rules. */
body.sidebar-collapsed { --asmi-sidebar-w: 68px; }

.app-sidebar__logo {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 9px;
	background: rgba(255, 255, 255, .1);
	overflow: hidden;
	display: grid;
	place-items: center;
}

/* The logo art is a figure above a wordmark. Scaling to cover and biasing the
   focal point upwards keeps the recognisable figure in the square. */
.app-sidebar__logo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 30%;
	transform: scale(1.35);
}

.app-sidebar, .content-wrapper, .admin-topbar, body > .main-footer {
	transition: margin-left .2s ease, width .2s ease;
}

@media (min-width: 992px) {
	body.sidebar-collapsed .app-sidebar__brand-text,
	body.sidebar-collapsed .app-nav__link > span,
	body.sidebar-collapsed .app-sidebar__foot { display: none; }

	body.sidebar-collapsed .app-sidebar__brand { justify-content: center; padding-left: 0; padding-right: 0; }

	/* Group headings become a hairline rule so the rail keeps its rhythm. */
	body.sidebar-collapsed .app-nav__label {
		font-size: 0;
		height: 0;
		padding: 0;
		margin: .5rem .55rem;
		border-top: 1px solid rgba(255, 255, 255, .14);
	}

	body.sidebar-collapsed .app-nav { padding: var(--asmi-pad-xs) .55rem; }

	body.sidebar-collapsed .app-nav__link {
		justify-content: center;
		padding: .55rem 0;
		position: relative;
	}

	body.sidebar-collapsed .app-nav__link i { width: auto; font-size: 1.05rem; }

}

@media (prefers-reduced-motion: reduce) {
	.app-sidebar, .content-wrapper, .admin-topbar, body > .main-footer { transition: none; }
}

/* Collapsed-rail flyout label.
   Appended to <body> by admin.js rather than drawn as a ::after on the link:
   .app-nav scrolls vertically, and a scroll container clips on BOTH axes, so
   an in-flow tooltip would be cut off at the rail's edge. */
.nav-flyout {
	position: fixed;
	z-index: 1080;
	background: #2b1b26;
	color: #fff;
	font-size: .8rem;
	font-weight: 500;
	line-height: 1;
	padding: .6rem .85rem;
	border-radius: 8px;
	white-space: nowrap;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
	pointer-events: none;
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity .12s ease, transform .12s ease;
}

.nav-flyout.is-visible { opacity: 1; transform: translateX(0); }

.nav-flyout::before {
	content: "";
	position: absolute;
	left: -4px;
	top: 50%;
	width: 8px; height: 8px;
	background: inherit;
	transform: translateY(-50%) rotate(45deg);
	border-radius: 1px;
}

@media (prefers-reduced-motion: reduce) { .nav-flyout { transition: none; } }
/* ============================================================ topbar ===== */

.topbar-action {
	position: relative;
	width: 32px; height: 32px;
	border-radius: 8px;
	border: 1px solid var(--asmi-border);
	background: var(--asmi-surface);
	color: var(--asmi-ink-muted);
	display: grid; place-items: center;
	font-size: .9rem;
	transition: background-color .12s ease, color .12s ease;
}

.topbar-action:hover { background: var(--asmi-rose-100); color: var(--asmi-plum-700); }

.topbar-badge {
	position: absolute;
	top: -4px; right: -4px;
	min-width: 16px; height: 16px;
	padding: 0 4px;
	border-radius: 999px;
	background: #97283a;
	color: #fff;
	font-size: .6rem;
	font-weight: 700;
	display: grid; place-items: center;
	border: 2px solid var(--asmi-surface);
}

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

.notif-item {
	display: flex;
	gap: var(--asmi-pad-sm);
	padding: var(--asmi-pad-sm) var(--asmi-pad-lg);
	border-bottom: 1px solid var(--asmi-border);
	text-decoration: none;
	color: inherit;
}

.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--asmi-bg); }
.notif-item.is-unread { background: var(--asmi-rose-100); }
.notif-item__icon { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: .78rem; flex: 0 0 auto; }
.notif-item__title { font-size: .8rem; font-weight: 500; line-height: 1.3; }
.notif-item__meta { font-size: .7rem; color: var(--asmi-ink-muted); }

