/* ============================================================
   Event Photo Finder — Frontend Gallery Styles
   ============================================================ */

/* ---------- Wrap ---------- */
.epf-wrap {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	max-width: 100%;
	margin: 0 auto;
}

/* ---------- Mode selector ---------- */
.epf-mode-select {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: center;
	padding: 2.5rem 1rem;
}

/* ---------- Buttons ---------- */
.epf-btn {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .65rem 1.4rem;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: .95rem;
	font-weight: 600;
	transition: background .15s, opacity .15s, transform .1s;
	text-decoration: none;
	line-height: 1.4;
}

.epf-btn:disabled,
.epf-btn[disabled] {
	opacity: .55;
	cursor: not-allowed;
}

.epf-btn:active:not(:disabled) {
	transform: scale(.97);
}

.epf-btn--primary  { background: #2271b1; color: #fff; }
.epf-btn--primary:hover:not(:disabled) { background: #135e96; color: #fff; }

.epf-btn--accent   { background: #d63638; color: #fff; }
.epf-btn--accent:hover:not(:disabled)  { background: #b32d2e; color: #fff; }

.epf-btn--secondary { background: #f0f0f1; color: #1d2327; border: 1px solid #ccc; }
.epf-btn--secondary:hover:not(:disabled) { background: #dcdcde; }

.epf-btn--ghost    { background: transparent; color: #2271b1; padding: .5rem .8rem; }
.epf-btn--ghost:hover { text-decoration: underline; }

.epf-btn--white    { background: rgba(255,255,255,.9); color: #1d2327; }
.epf-btn--white:hover:not(:disabled) { background: #fff; }

.epf-btn--sm       { padding: .35rem .8rem; font-size: .8rem; }

/* ---------- Status bar ---------- */
.epf-status {
	padding: .8rem 1rem;
	background: #f0f6fc;
	border-left: 4px solid #2271b1;
	border-radius: 4px;
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	gap: .5rem;
}

/* ---------- Spinner ---------- */
.epf-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid #ccc;
	border-top-color: #2271b1;
	border-radius: 50%;
	animation: epf-spin .7s linear infinite;
	flex-shrink: 0;
}

@keyframes epf-spin {
	to { transform: rotate(360deg); }
}

/* ---------- Model loading hint (inside camera panel) ---------- */
.epf-model-hint {
	display: flex;
	align-items: center;
	gap: .4rem;
	font-size: .82rem;
	color: #646970;
	margin: 0 0 .5rem;
	font-style: italic;
}

.epf-spinner-sm {
	display: inline-block;
	width: 12px;
	height: 12px;
	border: 2px solid #ccc;
	border-top-color: #2271b1;
	border-radius: 50%;
	animation: epf-spin .7s linear infinite;
	flex-shrink: 0;
}

/* ---------- Camera panel ---------- */
.epf-camera-panel {
	padding: 1rem 0;
}

/* Wrapper for video + MediaPipe overlay canvas */
.epf-camera-inner {
	position: relative;
	max-width: 480px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
}

/* MediaPipe live detection overlay */
.epf-overlay-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	border-radius: 10px;
}

.epf-video,
.epf-preview {
	width: 100%;
	max-width: 480px;
	border-radius: 10px;
	background: #000;
	aspect-ratio: 4/3;
	object-fit: cover;
	transform: scaleX(-1); /* mirror for selfie */
}

.epf-preview {
	transform: none; /* already mirrored on capture */
}

.epf-camera-controls {
	display: flex;
	flex-wrap: wrap;
	gap: .6rem;
	justify-content: center;
}

/* ---------- Gallery panel ---------- */
.epf-gallery-header {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1rem;
	flex-wrap: wrap;
}

.epf-gallery-title {
	font-weight: 600;
	font-size: 1.05rem;
	color: #1d2327;
}

/* ---------- Photo grid ---------- */
.epf-grid {
	display: grid;
	gap: 12px;
	margin-bottom: 1.5rem;
}

.epf-grid--1 { grid-template-columns: 1fr; }
.epf-grid--2 { grid-template-columns: repeat(2, 1fr); }
.epf-grid--3 { grid-template-columns: repeat(3, 1fr); }
.epf-grid--4 { grid-template-columns: repeat(4, 1fr); }
.epf-grid--5 { grid-template-columns: repeat(5, 1fr); }
.epf-grid--6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 767px) {
	.epf-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 480px) {
	.epf-grid { grid-template-columns: 1fr !important; }
}

/* ---------- Photo card ---------- */
.epf-photo-card {
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	cursor: pointer;
	outline: none;
	background: #f0f0f1;
}

.epf-photo-card:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: 2px;
}

.epf-photo-card img {
	width: 100%;
	height: 200px;
	object-fit: cover;
	display: block;
	transition: transform .3s;
}

.epf-photo-card:hover img,
.epf-photo-card:focus img {
	transform: scale(1.04);
}

.epf-photo-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(0deg, rgba(0,0,0,.65) 0%, transparent 100%);
	padding: 1.5rem .6rem .6rem;
	display: flex;
	justify-content: flex-end;
	opacity: 0;
	transition: opacity .25s;
}

.epf-photo-card:hover .epf-photo-overlay,
.epf-photo-card:focus .epf-photo-overlay {
	opacity: 1;
}

/* ---------- Load more ---------- */
.epf-load-more-wrap {
	text-align: center;
	padding: 1rem 0 2rem;
}

/* ---------- No photos ---------- */
.epf-no-photos {
	grid-column: 1 / -1;
	text-align: center;
	color: #646970;
	font-style: italic;
	padding: 2rem 0;
}

/* ---------- Hidden override (HTML hidden attr must win over display:flex/grid) ---------- */
[hidden] { display: none !important; }

/* ---------- Lightbox ---------- */
.epf-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.epf-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,.85);
}

.epf-lightbox-inner {
	position: relative;
	z-index: 1;
	max-width: min(92vw, 900px);
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .8rem;
}

.epf-lightbox-img {
	max-width: 100%;
	max-height: 80vh;
	border-radius: 8px;
	object-fit: contain;
	background: #111;
}

.epf-lightbox-close {
	position: absolute;
	top: -2.5rem;
	right: 0;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 2rem;
	cursor: pointer;
	line-height: 1;
	padding: 0 .25rem;
}

.epf-lightbox-close:hover { color: #ffb900; }

.epf-lightbox-actions {
	display: flex;
	gap: .6rem;
}

/* Prevent body scroll when lightbox open */
body.epf-lightbox-open {
	overflow: hidden;
}
