/**
 * Frontend styles for Photo Competitions Manager plugin.
 */

.photo-comp-upload {
	max-width: 800px;
	margin: 2em auto;
	padding: 2em;
	background: #f9f9f9;
	border: 1px solid #ddd;
	border-radius: 4px;
}

.photo-comp-upload h2 {
	margin-top: 0;
	color: #333;
}

.photo-comp-upload h3 {
	margin-top: 2em;
	color: #333;
	border-bottom: 2px solid #ddd;
	padding-bottom: 0.5em;
}

.competition-upload-form p {
	margin-bottom: 1.5em;
}

.competition-upload-form label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.5em;
	color: #333;
}

.competition-upload-form .required {
	color: #d63638;
}

.competition-upload-form input[type="email"],
.competition-upload-form select {
	width: 100%;
	max-width: 500px;
	padding: 0.5em;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 1em;
}

.competition-upload-form input[type="file"] {
	display: block;
	margin-top: 0.5em;
}

.competition-upload-form small {
	display: block;
	margin-top: 0.5em;
	color: #666;
	font-size: 0.9em;
}

.competition-upload-form .button {
	padding: 0.75em 1.5em;
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 1em;
	transition: background 0.2s;
}

.competition-upload-form .button:hover {
	background: #135e96;
}

.member-info {
	padding: 1em;
	background: #e7f3ff;
	border-left: 4px solid #2271b1;
	margin-bottom: 1.5em;
}

/* Messages */
.photo-comp-upload .error {
	padding: 1em;
	background: #fef7f8;
	border-left: 4px solid #d63638;
	color: #b32d2e;
	margin-bottom: 1.5em;
}

.photo-comp-upload .success {
	padding: 1em;
	background: #edfaef;
	border-left: 4px solid #00a32a;
	color: #007017;
	margin-bottom: 1.5em;
}

.photo-comp-upload .notice {
	padding: 1em;
	background: #fff8e5;
	border-left: 4px solid #dba617;
	color: #8a6d3b;
	margin-bottom: 1.5em;
}

/* Member Submissions */
.member-submissions {
	margin: 2em 0;
	padding: 1.5em;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
}

.submissions-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1.5em;
	margin-top: 1.5em;
}

.submission-item {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 1em;
	text-align: center;
}

.submission-item img {
	max-width: 100%;
	height: auto;
	border-radius: 4px;
	margin-bottom: 0.5em;
}

.submission-item .category-label {
	margin: 0.5em 0;
	font-weight: 600;
	color: #333;
	font-size: 0.9em;
}

.submission-item .delete-form {
	margin-top: 0.5em;
}

.submission-item .button-link-delete {
	background: none;
	color: #d63638;
	padding: 0.5em;
	min-height: 44px;
	min-width: 44px;
	font-size: 0.9em;
	text-decoration: underline;
}

.submission-item .button-link-delete:hover {
	background: none;
	color: #a00;
}

.submission-item .button-link-delete.is-armed {
	background: #d63638;
	color: #fff;
	text-decoration: none;
}

.submission-item .button-link-delete:disabled {
	opacity: 0.6;
	cursor: wait;
}

/* Voting Interface */
.photo-comp-voting {
	max-width: 1200px;
	margin: 2em auto;
	padding: 2em;
	background: #f9f9f9;
	border: 1px solid #ddd;
	border-radius: 4px;
}

@media (max-width: 768px) {
	.photo-comp-voting {
		padding: 1.25em;
		margin: 1.5em auto;
	}
}

.photo-comp-voting h2,
.photo-comp-voting h3 {
	margin-top: 0;
	color: #333;
}

.photo-comp-voting h3 {
	margin-top: 2em;
	border-bottom: 2px solid #ddd;
	padding-bottom: 0.5em;
}

/* Messages */
.photo-comp-voting .error,
.photo-comp-voting .success,
.photo-comp-voting .notice {
	padding: 1em;
	margin-bottom: 1.5em;
	border-radius: 4px;
}

.photo-comp-voting .error {
	background: #fef7f8;
	border-left: 4px solid #d63638;
	color: #b32d2e;
}

.photo-comp-voting .success {
	background: #edfaef;
	border-left: 4px solid #00a32a;
	color: #007017;
}

.photo-comp-voting .notice {
	background: #fff8e5;
	border-left: 4px solid #dba617;
	color: #8a6d3b;
}

/* Category Selector */
.category-selector {
	margin: 2em 0;
	padding: 1.5em;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	display: flex;
	gap: 1em;
	align-items: center;
	flex-wrap: wrap;
}

.category-selector label {
	font-weight: 600;
	color: #333;
}

.category-selector select {
	padding: 0.5em;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 1em;
	min-width: 200px;
}

.category-selector .button {
	padding: 0.5em 1.5em;
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 1em;
	transition: background 0.2s;
}

.category-selector .button:hover {
	background: #135e96;
}

/* Voting Instructions */
.voting-instructions {
	margin: 2em 0;
	padding: 1.5em;
	background: #e7f3ff;
	border-left: 4px solid #2271b1;
	border-radius: 4px;
}

.voting-instructions h3 {
	margin-top: 0;
	border: none;
	padding-bottom: 0;
}

.voting-instructions p {
	margin: 0.5em 0;
	color: #333;
}

/* Voter Info */
.voter-info {
	margin: 2em 0;
	padding: 1.5em;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
}

.voter-info label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.5em;
	color: #333;
}

.voter-info .required {
	color: #d63638;
}

.voter-info input[type="text"] {
	width: 100%;
	max-width: 400px;
	padding: 0.5em;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 1em;
}

.voter-info small {
	display: block;
	margin-top: 0.5em;
	color: #666;
	font-size: 0.9em;
}

/* Images Grid */
.images-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 2em;
	margin: 2em 0;
}

@media (max-width: 768px) {
	.images-grid {
		grid-template-columns: 1fr;
		gap: 1.5em;
	}
}

.voting-image-item {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 1em;
	text-align: center;
	transition: box-shadow 0.2s;
}

@media (max-width: 768px) {
	.voting-image-item {
		padding: 0.75em;
	}
}

.voting-image-item:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.voting-image-item .image-wrapper {
	position: relative;
	margin-bottom: 1em;
}

.voting-image-item .image-link {
	display: block;
}

.voting-image-item img {
	max-width: 100%;
	height: auto;
	border-radius: 4px;
	display: block;
	margin: 0 auto;
}

.voting-image-item .image-unavailable {
	padding: 3em 1em;
	background: #f5f5f5;
	color: #999;
	border-radius: 4px;
}

.voting-image-item .image-number {
	position: absolute;
	top: 0.5em;
	left: 0.5em;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	padding: 0.25em 0.75em;
	border-radius: 4px;
	font-weight: 600;
	font-size: 0.9em;
}

/* Vote Selector */
.vote-selector {
	margin-top: 1em;
}

.vote-selector .vote-label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.5em;
	color: #333;
	font-size: 0.9em;
}

.vote-selector select {
	width: 100%;
	padding: 0.5em;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 1em;
	background: #fff;
}

.vote-selector-buttons .vote-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3em;
	justify-content: center;
}

.vote-selector-buttons .vote-option {
	position: relative;
	flex: 1 1 0;
	min-width: 2.75rem;
	max-width: 5rem;
}

.vote-selector-buttons .vote-option input[type="radio"] {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

.vote-selector-buttons .vote-option label {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 2.35rem;
	width: 100%;
	padding: 0.35em 0.4em;
	border: 1px solid #d2d7dc;
	border-radius: 6px;
	background: #fff;
	box-sizing: border-box;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.vote-selector-buttons .vote-option input[type="radio"]:focus-visible + label,
.vote-selector-buttons .vote-option label:hover {
	border-color: #2271b1;
}

.vote-selector-buttons .vote-option input[type="radio"]:checked + label {
	border-color: #2271b1;
	background: #f0f6fc;
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.12);
	color: #1c3d5a;
}

.vote-selector-buttons .vote-value {
	font-weight: 600;
	font-size: clamp(0.9rem, 1.25vw, 1.05rem);
	text-align: center;
	width: 100%;
}

@media (max-width: 768px) {
	.vote-selector-buttons .vote-value {
		font-size: 0.95rem;
	}
}

@media (max-width: 480px) {
	.vote-selector-buttons .vote-value {
		font-size: 0.9rem;
	}
}

/* Voting Submit */
.voting-submit {
	margin: 2em 0;
	text-align: center;
}

.voting-submit .button-primary {
	padding: 1em 2em;
	background: #00a32a;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 1.1em;
	font-weight: 600;
	transition: background 0.2s;
}

.voting-submit .button-primary:hover {
	background: #008a20;
}

/* Gallery View (for voters who already voted) */
.images-grid.gallery-view .voting-image-item {
	cursor: default;
}

.images-grid.gallery-view .voting-image-item:hover {
	box-shadow: none;
}

/* Results Display */
.photo-comp-results,
.photo-comp-top3 {
	max-width: 1200px;
	margin: 2em auto;
	padding: 2em;
	background: #f9f9f9;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-sizing: border-box;
}

.photo-comp-results h2,
.photo-comp-top3 h2 {
	margin-top: 0;
	color: #333;
	text-align: center;
	border-bottom: 3px solid #2271b1;
	padding-bottom: 0.5em;
	margin-bottom: 2em;
}

.results-category-section,
.top3-category-section {
	margin: 3em 0;
	padding: 2em;
	background: #fff;
	border: 2px solid #2271b1;
	border-radius: 8px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	box-sizing: border-box;
}

.results-category-section h3,
.top3-category-section h3 {
	margin-top: 0;
	color: #2271b1;
	text-align: center;
	font-size: 1.8em;
	border-bottom: 3px solid #2271b1;
	padding-bottom: 0.5em;
	margin-bottom: 2em;
	background: linear-gradient(135deg, #f0f8ff, #e7f3ff);
	padding: 1em;
	border-radius: 6px;
}

.results-grade-section,
.top3-grade-section {
	margin: 2em 0;
	padding: 1.5em;
	background: #f9f9f9;
	border: 1px solid #ddd;
	border-radius: 6px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
	box-sizing: border-box;
}

.results-grade-section h4,
.top3-grade-section h4 {
	margin-top: 0;
	color: #333;
	text-align: center;
	font-size: 1.3em;
	border-bottom: 2px solid #ddd;
	padding-bottom: 0.5em;
	margin-bottom: 1.5em;
}

/* Results Table */
.results-table {
	overflow-x: auto;
}

.results-table table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 1em;
}

.results-table th,
.results-table td {
	padding: 1em;
	text-align: left;
	border-bottom: 1px solid #ddd;
}

.results-table th {
	background: #f5f5f5;
	font-weight: 600;
	color: #333;
	position: sticky;
	top: 0;
	text-align: center;
}

.results-table tr:hover {
	background: #f9f9f9;
}

.results-table .position {
	text-align: center;
	font-weight: 600;
	font-size: 1.2em;
	color: #2271b1;
	width: 80px;
}

.results-table .image-cell {
	width: 120px;
	text-align: center;
}

.results-table .result-thumbnail {
	max-width: 200px;
	max-height: 200px;
	object-fit: cover;
	border-radius: 4px;
	border: 2px solid #ddd;
}

.results-table .image-number {
	font-size: 0.8em;
	color: #666;
	margin-top: 0.25em;
	position: static;
	background: none;
	padding: 0;
}

.results-table .member-name {
	font-weight: 600;
	color: #333;
}

.results-table .category {
	color: #666;
	font-style: italic;
}

.results-table .score {
	font-weight: 600;
	font-size: 1.1em;
	color: #00a32a;
	text-align: center;
}

/* Top 3 Podium */
.top3-podium {
	display: flex;
	justify-content: center;
	align-items: flex-end;
	gap: 2em;
	margin: 2em 0;
	flex-wrap: wrap;
}

.podium-item {
	background: #fff;
	border: 2px solid #ddd;
	border-radius: 8px;
	padding: 1.5em;
	text-align: center;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	transition: transform 0.2s, box-shadow 0.2s;
	min-width: 200px;
	box-sizing: border-box;
}

.podium-item:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.podium-item.first {
	border-color: #ffd700;
	background: linear-gradient(135deg, #fff9e6, #fff);
	order: 2;
}

.podium-item.second {
	border-color: #c0c0c0;
	background: linear-gradient(135deg, #f8f8f8, #fff);
	order: 1;
}

.podium-item.third {
	border-color: #cd7f32;
	background: linear-gradient(135deg, #fdf4e6, #fff);
	order: 3;
}

.position-badge {
	font-weight: 600;
	font-size: 1.1em;
	margin-bottom: 1em;
	padding: 0.5em 1em;
	border-radius: 20px;
	color: #fff;
}

.first .position-badge {
	background: #ffd700;
	color: #333;
}

.second .position-badge {
	background: #c0c0c0;
	color: #333;
}

.third .position-badge {
	background: #cd7f32;
	color: #fff;
}

.image-container {
	margin: 1em auto;
	position: relative;
	max-width: 150px;
	width: 100%;
}

.podium-thumbnail {
	width: 100%;
	max-width: 400px;
	height: auto;
	object-fit: cover;
	border-radius: 8px;
	border: 2px solid #ddd;
}

/* General image number styling for voting interface and podium */
.voting-image-item .image-number,
.podium-item .image-number {
	position: absolute;
	top: 0.5em;
	left: 0.5em;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	padding: 0.25em 0.75em;
	border-radius: 4px;
	font-weight: 600;
	font-size: 0.9em;
}

.member-info {
	margin-top: 1em;
}

.member-name {
	font-weight: 600;
	font-size: 1.1em;
	color: #333;
	margin-bottom: 0.5em;
}

.category {
	color: #666;
	font-style: italic;
	margin-bottom: 0.5em;
}

.score-info {
	margin-top: 0.5em;
}

.score {
	font-weight: 600;
	font-size: 1.2em;
	color: #00a32a;
}

/* Messages for results */
.photo-comp-results .error,
.photo-comp-results .success,
.photo-comp-results .notice,
.photo-comp-top3 .error,
.photo-comp-top3 .success,
.photo-comp-top3 .notice {
	padding: 1em;
	margin-bottom: 1.5em;
	border-radius: 4px;
}

.photo-comp-results .error,
.photo-comp-top3 .error {
	background: #fef7f8;
	border-left: 4px solid #d63638;
	color: #b32d2e;
}

.photo-comp-results .success,
.photo-comp-top3 .success {
	background: #edfaef;
	border-left: 4px solid #00a32a;
	color: #007017;
}

.photo-comp-results .notice,
.photo-comp-top3 .notice {
	background: #fff8e5;
	border-left: 4px solid #dba617;
	color: #8a6d3b;
}

/* Responsive */
@media (max-width: 768px) {
	.photo-comp-upload,
	.photo-comp-voting,
	.photo-comp-results,
	.photo-comp-top3 {
		padding: 0.5em;
		margin: 1em auto;
	}

	.submissions-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 1em;
	}

	.images-grid {
		grid-template-columns: 1fr;
		gap: 1em;
	}

	.competition-upload-form input[type="email"],
	.competition-upload-form select {
		max-width: 100%;
	}

	.category-selector {
		flex-direction: column;
		align-items: stretch;
	}

	.category-selector select,
	.voter-info input[type="text"] {
		max-width: 100%;
	}

	.results-table {
		font-size: 0.9em;
	}

	.results-table th,
	.results-table td {
		padding: 0.5em;
	}

	/*
	 * Stack each result as a card: position on the left, then the image and
	 * labelled name and score below each other, so nothing is clipped
	 * off the right edge of a phone screen.
	 */
	.results-table {
		overflow-x: visible;
	}

	.results-table table,
	.results-table tbody,
	.results-table td {
		display: block;
		width: 100%;
	}

	.results-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.results-table tr {
		display: grid;
		grid-template-columns: 2.5em minmax(0, 1fr);
		column-gap: 0.75em;
		padding: 0.75em 0;
		border-bottom: 1px solid #ddd;
	}

	.results-table td {
		padding: 0.2em 0;
		border-bottom: 0;
		text-align: left;
	}

	.results-table .position {
		grid-row: span 3;
		width: auto;
	}

	.results-table .image-cell {
		width: auto;
		text-align: left;
	}

	.results-table .result-thumbnail {
		width: 100%;
		max-width: 100%;
		height: auto;
		max-height: none;
	}

	.results-table .score {
		text-align: left;
	}

	.results-table td[data-label]::before {
		content: attr(data-label) ": ";
		font-weight: 400;
		font-size: 0.9rem;
		color: #666;
	}

	.top3-podium {
		flex-direction: column;
		align-items: stretch;
		gap: 1em;
	}

	.podium-item {
		width: 100%;
		min-width: 0;
		margin-bottom: 0;
		padding: 0.75em;
		border-width: 1px;
	}

	.podium-item.first {
		order: 1;
	}

	.podium-item.second {
		order: 2;
	}

	.podium-item.third {
		order: 3;
	}

	.position-badge {
		font-size: 0.9em;
		padding: 0.3em 0.6em;
		margin-bottom: 0.5em;
	}

	.image-container {
		margin: 0.5em auto;
	}

	.member-name {
		font-size: 1em;
	}

	.score {
		font-size: 1.1em;
	}

	.results-category-section,
	.top3-category-section {
		padding: 0.75em;
		margin: 1.5em 0;
	}

	.results-grade-section,
	.top3-grade-section {
		padding: 0.75em;
		margin: 1em 0;
	}

	.top3-category-section h3 {
		font-size: 1.4em;
		padding: 0.75em;
	}

	.top3-grade-section h4 {
		font-size: 1.1em;
	}
}

/* Member page */
.photo-comp-member-page .error,
.photo-comp-member-page .success,
.photo-comp-member-page .notice {
	padding: 1em;
	margin-bottom: 1.5em;
	border-radius: 4px;
}

.photo-comp-member-page .success {
	background: #edfaef;
	border-left: 4px solid #00a32a;
	color: #007017;
}

.photo-comp-member-page .error {
	background: #fef7f8;
	border-left: 4px solid #d63638;
	color: #b32d2e;
}

.photo-comp-member-page .notice {
	background: #fff8e5;
	border-left: 4px solid #dba617;
	color: #8a6d3b;
}

.photo-comp-member-entries {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 1.5em;
}

.photo-comp-member-entry img,
.photo-comp-member-no-image {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.photo-comp-member-no-image {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f0f0f1;
	color: #646970;
	text-align: center;
}

.photo-comp-member-entry-details span {
	display: block;
}

.photo-comp-member-status {
	color: #b32d2e;
}

/* Past competitions archive */
.photo-comp-archive-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.photo-comp-archive-list li {
	padding: 0.5em 0;
	border-bottom: 1px solid #dcdcde;
}

.photo-comp-archive-date {
	margin-left: 0.75em;
	color: #646970;
}


/* Member page: past competitions choices */
.photo-comp-visibility-all {
	margin-bottom: 1.5em;
	padding: 1em;
	background: #f6f7f7;
	border-radius: 4px;
}

.photo-comp-visibility-choice {
	border: 0;
	margin: 0.5em 0 0;
	padding: 0;
}

.photo-comp-visibility-choice label {
	margin-right: 1em;
	cursor: pointer;
}

.photo-comp-visibility-choice input[type="radio"] {
	accent-color: currentColor;
	margin-right: 0.3em;
}

/* Themes outline a focused radio, even after a click. Keep it for the keyboard only, and round. */
.photo-comp-visibility-choice input[type="radio"]:focus:not(:focus-visible) {
	outline: none;
	box-shadow: none;
}

.photo-comp-visibility-choice input[type="radio"]:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 50%;
}

.photo-comp-visibility-status {
	color: #646970;
	font-size: 0.9em;
}

.photo-comp-visibility-off-notice {
	color: #8a6d3b;
}

/* With JavaScript, each choice saves as it changes. */
.photo-comp-member-sort {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 1em;
}

.photo-comp-visibility-js .photo-comp-visibility-save {
	display: none;
}
