/* ==========================================================================
   Event Photo Gallery — shared styles (admin + frontend)
   All classes are prefixed with "epg-" to avoid theme/plugin collisions.
   ========================================================================== */

/* ---- Brand theme (matched to innorexpharma.growthway.co.in) ----
   Scoped as custom properties on the plugin's own root wrappers only,
   so nothing here touches global WordPress theme variables. */
#epg-gallery-wrapper,
.epg-gallery-grid,
.epg-lightbox {
	--epg-primary: #F47920;      /* orange CTA color from the site's buttons */
	--epg-primary-hover: #D9650F;
	--epg-brand-green: #1B7152;  /* logo / link accent green */
	--epg-brand-green-dark: #14543D;
	--epg-on-primary: #FFFFFF;
}

/* ---- Force plugin links and buttons to use the theme above, not the
   active WordPress theme's global link/button styles. Selectors are
   scoped + specific, with !important on the properties themes most
   commonly override globally (color, background, border, underline). ---- */

.epg-gallery-grid a,
#epg-gallery-wrapper a {
	color: var(--epg-brand-green) !important;
	text-decoration: none !important;
}

.epg-gallery-grid a:hover,
#epg-gallery-wrapper a:hover {
	color: var(--epg-brand-green-dark) !important;
	text-decoration: none !important;
}

.epg-gallery-grid button,
#epg-gallery-wrapper button,
.epg-lightbox button {
	font-family: inherit !important;
	border-radius: 6px !important;
	box-shadow: none !important;
}

/* Extra-hardened reset specifically for lightbox controls — these sit on
   top of the page overlay and are the most likely to visually collide
   with a theme's or the WP admin bar's own default button/focus styling. */
.epg-lightbox button {
	appearance: none !important;
	-webkit-appearance: none !important;
	border: none !important;
	outline: none !important;
	text-shadow: none !important;
}

/* ---- Admin: custom Add/Edit Event page ---- */

.epg-admin-page .epg-form-card {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 1.5rem 1.75rem;
	max-width: 640px;
	margin-top: 1rem;
}

.epg-field-label {
	display: block;
	font-weight: 600;
	font-size: 13px;
	color: var(--epg-brand-green, #1B7152);
	margin: 1.25rem 0 6px;
}

.epg-form-card .epg-field-label:first-child {
	margin-top: 0;
}

.epg-input-title {
	width: 100%;
	font-size: 20px;
	padding: 8px 10px;
}

.epg-slug-row {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-wrap: wrap;
}

.epg-slug-prefix {
	color: #666;
	font-size: 13px;
	white-space: nowrap;
}

.epg-input-slug {
	flex: 1;
	min-width: 160px;
	font-size: 13px;
}

.epg-field-hint {
	font-size: 12px;
	color: #666;
	margin: 4px 0 0;
}

.epg-admin-page textarea {
	width: 100%;
}

.epg-gallery-field {
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid #eee;
}

.epg-form-actions {
	margin-top: 1.75rem;
	padding-top: 1.25rem;
	border-top: 1px solid #eee;
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

.epg-delete-button {
	color: #b32d2e !important;
	border-color: #b32d2e !important;
	margin-right: auto;
}

.epg-delete-button:hover {
	background: #b32d2e !important;
	color: #fff !important;
}

#epg-gallery-wrapper #epg-add-photos,
.epg-form-card #epg-add-photos {
	background: var(--epg-primary, #F47920) !important;
	border-color: var(--epg-primary, #F47920) !important;
	color: #fff !important;
	font-weight: 600 !important;
}

.epg-form-card #epg-add-photos:hover {
	background: var(--epg-primary-hover, #D9650F) !important;
	border-color: var(--epg-primary-hover, #D9650F) !important;
}

.epg-publish-button {
	background: var(--epg-primary, #F47920) !important;
	border-color: var(--epg-primary, #F47920) !important;
	color: #fff !important;
	font-weight: 600 !important;
}

.epg-publish-button:hover {
	background: var(--epg-primary-hover, #D9650F) !important;
	border-color: var(--epg-primary-hover, #D9650F) !important;
}

/* ---- Frontend: single event page ---- */

.epg-single-event {
	max-width: 900px;
	margin: 40px auto;
	padding: 0 20px;
}

.epg-single-title {
	color: #1B7152;
	margin-bottom: 0.5rem;
}

.epg-back-link {
	display: inline-block;
	margin-bottom: 1rem;
	font-size: 14px;
	font-weight: 600;
	color: #1B7152 !important;
}

.epg-back-link:hover {
	color: #F47920 !important;
}

.epg-single-description {
	color: #444;
	margin-bottom: 1.5rem;
	line-height: 1.6;
}

.epg-single-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 12px;
}

.epg-photo-tile {
	cursor: pointer;
	border-radius: 8px;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.epg-photo-tile:hover,
.epg-photo-tile:focus {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
	outline: 2px solid var(--epg-primary, #F47920);
}

.epg-photo-tile img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ---- Admin: thumbnail manager on the Event edit screen ---- */

.epg-thumbnail-list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 15px 0;
	padding: 0;
	list-style: none;
	min-height: 10px;
}

.epg-thumb {
	position: relative;
	width: 90px;
	height: 90px;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	cursor: move;
	background: #f0f0f1;
}

.epg-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.epg-remove-thumb {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 20px;
	height: 20px;
	line-height: 18px;
	text-align: center;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	padding: 0;
}

.epg-remove-thumb:hover {
	background: #d63638;
}

.epg-thumb.epg-sortable-placeholder {
	border: 2px dashed #999;
	background: #eee;
}

/* "+ Add Photos" button — themed as the site's primary orange CTA.
   Scoped to #epg-gallery-wrapper with !important on color/background/border
   so wp-admin's default .button styles can't override it. */
#epg-gallery-wrapper #epg-add-photos {
	background: var(--epg-primary) !important;
	border-color: var(--epg-primary) !important;
	color: var(--epg-on-primary) !important;
	font-weight: 600 !important;
}

#epg-gallery-wrapper #epg-add-photos:hover {
	background: var(--epg-primary-hover) !important;
	border-color: var(--epg-primary-hover) !important;
	color: var(--epg-on-primary) !important;
}

/* ---- Frontend: gallery grid ---- */

.epg-gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 24px;
	margin: 20px 0;
}

.epg-event-card {
	display: block;
	cursor: pointer;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	border: 1px solid #1B7152 !important;
}

.epg-event-card:hover,
.epg-event-card:focus {
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
	outline: none;
	border: 1px solid var(--epg-primary) !important;
}

.epg-mosaic {
	display: grid;
	gap: 3px;
	aspect-ratio: 4 / 3;
	background: #000;
}

.epg-mosaic-1 {
	grid-template-columns: 1fr;
}

.epg-mosaic-2 {
	grid-template-columns: 1fr 1fr;
}

.epg-mosaic-3 {
	grid-template-columns: 2fr 1fr;
	grid-template-rows: 1fr 1fr;
}
.epg-mosaic-3 .epg-mosaic-tile:first-child {
	grid-row: 1 / 3;
}

.epg-mosaic-4 {
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr 1fr;
}

.epg-mosaic-tile {
	position: relative;
	overflow: hidden;
}

.epg-mosaic-tile img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.epg-mosaic-overlay {
	position: absolute;
	inset: 0;
	background: rgba(27, 113, 82, 0.75); /* var(--epg-brand-green) at opacity, kept literal for reliable a11y contrast */
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.4em;
	font-weight: 600;
}

.epg-event-meta {
	padding: 12px 14px;
}

.epg-event-title {
	margin: 0 0 4px;
	font-size: 1.05em;
	color: var(--epg-brand-green);
}

.epg-event-card:hover .epg-event-title {
	color: var(--epg-primary);
}

.epg-event-count {
	color: #666;
	font-size: 0.85em;
}

.epg-empty {
	color: #666;
	font-style: italic;
}

/* ---- Frontend: lightbox ---- */

.epg-lightbox {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(20, 84, 61, 0.75); /* var(--epg-brand-green-dark) */
	z-index: 100000;
	align-items: center;
	justify-content: center;
}

.epg-lightbox.epg-active {
	display: flex;
}

.epg-lightbox-content {
	max-width: 90vw;
	max-height: 85vh;
	text-align: center;
}

.epg-lightbox-content img {
	max-width: 90vw;
	max-height: 75vh;
	object-fit: contain;
	border-radius: 4px;
}

.epg-lightbox-caption {
	color: #eee;
	margin-top: 12px;
	font-size: 0.95em;
}

#epg-lightbox-counter {
	margin-left: 10px;
	opacity: 0.7;
}

.epg-lightbox-close,
.epg-lightbox-prev,
.epg-lightbox-next {
	position: absolute;
	background: transparent !important;
	background-color: transparent !important;
	border: none !important;
	box-shadow: none !important;
	color: #fff !important;
	font-size: 2.5em;
	cursor: pointer;
	line-height: 1;
	padding: 10px 16px;
	transition: color 0.15s ease;
}

.epg-lightbox-close:hover,
.epg-lightbox-close:focus,
.epg-lightbox-prev:hover,
.epg-lightbox-prev:focus,
.epg-lightbox-next:hover,
.epg-lightbox-next:focus {
	background: transparent !important;
	background-color: transparent !important;
	color: var(--epg-primary, #F47920) !important;
	outline: none !important;
	box-shadow: none !important;
}

.epg-lightbox-close {
	top: 10px;
	right: 20px;
	font-size: 2em;
}

.epg-lightbox-prev {
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
}

.epg-lightbox-next {
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 600px) {
	.epg-gallery-grid {
		grid-template-columns: 1fr;
	}
}
