/**
 * Dalux Two-Stage Award Voting System — Modal & Embedded UI Styles.
 */

:root {
	--dalux-primary: #2271b1;
	--dalux-success: #00a32a;
	--dalux-grey: #c3c4c7;
	--dalux-text: #1d2327;
	--dalux-radius: 8px;
	--dalux-brand-primary: #8dc63f;
	--dalux-brand-primary-hover: #61973b;
	--dalux-brand-secondary: #3e5867;
	--dalux-brand-secondary-hover: #25353e;
}

/* ---------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------- */

.dalux-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 24px !important;
	font-size: 18px !important;
	font-weight: 500 !important;
	border: 0 !important;
	border-radius: 4px !important;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
	line-height: 1.2 !important;
	text-decoration: none !important;
	box-shadow: none !important;
	outline: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.dalux-btn:hover,
.dalux-btn:focus,
.dalux-btn:active {
	border: 0 !important;
	box-shadow: none !important;
	outline: none !important;
}

.dalux-btn:active {
	transform: scale(0.98);
}

.dalux-btn-primary {
	background: var(--dalux-brand-primary) !important;
	color: #fff !important;
}

.dalux-btn-secondary {
	background: var(--dalux-brand-secondary) !important;
	color: #fff !important;
	border: none !important;
}

.dalux-btn-action {
	background: var(--dalux-brand-primary) !important;
	color: #fff !important;
	width: auto;
	min-width: 180px;
}

.dalux-btn-primary:hover,
.dalux-btn-action:hover,
.dalux-btn-action.dalux-btn-success:hover {
	background: var(--dalux-brand-primary-hover) !important;
	color: #fff !important;
}

.dalux-btn-secondary:hover {
	background: var(--dalux-brand-secondary-hover) !important;
	color: #fff !important;
}

.dalux-btn-action.dalux-btn-disabled {
	cursor: not-allowed;
	opacity: 0.75;
}

.dalux-vote-trigger-inactive,
.dalux-voting-inactive .dalux-btn {
	background: #c3c4c7 !important;
	color: #50575e !important;
	cursor: not-allowed !important;
	pointer-events: none !important;
}

.dalux-btn-action.dalux-btn-success {
	background: var(--dalux-brand-primary) !important;
	color: #fff !important;
}

/* ---------------------------------------------------------------
 * Modal
 * ------------------------------------------------------------- */

.dalux-voting-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease;
	padding: 20px;
}

.dalux-voting-modal-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

body.dalux-modal-open {
	overflow: hidden;
}

.dalux-voting-modal {
	position: relative;
	background: #fff;
	border-radius: var(--dalux-radius);
	max-width: 720px;
	width: 100%;
	max-height: 90vh;
	overflow: hidden;
	padding: 28px 32px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.dalux-voting-modal .dalux-modal-content {
	max-height: calc(90vh - 56px);
	overflow-y: auto;
	padding: 0 8px 8px 0;
	scrollbar-gutter: stable;
}

.dalux-modal-close {
	position: absolute;
	top: 12px;
	right: 16px;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	outline: none !important;
	padding: 0 !important;
	width: auto !important;
	height: auto !important;
	min-width: 0 !important;
	font-size: 28px !important;
	font-weight: 500 !important;
	line-height: 1;
	cursor: pointer;
	color: #50575e !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.dalux-modal-close:hover,
.dalux-modal-close:focus,
.dalux-modal-close:active {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	outline: none !important;
	color: #25353e !important;
}

/* ---------------------------------------------------------------
 * Screens
 * ------------------------------------------------------------- */

/* !important guards against theme/page-builder stylesheets that force
 * `display` on generic divs, which would otherwise defeat screen switching. */
.dalux-screen {
	display: none !important;
}

.dalux-screen.dalux-screen-active {
	display: block !important;
	animation: dalux-step-fade 180ms ease-out;
}

@keyframes dalux-step-fade {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.dalux-screen-title {
	margin: 0 0 24px;
	font-size: 20px;
}

.dalux-selection-title {
	margin: 0 0 28px;
	padding: 0 32px;
	text-align: center;
	font-size: 26px;
	line-height: 1.2;
}

.dalux-screen-footer {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 20px;
}

.dalux-voting-modal .dalux-screen-selection .dalux-projects-grid {
	padding-bottom: 24px;
}

.dalux-voting-modal .dalux-screen-selection .dalux-screen-footer {
	position: sticky;
	bottom: -1px;
	z-index: 5;
	margin: 20px -8px -8px;
	padding: 16px 8px 16px;
	background: #fff;
	box-shadow: 0 -14px 24px #fff, 0 24px 0 24px #fff;
}

/* ---------------------------------------------------------------
 * Project Grid
 * ------------------------------------------------------------- */

.dalux-projects-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 16px;
}

.dalux-project-card {
	position: relative;
	display: block;
	border: 2px solid var(--dalux-grey);
	border-radius: var(--dalux-radius);
	padding: 10px;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	text-align: center;
}

.dalux-project-card:hover {
	border-color: var(--dalux-primary);
}

.dalux-project-card.is-selected {
	border-color: var(--dalux-success);
	box-shadow: 0 0 0 2px rgba(0, 163, 42, 0.25);
}

.dalux-project-thumb {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 6px;
	margin-bottom: 8px;
	background: #f0f0f1;
}

.dalux-project-thumb-empty {
	display: block;
}

.dalux-project-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--dalux-text);
}

.dalux-project-title-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-bottom: 6px;
}

.dalux-project-flag {
	width: 20px;
	height: 14px;
	object-fit: cover;
	border-radius: 2px;
	flex-shrink: 0;
}

.dalux-project-flag-text {
	font-size: 16px;
	line-height: 1;
	flex-shrink: 0;
}

.dalux-project-input {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 18px;
	height: 18px;
}

.dalux-layout-list .dalux-projects-grid {
	grid-template-columns: 1fr;
	gap: 10px;
}

.dalux-layout-list .dalux-project-card {
	display: grid;
	grid-template-columns: 150px minmax(0, 1fr);
	align-items: stretch;
	min-height: 120px;
	padding: 10px 42px 10px 10px;
	text-align: left;
}

.dalux-layout-list .dalux-project-thumb {
	height: 100%;
	min-height: 100px;
	margin: 0;
}

.dalux-project-details {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	padding: 6px 16px;
}

.dalux-project-company,
.dalux-project-country,
.dalux-project-description {
	font-size: 13px;
	color: #50575e;
}

.dalux-project-company {
	font-weight: 600;
}

.dalux-project-country {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.dalux-project-description {
	line-height: 1.4;
}

.dalux-layout-list .dalux-project-title {
	font-size: 16px;
}

/* ---------------------------------------------------------------
 * Email Screen
 * ------------------------------------------------------------- */

.dalux-label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

.dalux-input {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	border: 1px solid var(--dalux-grey);
	border-radius: 8px;
	box-sizing: border-box;
}

.dalux-input:focus {
	border-color: var(--dalux-primary);
	outline: none;
}

.dalux-field-error {
	color: #d63638;
	font-size: 13px;
	margin-top: 6px;
}

/* Honeypot: must stay in the DOM and focusable-by-bots, hidden from humans. */
.dalux-hp-wrap {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.dalux-consent-notice {
	font-size: 13px;
	color: #50575e;
	margin-top: 14px;
	line-height: 1.5;
}

/* ---------------------------------------------------------------
 * Success Screen
 * ------------------------------------------------------------- */

.dalux-screen-success {
	text-align: center;
	padding: 20px 0;
}

.dalux-success-icon {
	width: 64px;
	height: 64px;
	line-height: 64px;
	border-radius: 50%;
	background: var(--dalux-success);
	color: #fff;
	font-size: 32px;
	margin: 0 auto 16px;
}

/* ---------------------------------------------------------------
 * Embed Container
 * ------------------------------------------------------------- */

.dalux-voting-container.dalux-embed {
	max-width: 720px;
	margin: 0 auto;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: var(--dalux-radius);
	padding: 32px;
}

/* ---------------------------------------------------------------
 * Admin: Leaderboard & Stats
 * ------------------------------------------------------------- */

.dalux-percentage-bar-wrap {
	position: relative;
	background: #f0f0f1;
	border-radius: 4px;
	height: 20px;
	width: 200px;
	overflow: hidden;
}

.dalux-percentage-bar {
	background: var(--dalux-primary);
	height: 100%;
}

.dalux-percentage-bar-potential {
	background: var(--dalux-success);
}

.dalux-percentage-bar-wrap span {
	position: absolute;
	top: 0;
	left: 6px;
	font-size: 11px;
	line-height: 20px;
	color: #fff;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.dalux-percentage-bar-wrap span.is-outside {
	color: #1d2327;
	text-shadow: none;
}

.dalux-filter-form {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 16px 0;
}

.dalux-stats-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.dalux-stats-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

.dalux-voting-status {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 3px;
	font-weight: 600;
}

.dalux-voting-status.is-active {
	background: #d7f0c2;
	color: #2c5c18;
}

.dalux-voting-status.is-inactive {
	background: #f0f0f1;
	color: #50575e;
}

.dalux-reset-votes-notice {
	margin: 48px 0 0;
	padding: 12px;
}

.dalux-reset-votes-notice p {
	margin: 0 0 8px;
}

@media (max-width: 782px) {
	.dalux-stats-toolbar,
	.dalux-stats-actions {
		align-items: flex-start;
		flex-direction: column;
	}
}

.dalux-admin-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
}

/* The `hidden` attribute has the same specificity as a class selector, so
 * without this rule the `display: flex` above silently wins and the modal
 * never actually hides. */
.dalux-admin-modal-overlay[hidden] {
	display: none;
}

.dalux-admin-modal {
	position: relative;
	background: #fff;
	border-radius: 8px;
	max-width: 980px;
	width: 94%;
	max-height: 80vh;
	overflow-y: auto;
	padding: 30px;
}

.dalux-admin-modal table {
	table-layout: auto;
}

.dalux-nowrap {
	white-space: nowrap;
}

.dalux-vote-pager {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 14px;
}

@media (max-width: 600px) {
	.dalux-voting-modal,
	.dalux-voting-container.dalux-embed {
		padding: 20px;
	}

	.dalux-selection-title {
		padding: 0 20px;
		font-size: 22px;
	}

	.dalux-projects-grid {
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	}

	.dalux-layout-list .dalux-project-card {
		grid-template-columns: 100px minmax(0, 1fr);
	}
}
