/* =========================================================
   VD PWA — BASE
   Purpose: Shared PWA UI primitives
========================================================= */


/* =========================================================
   VD Station Card — Download Indicator (INLINE ACTION)
========================================================= */

.vd-station-actions {
	display: flex;
	align-items: center;
	justify-content: space-between; /* ⬅️ key line */

	width: 100%;
}

.vd-download-indicator {
	display: flex;
	align-items: center;
	justify-content: center;

	min-width: 38px;
	height: 38px;

	background: rgba(74, 36, 76, 0.85);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);

	border-radius: 10px;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);

	color: rgba(255,255,255,0.9);
	transition: background 200ms ease, transform 200ms ease, color 200ms ease;
}

/* Downloaded = green */
.vd-download-indicator.vd-downloaded {
	color: #32d26f;
	transform: scale(1.05);
}

/* =========================================================
   VD PWA — BOTTOM SHEET (SCRIPT / APPLICATION ONLY)
   Native motion, mobile safe
========================================================= */

#vd-bottom-sheet {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-end;
	pointer-events: none;
}

#vd-bottom-sheet.active {
	pointer-events: auto;
}

/* Backdrop — subtle, calm, readable */
.vd-sheet-backdrop {
	position: absolute;
	inset: 0;

	background: rgba(0, 0, 0, 0.28); /* lighter dim */
	backdrop-filter: blur(1px);
	-webkit-backdrop-filter: blur(1px);

	opacity: 0;
	transition:
		opacity 260ms ease-out,
		backdrop-filter 260ms ease-out,
		-webkit-backdrop-filter 260ms ease-out;
}

#vd-bottom-sheet.active .vd-sheet-backdrop {
	opacity: 1;
}

/* Panel */
.vd-sheet-panel {
	position: relative;
	width: 100%;
	max-height: calc(100vh - 80px);
	min-height: 40vh;

	background: #ffffff;
	border-radius: 20px 20px 0 0;

	padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;

	box-shadow: 0 -20px 40px rgba(0,0,0,0.18);

	transform: translateY(110%);
	opacity: 0.98;

	transition:
		transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
		opacity 240ms ease-out;

	will-change: transform;
}

#vd-bottom-sheet.active .vd-sheet-panel {
	transform: translateY(0);
	opacity: 1;
}

/* Close button */
.vd-sheet-close {
	position: sticky;
	top: 0;
	margin-left: auto;
	margin-bottom: 12px;

	font-size: 28px;
	line-height: 1;
	background: none;
	border: none;
	cursor: pointer;
	color: #666;
	z-index: 2;
}

.vd-sheet-close:hover {
	color: #000;
}

/* Typography */
.vd-sheet-panel h1,
.vd-sheet-panel h2 {
	font-size: 22px;
	font-weight: 600;
	line-height: 1.3;
	margin: 0 0 14px;
	color: #222;
}

.vd-sheet-panel p {
	font-size: 16px;
	line-height: 1.65;
	color: #444;
	margin: 0 0 14px;
}

/* =========================================================
   HARD ISOLATION — OFFLINE PREP FULLSCREEN GATE
   AUTHORITATIVE (NO APP BLEED)
========================================================= */

#vd-offline-sheet {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: none;

	background: #4a244c; /* VIA DOLOROSA PURPLE */
	color: #ffffff;

	pointer-events: auto;
}

#vd-offline-sheet.active {
	display: flex;
	flex-direction: column;
}

/* Disable backdrop visuals */
#vd-offline-sheet .vd-sheet-backdrop {
	display: none;
}

/* Fullscreen panel */
#vd-offline-sheet .vd-sheet-panel {
	width: 100%;
	min-height: 100vh;
	height: 100vh;

	display: flex;
	flex-direction: column;
	justify-content: space-between;

	background: transparent;
	border-radius: 0;

	padding:
		env(safe-area-inset-top)
		24px
		calc(32px + env(safe-area-inset-bottom));

	overflow-y: auto;
	-webkit-overflow-scrolling: touch;

	transform: none;
	transition: none;
	box-shadow: none;
}

/* Close (top-right, subtle) */
#vd-offline-sheet .vd-sheet-close {
	align-self: flex-end;
	margin-bottom: 32px;

	font-size: 26px;
	line-height: 1;
	background: none;
	border: none;
	cursor: pointer;

	color: rgba(255,255,255,0.65);
}

#vd-offline-sheet .vd-sheet-close:hover {
	color: #ffffff;
}

/* Content center */
#vd-offline-sheet .vd-sheet-content {
	flex: 1;

	display: flex;
	flex-direction: column;
	justify-content: center;

	max-width: 420px;
	width: 100%;
	margin: 0 auto;
}

/* Headings */
#vd-offline-sheet h2 {
	font-size: 28px;
	line-height: 1.25;
	margin-bottom: 16px;
	color: #ffffff;
}

#vd-offline-sheet p {
	font-size: 16px;
	line-height: 1.6;
	color: rgba(255,255,255,0.9);
	margin-bottom: 32px;
}

/* Actions */
#vd-offline-sheet .vd-card-actions {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Primary button */
#vd-offline-download {
	height: 56px;
	border-radius: 16px;

	font-size: 16px;
	font-weight: 600;

	background: #f4c542;
	color: #3b0d3b;

	border: none;
	cursor: pointer;
}

/* Secondary button */
#vd-offline-later {
	height: 52px;
	border-radius: 16px;

	background: transparent;
	border: 2px solid rgba(255,255,255,0.35);
	color: #ffffff;

	font-size: 15px;
	font-weight: 500;
	cursor: pointer;
}

/* =========================================================
   BODY LOCK — NO SCROLL, NO BLEED
========================================================= */

body.vd-sheet-open {
	overflow: hidden;
	height: 100vh;
	touch-action: none;
}

/* =========================================================
   VD PWA — OFFLINE PREP FEEDBACK
========================================================= */

#vd-prep-progress {
	margin-top: 24px;
}

.vd-progress-track {
	width: 100%;
	height: 6px;
	border-radius: 999px;
	background: rgba(255,255,255,0.25);
	overflow: hidden;
}

.vd-progress-bar {
	height: 100%;
	width: 0%;
	background: #f4c542;
	border-radius: 999px;
	transition: width 240ms linear;
}

.vd-progress-label {
	margin-top: 10px;
	font-size: 14px;
	color: rgba(255,255,255,0.85);
	text-align: center;
}

/* Disabled state */
#vd-offline-download[disabled] {
	opacity: 0.6;
	cursor: default;
}

/* =========================================================
   VD PWA — OFFLINE DASHBOARD VISUAL FIX
   Improves contrast & readability
========================================================= */

/* Card surface */
.vd-offline-dashboard {
	background: rgba(255, 255, 255, 0.92);
	border-radius: 20px;
	box-shadow: 0 20px 40px rgba(0,0,0,0.18);
	padding: 28px 22px;
	margin-top: 24px;
}

/* Headings */
.vd-offline-dashboard h2,
.vd-offline-dashboard h3 {
	color: #2a0d2e;
}

/* Status text */
.vd-status {
	font-size: 15px;
	font-weight: 500;
	margin-top: 4px;
}

.vd-status.pending {
	color: #6b6b6b;
}

.vd-status.ready {
	color: #1f7a4f;
}

.vd-status.partial {
	color: #b58900;
}

.vd-status.not-ready {
	color: #b00020;
}

/* Divider */
.vd-offline-dashboard hr {
	border: none;
	height: 1px;
	background: rgba(0,0,0,0.15);
	margin: 24px 0;
}

/* Action buttons */
.vd-offline-actions button {
	cursor: not-allowed;
	opacity: 0.45;
	background: #e6e6e6;
	color: #444;
}

/* Cached list */
.vd-offline-list li {
	color: #2a2a2a;
	font-weight: 500;
}

.vd-offline-list li.cached::before {
	color: #2e8b57;
}

.vd-offline-list li.pending::before {
	color: #999;
}

/* Note */
.vd-offline-note {
	color: #555;
}

/* =========================================================
   VD PWA — DOWNLOADS PAGE (AUTHORITATIVE)
   This file OWNS the Downloads UI
========================================================= */

:root {
	--vd-purple: #4a244c;
	--vd-purple-dark: #3b1c3d;
	--vd-purple-soft: rgba(74, 36, 76, 0.08);
	--vd-purple-border: rgba(74, 36, 76, 0.25);
	--vd-yellow: #f4c542;
}

/* =========================================================
   PAGE CONTAINER
========================================================= */

.vd-offline-dashboard {
	background: rgba(255, 255, 255, 0.92);
	border-radius: 22px;
	padding: 24px 22px 26px;
	margin-top: 24px;

	/* extremely soft presence */
	box-shadow: 0 6px 16px rgba(0,0,0,0.10);
}

/* =========================================================
   ACTION BAR (DOWNLOAD ALL / DELETE ALL)
========================================================= */

.vd-download-actions {
	display: flex;
	gap: 14px;
	margin-bottom: 22px;
}

/* Primary action */
.vd-btn-primary {
	background: var(--vd-purple) !important;
	color: #ffffff !important;

	font-size: 14px;
	font-weight: 600;

	padding: 10px 18px;
	border-radius: 12px;

	border: none !important;
	box-shadow: none !important;
	cursor: pointer;

	transition: background 160ms ease, color 160ms ease;
}

.vd-btn-primary:hover {
	background: #ffffff !important;
	color: var(--vd-purple) !important;
}

/* Secondary / disabled-looking action */
.vd-btn-secondary {
	background: var(--vd-purple-soft) !important;
	color: rgba(74, 36, 76, 0.45) !important;

	font-size: 14px;
	font-weight: 500;

	padding: 10px 18px;
	border-radius: 12px;

	border: 1px solid rgba(74,36,76,0.18) !important;
	box-shadow: none !important;

	cursor: not-allowed;
}

/* =========================================================
   VIDEO LIST
========================================================= */

.vd-video-list {
	list-style: none;
	padding: 0;
	margin: 0;

	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* =========================================================
   VIDEO ROW
========================================================= */

.vd-video-row {
	display: flex;
	align-items: center;
	justify-content: space-between;

	background: #ffffff;
	border-radius: 18px;
	padding: 18px 18px;

	/* VERY subtle separation */
	box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Title */
.vd-video-title {
	font-size: 16px;
	font-weight: 600;
	color: var(--vd-purple-dark);
}

/* =========================================================
   PER-VIDEO ACTION BUTTON
========================================================= */

.vd-video-action {
	font-size: 13px;
	font-weight: 600;

	padding: 8px 14px;
	border-radius: 10px;

	background: transparent !important;
	color: var(--vd-purple) !important;

	border: 1.5px solid var(--vd-purple-border) !important;
	box-shadow: none !important;

	cursor: pointer;
	transition: background 140ms ease, color 140ms ease;
}

.vd-video-action:hover {
	background: var(--vd-purple) !important;
	color: #ffffff !important;
}

/* Downloading / disabled */
.vd-video-action[disabled] {
	background: transparent !important;
	color: rgba(74,36,76,0.45) !important;
	border-color: rgba(74,36,76,0.18) !important;

	cursor: default;
}

/* =========================================================
   DOWNLOADED STATE (OPTIONAL VISUAL)
========================================================= */

.vd-video-row[data-downloaded="true"] {
	background: rgba(255,255,255,0.96);
}

/* =========================================================
   VD PWA — INSTALL EDUCATION SHEET
========================================================= */

.vd-edu-sheet {
	position: relative;
	padding: 20px 20px 24px;
}

/* Title + close alignment */
.vd-edu-title {
	font-size: 17px;
	font-weight: 600;
	line-height: 1.25;
	color: #5a2a5e;
	margin: 0;
	padding-right: 40px;
	padding-bottom: 16px;
}

/* Close — aligned to title cap height */
.vd-edu-close {
	position: absolute;
	top: 20px;
	right: 20px;

	font-size: 22px;
	line-height: 1;
	background: none;
	border: none;
	cursor: pointer;
	color: #5a2a5e;
}

.vd-edu-divider {
	border: none;
	height: 1px;
	background: rgba(0,0,0,0.12);
	margin-bottom: 18px;
}

.vd-edu-text {
	font-size: 16px;
	line-height: 1.65;
	color: #333;
	margin-bottom: 14px;
}

.vd-edu-text strong {
	color: #5a2a5e;
	font-weight: 600;
}

.vd-edu-actions {
	margin-top: 26px;
}

.vd-edu-primary {
	width: 100%;
	height: 54px;
	border-radius: 18px;
	border: none;
	cursor: pointer;

	font-size: 16px;
	font-weight: 600;

	background: #f4c542;
	color: #3b0d3b;
}

/* =========================================================
   VD PWA — INSTALL EDUCATION HEADER (FINAL)
========================================================= */

.vd-edu-sheet {
	position: relative;
	padding-top: 24px;
}

/* =========================================================
   VD PWA — INSTALL EDUCATION TITLE (OVERRIDE SAFE)
========================================================= */

#vd-bottom-sheet .vd-sheet-panel .vd-edu-title {
	font-size: 17px;          /* smaller */
	font-weight: 600;
	line-height: 1.25;
	color: #5a2a5e;           /* Via Dolorosa purple */

	margin: 0;
	padding-right: 44px;     /* space for close button */
	padding-bottom: 18px;
}

/* Close button — aligned to title text, not box */
.vd-edu-sheet .vd-sheet-close {
	position: absolute;
	top: 24px;                    /* NOT 50% — aligns with title cap height */
	right: 20px;

	font-size: 22px;
	line-height: 1;

	background: none;
	border: none;
	cursor: pointer;

	color: #5a2a5e;
}

/* Hover polish */
.vd-edu-sheet .vd-sheet-close:hover {
	color: #2a0d2e;
}

/* =========================================================
   VD PWA — EDUCATION SHEET FIX
   Hide base close when edu sheet is present
========================================================= */

/* When education sheet is inside the bottom sheet,
   hide the default (top-left) close button */
#vd-bottom-sheet .vd-sheet-panel > .vd-sheet-close {
	display: none;
}

/* Education sheet uses its OWN close button */
.vd-edu-sheet .vd-sheet-close {
	display: block;
}

/* Force icon SVGs to respect parent color */
.vd-download-indicator svg,
.vd-download-indicator svg path {
	fill: currentColor !important;
}

/* =========================================================
   VD PWA — INSTALL EDUCATION (HIDE GLOBAL CLOSE)
========================================================= */

#vd-bottom-sheet .vd-edu-sheet ~ .vd-sheet-close,
#vd-bottom-sheet .vd-edu-sheet + .vd-sheet-close,
#vd-bottom-sheet .vd-sheet-panel > .vd-sheet-close {
	display: none;
}

/* Show global close when NOT education sheet */
#vd-bottom-sheet .vd-sheet-panel:not(:has(.vd-edu-sheet)) > .vd-sheet-close {
	display: block;
}
