/**
 * Public styles for MG Event-Voting.
 *
 * Deliberately restrained: buttons and form controls inherit the active theme's
 * typography and styling (no brand colours or imposed sizes). The plugin only
 * provides layout/structure (list rows, modal, spacing) so it blends into the
 * surrounding template.
 *
 * @package Mg_Event_Voting
 */

.mg-ev-wrap {
	margin: 1.5em 0;
}

/* Search / filter bar */
.mg-ev-search {
	margin-bottom: 1.25em;
	padding: 0.75em 1em;
	background: rgba(0, 0, 0, 0.03);
	border-radius: 6px;
}

.mg-ev-search__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
	align-items: flex-end;
}

.mg-ev-search__field {
	display: flex;
	flex-direction: column;
	gap: 0.2em;
}

.mg-ev-search__field > span {
	font-size: 0.85em;
}

.mg-ev-search__field--grow {
	flex: 1 1 200px;
}

/*
 * Form controls: comfortable, neutral fields. Typography is inherited (font: inherit);
 * only sizing plus a light neutral border/background are added so they read as proper,
 * usable inputs without imposing a colour scheme.
 */
.mg-ev-search__field input,
.mg-ev-search__field select,
.mg-ev-modal__form input[type="text"],
.mg-ev-modal__form input[type="email"] {
	width: 100%;
	box-sizing: border-box;
	padding: 0.55em 0.7em;
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 4px;
	background: #fff;
	color: inherit;
	font: inherit;
	line-height: 1.3;
}

.mg-ev-search__field input:focus,
.mg-ev-search__field select:focus,
.mg-ev-modal__form input[type="text"]:focus,
.mg-ev-modal__form input[type="email"]:focus {
	border-color: rgba(0, 0, 0, 0.55);
	outline: none;
}

.mg-ev-search__actions {
	display: flex;
	gap: 0.5em;
}

/*
 * Buttons: inherit the theme's typography (font: inherit) and stay in a neutral
 * greyscale palette – no brand colours. Primary = solid neutral, secondary = outline.
 */
.mg-ev-btn {
	display: inline-block;
	padding: 0.6em 1.25em;
	border: 1px solid #2c2c2c;
	border-radius: 4px;
	background: #2c2c2c;
	color: #fff;
	font: inherit;
	line-height: 1.3;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.mg-ev-btn:hover,
.mg-ev-btn:focus {
	background: #111;
	border-color: #111;
	color: #fff;
}

/* Secondary / low-emphasis buttons: neutral outline that adapts to the text colour. */
.mg-ev-btn--ghost {
	background: transparent;
	color: inherit;
	border-color: currentColor;
	opacity: 0.85;
}

.mg-ev-btn--ghost:hover,
.mg-ev-btn--ghost:focus {
	background: rgba(0, 0, 0, 0.06);
	color: inherit;
	opacity: 1;
}

/* Compact event list (rows) */
.mg-ev-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	overflow: hidden;
}

.mg-ev-card {
	display: flex;
	align-items: center;
	gap: 0.85em;
	padding: 0.6em 0.9em;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	flex-wrap: wrap;
}

.mg-ev-list > .mg-ev-card:first-child {
	border-top: 0;
}

.mg-ev-card:hover {
	background: rgba(0, 0, 0, 0.02);
}

.mg-ev-card--highlight {
	background: rgba(0, 0, 0, 0.03);
	box-shadow: inset 3px 0 0 currentColor;
}

.mg-ev-card__thumb {
	flex: 0 0 auto;
	width: 64px;
	height: 48px;
	border-radius: 4px;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.06);
}

.mg-ev-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.mg-ev-card__body {
	flex: 1 1 220px;
	min-width: 0;
}

.mg-ev-card__date {
	margin: 0;
	font-size: 0.72em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	opacity: 0.7;
}

.mg-ev-card__title {
	margin: 0;
	font-size: 1em;
	line-height: 1.25;
}

.mg-ev-card__ort {
	margin: 0.2em 0 0;
	font-size: 0.75em;
	font-weight: 400;
	opacity: 0.65;
}

.mg-ev-card__ort::before {
	content: "\1F4CD"; /* 📍 */
	margin-right: 0.3em;
	font-size: 0.9em;
	opacity: 0.75;
}

.mg-ev-card__votes {
	flex: 0 0 auto;
	text-align: center;
	min-width: 64px;
}

.mg-ev-card__votes-count {
	display: block;
	font-weight: 700;
	font-size: 1.15em;
	line-height: 1;
}

.mg-ev-card__votes-label {
	font-size: 0.7em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	opacity: 0.7;
}

.mg-ev-card__actions {
	flex: 0 0 auto;
	display: flex;
	gap: 0.4em;
	align-items: center;
}

.mg-ev-card__closed {
	font-size: 0.85em;
	font-style: italic;
	opacity: 0.7;
}

/* Share (toggled per row) */
.mg-ev-share[hidden] {
	display: none;
}

.mg-ev-share {
	flex-basis: 100%;
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
	align-items: center;
	margin-top: 0.4em;
	padding-top: 0.5em;
	border-top: 1px dashed rgba(0, 0, 0, 0.12);
	font-size: 0.85em;
}

.mg-ev-share__copy {
	font: inherit;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 4px;
	padding: 0.3em 0.7em;
	cursor: pointer;
	color: inherit;
}

/* Pagination */
.mg-ev-pagination {
	margin-top: 1.25em;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em;
	justify-content: center;
}

.mg-ev-pagination .page-numbers {
	display: inline-block;
	padding: 0.35em 0.65em;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 4px;
	text-decoration: none;
}

.mg-ev-pagination .page-numbers.current {
	font-weight: 700;
	background: rgba(0, 0, 0, 0.08);
}

.mg-ev-empty {
	padding: 1em;
	font-style: italic;
	opacity: 0.7;
}

.mg-ev-back {
	margin: 0 0 1em;
}

/* Confirmation notice (semantic status colours are kept for clarity) */
.mg-ev-notice {
	margin: 0 0 1.25em;
	padding: 0.9em 1.1em;
	border-radius: 6px;
	border-left: 4px solid;
}

.mg-ev-notice--success {
	background: #edfaef;
	border-color: #1a7f37;
	color: #14532d;
}

.mg-ev-notice--error {
	background: #fcf0f1;
	border-color: #b32d2e;
	color: #7a1c1d;
}

/* Voting modal (overlay chrome is plugin-provided; the form controls inherit the theme) */
.mg-ev-modal[hidden] {
	display: none;
}

.mg-ev-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1em;
}

.mg-ev-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

/*
 * Modal typography is deliberately unified to keep it calm and consistent:
 * - one base line-height (1.5) and the inherited text colour on the dialog;
 * - a two-step type scale only: the title (1.15em) and one shared "small" size
 *   (0.9em) for every secondary text (intro, labels, consent, message);
 * - a single de-emphasis method (opacity) for muted text, instead of mixing
 *   opacity values and hard-coded greys.
 */
.mg-ev-modal__dialog {
	position: relative;
	background: #fff;
	border-radius: 8px;
	max-width: 420px;
	width: 100%;
	padding: 1.5em;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	color: inherit;
	line-height: 1.5;
}

.mg-ev-modal__close {
	position: absolute;
	top: 0.4em;
	right: 0.6em;
	border: 0;
	background: transparent;
	font-size: 1.4em;
	line-height: 1;
	cursor: pointer;
	color: inherit;
	opacity: 0.6;
}

.mg-ev-modal__title {
	margin: 0 1.2em 0.6em 0;
	font-size: 1.15em;
	line-height: 1.3;
	font-weight: 600;
}

.mg-ev-modal__intro {
	margin: 0 0 1.1em;
	font-size: 0.9em;
	opacity: 0.75;
}

.mg-ev-modal__form label {
	display: block;
	font-size: 0.9em;
	font-weight: 500;
	margin: 0 0 0.3em;
}

.mg-ev-modal__form input[type="text"],
.mg-ev-modal__form input[type="email"] {
	margin-bottom: 0.9em;
}

.mg-ev-consent {
	display: flex;
	gap: 0.5em;
	align-items: flex-start;
	font-size: 0.9em;
	opacity: 0.75;
	margin: 0 0 1.1em;
	text-align: left;
}

.mg-ev-consent input {
	margin-top: 0.25em;
	flex: 0 0 auto;
}

.mg-ev-modal__submit {
	width: 100%;
}

.mg-ev-modal__msg {
	margin: 0.9em 0 0;
	font-size: 0.9em;
	min-height: 1em;
}

.mg-ev-modal__msg.is-error {
	color: #b32d2e;
}

.mg-ev-modal__msg.is-success {
	color: #1a7f37;
}

body.mg-ev-modal-open {
	overflow: hidden;
}

/* Honeypot – kept in the DOM for bots, hidden from users and assistive tech. */
.mg-ev-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Shared vote count for the cards / feature layouts. */
.mg-ev-votes-n {
	font-weight: 700;
	font-size: 1.1em;
}

/* ---------- Layout: cards (grid, larger images, short description) ---------- */
.mg-ev-list--cards {
	border: 0;
	border-radius: 0;
	overflow: visible;
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 280px, 1fr ) );
	gap: 1.5em;
}

.mg-ev-ecard {
	display: flex;
	flex-direction: column;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.mg-ev-ecard--highlight {
	box-shadow: 0 0 0 2px currentColor;
}

.mg-ev-ecard__media {
	background: rgba(0, 0, 0, 0.06);
}

.mg-ev-ecard__media img {
	display: block;
	width: 100%;
	height: 200px;
	object-fit: cover;
}

.mg-ev-ecard__body {
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	padding: 1em 1.1em 1.15em;
}

.mg-ev-ecard .mg-ev-card__title {
	font-size: 1.15em;
}

.mg-ev-ecard__desc {
	margin: 0;
	opacity: 0.85;
}

.mg-ev-ecard__votes {
	margin: 0.15em 0 0.35em;
}

/* Keep the actions pinned to the bottom so grid cards line up. */
.mg-ev-ecard .mg-ev-card__actions {
	margin-top: auto;
	flex-wrap: wrap;
}

/* ---------- Layout: feature (large image beside fuller content) ---------- */
.mg-ev-list--feature {
	border: 0;
	border-radius: 0;
	overflow: visible;
	display: flex;
	flex-direction: column;
	gap: 1.75em;
}

.mg-ev-feature {
	display: flex;
	gap: 0;
	align-items: stretch;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.mg-ev-feature--highlight {
	box-shadow: 0 0 0 2px currentColor;
}

.mg-ev-feature__media {
	flex: 0 0 42%;
	max-width: 42%;
	background: rgba(0, 0, 0, 0.06);
}

.mg-ev-feature__media img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 240px;
	object-fit: cover;
}

.mg-ev-feature__body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6em;
	padding: 1.4em 1.5em;
}

.mg-ev-feature__title {
	margin: 0;
	font-size: 1.45em;
	line-height: 1.2;
}

.mg-ev-feature__desc {
	opacity: 0.9;
}

.mg-ev-feature__meta {
	display: flex;
	align-items: center;
	gap: 1.25em;
	flex-wrap: wrap;
	margin-top: 0.25em;
}

.mg-ev-feature__votes {
	margin: 0;
}

/* ---------- Mobile (layout only – controls keep inheriting the theme) ---------- */
@media ( max-width: 600px ) {

	/* Filter bar: stack fields full width. */
	.mg-ev-search__row {
		flex-direction: column;
		align-items: stretch;
	}

	.mg-ev-search__field > span {
		font-size: 0.9em;
	}

	/* Reset the desktop "grow" rule so the field does not stretch vertically when stacked. */
	.mg-ev-search__field--grow {
		flex: 0 0 auto;
	}

	/* Keep form controls at >= 16px so iOS does not auto-zoom on focus. */
	.mg-ev-search__field input,
	.mg-ev-search__field select,
	.mg-ev-modal__form input[type="email"] {
		font-size: 16px;
	}

	.mg-ev-search__actions {
		gap: 0.5em;
	}

	/* Event row: thumb + title on line 1, vote count top-right, buttons on their own row. */
	.mg-ev-card {
		align-items: flex-start;
		gap: 0.5em 0.7em;
		padding: 0.85em;
	}

	.mg-ev-card__body {
		flex: 1 1 auto;
		min-width: 0;
	}

	.mg-ev-card__date {
		font-size: 0.8em;
	}

	.mg-ev-card__title {
		font-size: 1.05em;
		line-height: 1.3;
	}

	.mg-ev-card__votes {
		order: 3;
		flex: 0 0 auto;
		text-align: right;
		display: flex;
		align-items: baseline;
		gap: 0.4em;
	}

	/* Scoped to the list layout so the cards/feature actions are unaffected. */
	.mg-ev-card .mg-ev-card__actions {
		order: 4;
		flex: 1 1 100%;
		display: flex;
		gap: 0.5em;
	}

	.mg-ev-card .mg-ev-card__actions .mg-ev-btn {
		flex: 0 0 auto;
	}

	/* Cards: one per row. */
	.mg-ev-list--cards {
		grid-template-columns: 1fr;
		gap: 1.1em;
	}

	.mg-ev-ecard__media img {
		height: 190px;
	}

	/* Feature: stack image above content. */
	.mg-ev-feature {
		flex-direction: column;
	}

	.mg-ev-feature__media {
		flex-basis: auto;
		max-width: none;
		width: 100%;
	}

	.mg-ev-feature__media img {
		height: 210px;
		min-height: 0;
	}

	.mg-ev-feature__title {
		font-size: 1.25em;
	}

	/* Modal fills a bit more of the small screen. */
	.mg-ev-modal__dialog {
		padding: 1.25em;
	}
}
