/* ── Pi9 Drug Education — Frontend ────────────────────────────── */

:root {
	--pi9de-primary:   #1a4f7a;
	--pi9de-accent:    #e05c1a;
	--pi9de-danger:    #c0392b;
	--pi9de-success:   #276749;
	--pi9de-muted:     #536172;
	--pi9de-border:    #dde3ea;
	--pi9de-bg:        #ffffff;
	--pi9de-bg-alt:    #f7f9fb;
	--pi9de-radius:    10px;
}

/* Card wrapper */
.pi9de-card {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 1rem;
	color: #2d3748;
	max-width: 860px;
	margin: 0 auto;
	line-height: 1.7;
}

/* Header */
.pi9de-header {
	background: linear-gradient(135deg, var(--pi9de-primary) 0%, #0d3557 100%);
	color: #fff;
	border-radius: var(--pi9de-radius) var(--pi9de-radius) 0 0;
	padding: 24px 28px;
}

.pi9de-title {
	margin: 0 0 10px;
	font-size: 1.7rem;
	font-weight: 700;
	line-height: 1.25;
	color: #fff;
}

/* Drug class badges */
.pi9de-drug-classes {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 10px;
}

.pi9de-badge {
	display: inline-block;
	padding: 3px 10px;
	background: rgba(255, 255, 255, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
	color: #fff;
	letter-spacing: 0.02em;
}

/* Safety flags */
.pi9de-flags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.pi9de-flag {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	background: rgba(224, 92, 26, 0.85);
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 700;
	color: #fff;
	letter-spacing: 0.03em;
}

.pi9de-flag::before {
	content: '⚠';
	font-size: 0.9em;
}

/* Last reviewed bar */
.pi9de-reviewed {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 20px;
	background: rgba(255, 255, 255, 0.12);
	border-top: 1px solid rgba(255, 255, 255, 0.18);
	font-size: 0.78rem;
	color: rgba(255, 255, 255, 0.82);
	letter-spacing: 0.02em;
}

.pi9de-reviewed svg {
	flex-shrink: 0;
	opacity: 0.75;
}

/* Sections */
.pi9de-sections {
	border: 1px solid var(--pi9de-border);
	border-top: none;
	border-radius: 0 0 var(--pi9de-radius) var(--pi9de-radius);
	overflow: hidden;
}

.pi9de-section {
	border-bottom: 1px solid var(--pi9de-border);
}

.pi9de-section:last-child {
	border-bottom: none;
}

/* Section header (details > summary) */
.pi9de-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	cursor: pointer;
	background: var(--pi9de-bg-alt);
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--pi9de-primary);
	list-style: none;
	user-select: none;
	transition: background 0.15s;
}

.pi9de-section-header::-webkit-details-marker { display: none; }
.pi9de-section-header::marker { display: none; }

.pi9de-section-header:hover {
	background: #edf2f7;
}

details[open] .pi9de-section-header {
	background: #e8f0f8;
	color: var(--pi9de-primary);
	border-bottom: 1px solid var(--pi9de-border);
}

/* Arrow */
.pi9de-arrow {
	width: 18px;
	height: 18px;
	position: relative;
	flex-shrink: 0;
}

.pi9de-arrow::before,
.pi9de-arrow::after {
	content: '';
	position: absolute;
	top: 50%;
	width: 7px;
	height: 2px;
	background: currentColor;
	border-radius: 1px;
	transition: transform 0.2s;
}

.pi9de-arrow::before {
	right: 50%;
	transform: translateY(-50%) rotate(45deg);
}

.pi9de-arrow::after {
	left: 50%;
	transform: translateY(-50%) rotate(-45deg);
}

details[open] .pi9de-arrow::before {
	transform: translateY(-50%) rotate(-45deg);
}

details[open] .pi9de-arrow::after {
	transform: translateY(-50%) rotate(45deg);
}

/* Section body */
.pi9de-section-body {
	padding: 18px 20px;
	background: var(--pi9de-bg);
}

/* Field */
.pi9de-field {
	margin-bottom: 18px;
	padding-bottom: 18px;
	border-bottom: 1px solid #f0f3f7;
}

.pi9de-field:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.pi9de-field-label {
	margin: 0 0 6px;
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--pi9de-muted);
}

.pi9de-field-value p {
	margin: 0 0 0.6em;
	color: #2d3748;
}

.pi9de-field-value p:last-child {
	margin-bottom: 0;
}

.pi9de-field-value ul,
.pi9de-field-value ol {
	margin: 0.3em 0 0.6em 1.4em;
	padding: 0;
}

.pi9de-field-value li {
	margin-bottom: 0.25em;
}

/* Badge (yes/no) */
.pi9de-badge--yes {
	background: #c6f6d5;
	color: var(--pi9de-success);
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 700;
	border: 1px solid #9ae6b4;
}

/* Checklist */
.pi9de-checklist {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.pi9de-checklist li {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	background: #ebf4ff;
	border: 1px solid #bee3f8;
	border-radius: 999px;
	font-size: 0.82rem;
	color: var(--pi9de-primary);
	font-weight: 600;
}

.pi9de-checklist li::before {
	content: '✓';
	color: var(--pi9de-primary);
	font-size: 0.8em;
}

/* Attachments */
.pi9de-attachments {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.pi9de-attachment img {
	border-radius: 6px;
	max-width: 200px;
	height: auto;
	display: block;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pi9de-doc-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: var(--pi9de-bg-alt);
	border: 1px solid var(--pi9de-border);
	border-radius: 6px;
	color: var(--pi9de-primary);
	text-decoration: none;
	font-size: 0.9rem;
	font-weight: 500;
}

.pi9de-doc-link:hover {
	background: #e8f0f8;
	text-decoration: underline;
}

/* External links */
.pi9de-links {
	margin: 0;
	padding: 0;
	list-style: none;
}

.pi9de-links li {
	margin-bottom: 8px;
}

.pi9de-links a {
	color: var(--pi9de-primary);
	font-weight: 500;
	text-decoration: underline;
}

.pi9de-links a:hover {
	color: var(--pi9de-accent);
}

/* Print button */
.pi9de-print-btn-wrap {
	text-align: right;
	margin-top: 16px;
}

.pi9de-print-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	background: transparent;
	border: 2px solid var(--pi9de-border);
	border-radius: 999px;
	font-size: 0.85rem;
	color: var(--pi9de-muted);
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s;
}

.pi9de-print-btn:hover {
	border-color: var(--pi9de-primary);
	color: var(--pi9de-primary);
}

.pi9de-print-btn::before {
	content: '🖨';
}

/* Responsive */
@media (max-width: 600px) {
	.pi9de-header     { padding: 18px 16px; }
	.pi9de-title      { font-size: 1.35rem; }
	.pi9de-section-header { padding: 12px 16px; font-size: 0.88rem; }
	.pi9de-section-body   { padding: 14px 16px; }
}

/* ── Drug List ───────────────────────────────────────────────── */

.pi9de-list-wrap {
	max-width: 1100px;
	margin: 0 auto;
}

/* Controls */
.pi9de-list-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-bottom: 28px;
}

.pi9de-search-input {
	flex: 1 1 240px;
	padding: 10px 16px;
	border: 1.5px solid var(--pi9de-border);
	border-radius: 999px;
	font-size: 0.9rem;
	outline: none;
	transition: border-color 0.2s;
}

.pi9de-search-input:focus {
	border-color: var(--pi9de-primary);
}

.pi9de-filter-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.pi9de-pill {
	padding: 5px 14px;
	border: 1.5px solid var(--pi9de-border);
	border-radius: 999px;
	background: #fff;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--pi9de-muted);
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pi9de-pill:hover {
	border-color: var(--pi9de-primary);
	color: var(--pi9de-primary);
}

.pi9de-pill.is-active {
	background: var(--pi9de-primary);
	border-color: var(--pi9de-primary);
	color: #fff;
}

/* Grid */
.pi9de-list-grid {
	display: grid;
	gap: 24px;
	grid-template-columns: repeat(3, 1fr);
}

[data-cols="2"] .pi9de-list-grid { grid-template-columns: repeat(2, 1fr); }
[data-cols="1"] .pi9de-list-grid { grid-template-columns: 1fr; }
[data-cols="4"] .pi9de-list-grid { grid-template-columns: repeat(4, 1fr); }

/* Card */
.pi9de-list-card {
	background: #fff;
	border: 1px solid var(--pi9de-border);
	border-radius: var(--pi9de-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
	transition: box-shadow 0.2s, transform 0.2s;
}

.pi9de-list-card:hover {
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
	transform: translateY(-2px);
}

.pi9de-list-card__link {
	display: block;
	line-height: 0;
}

.pi9de-list-card__img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	object-position: top;
	display: block;
}

.pi9de-list-card__img-placeholder {
	width: 100%;
	aspect-ratio: 16 / 9;
	background: linear-gradient(135deg, #1a4f7a 0%, #0d3557 100%);
	display: flex;
	align-items: center;
	justify-content: center;
}

.pi9de-list-card__img-placeholder::after {
	content: '💊';
	font-size: 2.5rem;
	opacity: 0.4;
}

.pi9de-list-card__body {
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.pi9de-list-card__title {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.3;
}

.pi9de-list-card__title a {
	color: var(--pi9de-primary);
	text-decoration: none;
}

.pi9de-list-card__title a:hover {
	text-decoration: underline;
}

.pi9de-list-card__classes {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.pi9de-list-card__class {
	display: inline-block;
	padding: 2px 8px;
	background: #ebf4ff;
	border: 1px solid #bee3f8;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--pi9de-primary);
}

.pi9de-list-card__desc {
	margin: 0;
	font-size: 0.85rem;
	color: var(--pi9de-muted);
	line-height: 1.55;
	flex: 1;
}

.pi9de-list-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	font-size: 0.75rem;
	color: var(--pi9de-muted);
}

.pi9de-list-card__meta-item::before {
	content: '· ';
}

.pi9de-list-card__meta-item:first-child::before {
	content: '';
}

.pi9de-list-card__btn {
	display: inline-block;
	margin-top: 6px;
	padding: 7px 16px;
	background: var(--pi9de-primary);
	color: #fff;
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 600;
	text-decoration: none;
	align-self: flex-start;
	transition: background 0.2s;
}

.pi9de-list-card__btn:hover {
	background: #0d3557;
}

.pi9de-list-card[aria-hidden="true"] {
	display: none;
}

.pi9de-list-no-results {
	text-align: center;
	color: var(--pi9de-muted);
	padding: 32px;
	font-size: 0.95rem;
}

.pi9de-list-empty {
	color: var(--pi9de-muted);
}

/* Single drug: back link */
.drug-back-link {
	margin-bottom: 20px;
}

.drug-back-link a {
	color: var(--pi9de-primary);
	text-decoration: none;
	font-size: 0.88rem;
	font-weight: 600;
}

.drug-back-link a:hover {
	text-decoration: underline;
}

/* Hero class badges */
.drug-hero-classes {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
}

.drug-hero-badge {
	display: inline-block;
	padding: 3px 12px;
	background: rgba(255,255,255,0.15);
	border: 1px solid rgba(255,255,255,0.3);
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
	color: #fff;
}

/* Hero eyebrow */
.page-hero-eyebrow {
	display: block;
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: rgba(255,255,255,0.65);
	margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 900px) {
	.pi9de-list-grid,
	[data-cols="3"] .pi9de-list-grid,
	[data-cols="4"] .pi9de-list-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 560px) {
	.pi9de-list-grid,
	[data-cols="2"] .pi9de-list-grid,
	[data-cols="3"] .pi9de-list-grid,
	[data-cols="4"] .pi9de-list-grid {
		grid-template-columns: 1fr;
	}

	.pi9de-list-controls {
		flex-direction: column;
		align-items: stretch;
	}
}

/* ── Print ────────────────────────────────────────────────────── */
@media print {
	.pi9de-print-btn-wrap { display: none; }

	.pi9de-header {
		background: #fff !important;
		color: #000 !important;
		border: 2px solid #000;
	}

	.pi9de-title  { color: #000 !important; }
	.pi9de-badge  { border: 1px solid #999; color: #000 !important; background: #eee !important; }
	.pi9de-flag   { background: #ffcccc !important; color: #000 !important; }

	.pi9de-section-header {
		background: #f0f0f0 !important;
		color: #000 !important;
		font-size: 11pt;
		page-break-inside: avoid;
	}

	.pi9de-section-body { padding: 8px 12px; }

	details { display: block !important; }
	details summary { display: block !important; }
	details > .pi9de-section-body { display: block !important; }

	.pi9de-card { max-width: 100%; }

	.pi9de-arrow { display: none; }
}

/* ── Member gate (partial-access) ─────────────────────────────── */

.pi9de-gate {
	margin: 32px 0 8px;
	padding: 36px 32px;
	background: linear-gradient(135deg, #eaf3fb 0%, #f0f8ff 100%);
	border: 1.5px solid #b8d6ee;
	border-radius: 12px;
	text-align: center;
}

.pi9de-gate-lock {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(26,79,122,.14);
	color: var(--pi9de-primary);
	margin-bottom: 16px;
}

.pi9de-gate-heading {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--pi9de-primary);
	margin: 0 0 8px;
}

.pi9de-gate-sub {
	font-size: .95rem;
	color: #536172;
	margin: 0 0 20px;
}

.pi9de-gate-list {
	list-style: none;
	padding: 0;
	margin: 0 auto 28px;
	display: inline-flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	justify-content: center;
	max-width: 520px;
}

.pi9de-gate-list li {
	background: #fff;
	border: 1px solid #b8d6ee;
	border-radius: 20px;
	padding: 5px 14px;
	font-size: .82rem;
	font-weight: 600;
	color: var(--pi9de-primary);
	white-space: nowrap;
}

.pi9de-gate-list li::before {
	content: "🔒 ";
	font-size: .78rem;
}

.pi9de-gate-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
	flex-wrap: wrap;
}

@media (max-width: 480px) {
	.pi9de-gate { padding: 28px 20px; }
	.pi9de-gate-actions { flex-direction: column; align-items: center; }
	.pi9de-gate-actions .btn { width: 100%; justify-content: center; }
}
