/* =========================================================================
   Full Calendar page — Banshkhali Blood Bank
   -------------------------------------------------------------------------
   Every rule here is scoped under `.cal-` so this file can never override
   or redesign the Home Dashboard Calendar Summary Card (`.db-cal-*`, in
   app.css) or anything else in the app. Uses the same design tokens
   (colors, radii, shadows, easing) as the rest of the theme — see the
   `:root` block near the top of app.css. See assets/js/views/calendar.js.
   ========================================================================= */

/* Premium canvas — a soft, neutral gray/off-white that reads as its own
   surface rather than an extension of the Home Dashboard's warm-porcelain
   background. Bleeds edge-to-edge inside .app-main the same way .db-page
   does (see app.css), but — unlike .db-page — DOES set a real, solid
   background: this page is meant to visually separate itself from the
   Dashboard, not blend into whatever the Background Manager is showing
   behind it. Purely a visual change; no markup/behaviour is touched. */
.cal-page {
	position: relative;
	margin: -20px -16px 0;
	padding: 16px 16px calc(22px + env(safe-area-inset-bottom));
	background:
		radial-gradient(120% 60% at 12% -8%, color-mix(in srgb, var(--bbb-garnet) 7%, transparent), transparent 60%),
		linear-gradient(180deg, #FAF8F7 0%, #F5F2F0 55%, #F1EDEB 100%);
	border-radius: 28px 28px 0 0;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
	padding-bottom: 12px;
	animation: dbFadeUp .4s ease both;
}
[data-theme="dark"] .cal-page {
	background:
		radial-gradient(120% 60% at 12% -8%, rgba(122, 16, 48, .12), transparent 60%),
		var(--bg);
	box-shadow: none;
}

/* ---------------------------------------------------------------------- */
/* Header — luxury Blood Red → Burgundy gradient banner                    */
/* ---------------------------------------------------------------------- */
.cal-header {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 16px;
	padding: 14px 14px;
	border-radius: 22px;
	background: linear-gradient(135deg, var(--bbb-garnet-bright) 0%, var(--bbb-garnet) 55%, var(--bbb-garnet-deep) 100%);
	box-shadow: 0 14px 30px -14px rgba(122, 16, 48, .55), 0 2px 6px rgba(122, 16, 48, .25);
	overflow: hidden;
}
/* Subtle premium glass sheen — a soft radial highlight sitting on top of
   the gradient, purely decorative (z-index below the header's own
   content) so it never interferes with tap targets. */
.cal-header::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(120% 90% at 15% -20%, rgba(255,255,255,.35), transparent 55%);
	pointer-events: none;
}
.cal-back-btn,
.cal-today-btn {
	position: relative;
	z-index: 1;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	justify-content: center;
	border-radius: 14px;
	background: rgba(255, 255, 255, .16);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	border: 1px solid rgba(255, 255, 255, .28);
	color: #fff;
	box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .25);
	cursor: pointer;
	transition: transform .16s var(--ease-spring), background .16s var(--ease-smooth);
}
.cal-today-btn {
	width: auto;
	padding: 0 14px;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
	background: rgba(255, 255, 255, .18);
	border-color: rgba(255, 255, 255, .3);
}
.cal-back-btn:active,
.cal-today-btn:active { transform: scale(.94); }
.cal-back-btn:hover,
.cal-today-btn:hover { background: rgba(255, 255, 255, .26); }

.cal-header-titles { position: relative; z-index: 1; flex: 1; min-width: 0; text-align: center; }
.cal-title-en {
	font-size: 13.5px;
	font-weight: 800;
	color: #fff;
	font-family: var(--font-mono);
	letter-spacing: .3px;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.cal-title-hijri {
	font-size: 10.5px;
	color: rgba(255, 255, 255, .82);
	margin-top: 2px;
}

/* ---------------------------------------------------------------------- */
/* "At a glance" strip — English Date/Year, Bangla Month/Year, Hijri       */
/* Month/Year, all bound live from CAL.today()                            */
/* ---------------------------------------------------------------------- */
.cal-today-strip {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-bottom: 14px;
}
.cal-today-strip-item {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 10px 10px;
	border-radius: 16px;
	background: rgba(255, 255, 255, .7);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, .9);
	box-shadow: 0 6px 16px -10px rgba(25, 19, 32, .18);
	text-align: center;
}
[data-theme="dark"] .cal-today-strip-item {
	background: var(--surface-raised);
	border-color: var(--border);
}
.cal-today-strip-label {
	font-size: 9.5px;
	font-weight: 700;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: .3px;
}
.cal-today-strip-value {
	font-size: 11.5px;
	font-weight: 800;
	color: var(--text);
	line-height: 1.2;
}

/* ---------------------------------------------------------------------- */
/* Month navigation                                                        */
/* ---------------------------------------------------------------------- */
.cal-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 12px;
}
.cal-nav-btn {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	background: var(--surface-raised);
	border: 1px solid var(--border);
	color: var(--accent-strong);
	cursor: pointer;
	transition: transform .16s var(--ease-spring);
}
.cal-nav-btn:active { transform: scale(.92); }

.cal-nav-center {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
}
.cal-month-bn {
	font-size: 22px;
	font-weight: 800;
	color: var(--text);
	line-height: 1.1;
}
.cal-year-select {
	appearance: none;
	-webkit-appearance: none;
	border: 1px solid var(--border);
	background: var(--surface-raised);
	color: var(--accent-strong);
	font-weight: 700;
	font-size: 11.5px;
	padding: 3px 10px;
	border-radius: 999px;
	text-align: center;
	cursor: pointer;
}

/* ---------------------------------------------------------------------- */
/* Legend — premium glass pill chips                                       */
/* ---------------------------------------------------------------------- */
.cal-legend {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 2px 2px 4px;
	margin-bottom: 14px;
	scrollbar-width: none;
}
.cal-legend::-webkit-scrollbar { display: none; }
.cal-legend-item {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 10.5px;
	font-weight: 700;
	color: var(--text);
	white-space: nowrap;
	padding: 6px 11px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .75);
	border: 1px solid rgba(25, 19, 32, .06);
	box-shadow: 0 4px 10px -6px rgba(25, 19, 32, .18);
}
[data-theme="dark"] .cal-legend-item { background: var(--surface-raised); border-color: var(--border); }
.cal-legend-item i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	display: inline-block;
}
.cal-legend-emoji { font-size: 11px; line-height: 1; }

/* ---------------------------------------------------------------------- */
/* Weekday row + grid                                                      */
/* ---------------------------------------------------------------------- */
.cal-weekday-row {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 5px;
	margin: 4px 0 8px;
}
.cal-weekday-cell {
	text-align: center;
	font-size: 11px;
	font-weight: 700;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: .2px;
}

.cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
}
.cal-grid-enter { animation: calGridFade .32s var(--ease-smooth) both; }
@keyframes calGridFade {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

.cal-cell {
	position: relative;
	aspect-ratio: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1px;
	border-radius: 14px;
	border: 1px solid rgba(25, 19, 32, .05);
	background: var(--card-inner-bg);
	color: var(--text);
	cursor: pointer;
	padding: 0;
	font-family: inherit;
	box-shadow: 0 4px 11px -6px rgba(25, 19, 32, .2);
	transition: transform .14s var(--ease-spring), box-shadow .16s var(--ease-smooth), background .16s var(--ease-smooth);
}
[data-theme="dark"] .cal-cell { border-color: var(--border); }
.cal-cell:hover { box-shadow: 0 7px 18px -8px rgba(25, 19, 32, .26); }
.cal-cell:active { transform: scale(.92); }
.cal-cell-out { opacity: .35; }
.cal-cell-day { font-size: 12.5px; font-weight: 700; line-height: 1.1; }
.cal-cell-bn { font-size: 8.5px; color: var(--text-muted); line-height: 1.1; }

.cal-cell-today {
	background: linear-gradient(135deg, var(--bbb-garnet-bright) 0%, var(--bbb-garnet) 55%, var(--bbb-garnet-deep) 100%);
	border-color: transparent;
	box-shadow: 0 8px 18px -8px rgba(122, 16, 48, .55);
}
.cal-cell-today .cal-cell-day,
.cal-cell-today .cal-cell-bn { color: #fff; }

.cal-cell-icons {
	position: absolute;
	bottom: 3px;
	display: flex;
	align-items: center;
	gap: 1px;
	line-height: 1;
}
.cal-cell-icon {
	font-size: 8px;
	line-height: 1;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .18));
}
.cal-cell-icon-badge {
	font-size: 6.5px;
	font-weight: 800;
	line-height: 1;
	color: #fff;
	background: var(--accent-strong);
	border-radius: 999px;
	padding: 1.5px 3px;
	margin-left: 1px;
}
.cal-cell-today .cal-cell-icon-badge { background: rgba(255, 255, 255, .9); color: var(--bbb-garnet-deep); }

.cal-cell-has-event:not(.cal-cell-today) { border-color: color-mix(in srgb, var(--accent) 25%, rgba(25,19,32,.08)); }

/* ---------------------------------------------------------------------- */
/* Bottom sheet                                                            */
/* ---------------------------------------------------------------------- */
.cal-sheet-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 10, 20, .5);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s var(--ease-smooth);
	z-index: 200;
}
.cal-sheet-overlay.open { opacity: 1; pointer-events: auto; }

.cal-sheet {
	width: 100%;
	max-width: 560px;
	max-height: 85vh;
	overflow-y: auto;
	background: var(--bg);
	border-radius: 28px 28px 0 0;
	padding: 12px 22px 30px;
	box-shadow: 0 -12px 40px -12px rgba(0, 0, 0, .35);
	transform: translateY(100%);
	transition: transform .28s var(--ease-spring);
}
.cal-sheet-overlay.open .cal-sheet { transform: translateY(0); }

.cal-sheet-handle {
	width: 42px;
	height: 4px;
	border-radius: 999px;
	background: var(--border);
	margin: 0 auto 16px;
}

.cal-sheet-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 16px;
}
.cal-sheet-bn-date { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1.3; letter-spacing: .1px; }
.cal-sheet-en-date { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }
.cal-sheet-close {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border-radius: 12px;
	background: var(--surface-raised);
	border: 1px solid var(--border);
	color: var(--text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.cal-sheet-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 11px 0;
	border-bottom: 1px solid var(--border);
	font-size: 13.5px;
}
.cal-sheet-row-label { color: var(--text-muted); font-weight: 600; }
.cal-sheet-row-value { color: var(--text); font-weight: 700; }

.cal-sheet-sun-row {
	display: flex;
	gap: 9px;
	margin: 14px 0;
}
.cal-sheet-sun-item {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 10px 13px;
	border-radius: 14px;
	background: var(--surface-raised);
	border: 1px solid var(--border);
	font-size: 12.5px;
	font-weight: 700;
	color: var(--text);
}
.cal-sheet-sun-item svg { color: var(--accent); flex-shrink: 0; }

.cal-sheet-section { margin-top: 18px; }
.cal-sheet-section-label {
	font-size: 11px;
	font-weight: 800;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: .4px;
	margin-bottom: 9px;
}
.cal-sheet-empty {
	font-size: 12.5px;
	color: var(--text-muted);
	padding: 11px 13px;
	border-radius: 12px;
	background: var(--surface-raised);
	border: 1px dashed var(--border);
	line-height: 1.4;
}

.cal-sheet-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 12px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	border: 1px solid transparent;
	margin: 0 6px 6px 0;
}
.cal-sheet-chip i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

.cal-sheet-camp {
	padding: 12px 14px;
	border-radius: 14px;
	background: var(--accent-soft);
	border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.cal-sheet-camp + .cal-sheet-camp { margin-top: 8px; }
.cal-sheet-camp-title { font-size: 13.5px; font-weight: 800; color: var(--accent-strong); }
.cal-sheet-camp-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.cal-sheet-emergency-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 14px;
	background: var(--surface-raised);
	border: 1px solid var(--border);
	margin-bottom: 8px;
	color: var(--accent);
}
.cal-sheet-emergency-text { min-width: 0; }
.cal-sheet-emergency-title { font-size: 12.5px; font-weight: 700; color: var(--text); }
.cal-sheet-emergency-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

@media (min-width: 900px) {
	.cal-page { max-width: 640px; margin: 0 auto; border-radius: 28px; }
	.cal-sheet { border-radius: 26px; margin-bottom: 24px; max-width: 480px; }
	.cal-sheet-overlay { align-items: center; }
}

/* Very narrow phones — keep the "at a glance" strip readable instead of
   squeezing three columns into an unreadably tight width. */
@media (max-width: 360px) {
	.cal-today-strip { grid-template-columns: 1fr 1fr; }
	.cal-today-strip-item:first-child { grid-column: 1 / -1; }
}

/* Blood Bank > Calendar Manager > "🗓 Calendar System" — Disable mode.
   Own `.cal-disabled-*` prefix only; never touches any other `.cal-*`
   rule above. Shown by views/calendar.js instead of the full page when
   the module is turned off, on a direct /calendar visit. */
.cal-disabled-screen {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	min-height: 60vh;
	padding: 32px 24px;
	gap: 14px;
	color: var(--text-muted);
}
.cal-disabled-icon {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--surface-2, rgba(120, 120, 120, 0.08));
	color: var(--text-muted);
}
.cal-disabled-text {
	font-size: 14.5px;
	font-weight: 600;
	color: var(--text);
	margin: 0;
	max-width: 320px;
}
