/**
 * Destinations Interactive Map Styles
 *
 * @package Destinations_Map
 * @since 1.0.0
 */

/* Wrapper */
.destinations-map-wrapper {
	max-width: 100%;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
	margin-bottom: 40px;
}

/* Filter Controls */
.destinations-map-filters {
	display: grid;
	grid-template-columns: 1fr auto auto auto;
	gap: 1rem;
	align-items: center;
	padding: 1.5rem;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	margin-bottom: 1rem;
}

.filter-group {
	display: flex;
	align-items: center;
}

.filter-group.filter-search {
	flex: 1;
}

.filter-group input[type="text"] {
	width: 100%;
	padding: 0.625rem 1rem;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 0.875rem;
	background-color: white;
	transition: border-color 0.15s ease-in-out;
}

.filter-group input[type="text"]::placeholder {
	color: #9ca3af;
}

.filter-group input[type="text"]:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-group select {
	min-width: 200px;
	padding: 0.625rem 2.5rem 0.625rem 1rem;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 0.875rem;
	background-color: white;
	cursor: pointer;
	transition: border-color 0.15s ease-in-out;
}

.filter-group select:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.apply-filters-btn {
	padding: 0.625rem 2rem;
	background: #3b82f6;
	color: white;
	border: none;
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease-in-out;
	white-space: nowrap;
}

.apply-filters-btn:hover {
	background: #2563eb;
}

.apply-filters-btn:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Destination Count */
.destinations-count {
	padding: 0.75rem 0;
	color: #6b7280;
	font-size: 0.875rem;
	font-weight: 500;
}

/* Content Wrapper - Side by Side Layout on Desktop */
.destinations-content-wrapper {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
	align-items: start;
}

@media (min-width: 1024px) {
	.destinations-content-wrapper {
		grid-template-columns: 3fr 2fr;
	}
}

/* Map Container */
.destinations-map-container {
	position: relative;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 0;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
	height: 700px;
}

#destinations-map {
	width: 100%;
}

/* Reset View Button */
.reset-view-btn {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 1000;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	background: white;
	color: #374151;
	border: 2px solid rgba(0, 0, 0, 0.2);
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
	transition: all 0.15s ease-in-out;
}

.reset-view-btn:hover {
	background: #f9fafb;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.reset-view-btn:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.reset-view-btn svg {
	width: 20px;
	height: 20px;
}

/* Loading Spinner */
.map-loading {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.95);
	z-index: 2000;
}

.spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #e5e7eb;
	border-top-color: #3b82f6;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

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

.map-loading p {
	margin-top: 1rem;
	color: #6b7280;
	font-size: 0.875rem;
}

.error-message {
	color: #dc2626;
	font-weight: 500;
}

/* Map Legend */
.map-legend {
	position: absolute;
	bottom: 20px;
	right: 10px;
	background: white;
	padding: 1rem;
	border-radius: 6px;
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
	z-index: 1000;
	min-width: 180px;
}

.map-legend h4 {
	margin: 0 0 0.75rem 0;
	font-size: 0.875rem;
	font-weight: 600;
	color: #374151;
}

.legend-items {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.legend-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.813rem;
	color: #4b5563;
}

.legend-marker {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid white;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	flex-shrink: 0;
}

/* Map Scroll Hint */
.map-scroll-hint {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 2000;
	padding: 0.75rem 1.5rem;
	background: rgba(0, 0, 0, 0.85);
	color: white;
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 500;
	pointer-events: none;
	animation: fadeIn 0.2s ease-in-out;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.map-scroll-hint.fade-out {
	animation: fadeOut 0.3s ease-in-out;
	opacity: 0;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translate(-50%, -50%) scale(0.9);
	}
	to {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
	}
}

@keyframes fadeOut {
	from {
		opacity: 1;
	}
	to {
		opacity: 0;
	}
}

/* Custom Markers */
.photo-marker-wrapper,
.standard-marker-wrapper {
	background: transparent;
	border: none;
}

.photo-marker {
	width: 50px;
	height: 50px;
	border-radius: 50%;
	border: 3px solid;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	transition: transform 0.2s ease-in-out;
}

.photo-marker:hover {
	transform: scale(1.1);
}

.photo-marker img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
	border-radius: 8px;
	padding: 0;
	overflow: hidden;
}

.leaflet-popup-content {
	margin: 0;
	min-width: 250px;
	max-width: 300px;
}

/* Make close button (X) more visible */
.leaflet-popup-close-button {
	color: #111827 !important;
	font-size: 24px !important;
	font-weight: 700 !important;
	padding: 4px 8px !important;
	opacity: 0.7;
}

.leaflet-popup-close-button:hover {
	color: #000000 !important;
	opacity: 1;
}

.destination-popup {
	font-family: inherit;
}

.popup-image {
	width: 100%;
	height: 150px;
	overflow: hidden;
}

.popup-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.popup-title {
	margin: 1rem 1rem 0.5rem;
	font-size: 1.125rem;
	font-weight: 600;
	color: #111827;
	line-height: 1.3;
}

.popup-date {
	margin: 0.3em 0 !important;
	padding: 0 1rem;
	font-size: 0.875rem;
	color: #6b7280;
}

.popup-status {
	display: none;
}

.popup-link {
	display: block;
	margin: 1rem;
	padding: 0.5rem 1rem;
	background: #3b82f6;
	color: white !important;
	text-align: center;
	text-decoration: none;
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 500;
	transition: background-color 0.15s ease-in-out;
}

.popup-link:hover {
	background: #2563eb;
	color: white !important;
}

/* Destinations List */
.destinations-list-wrapper {
	margin-top: 0;
}

.destinations-list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
	margin-bottom: 2rem;
}

.destination-item {
	display: flex;
	gap: 1rem;
	padding: 1rem;
	background: white;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.15s ease-in-out;
}

.destination-item:hover,
.destination-item:focus {
	border-color: #3b82f6;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	outline: none;
	transform: translateY(-2px);
}

.item-thumbnail {
	width: 80px;
	height: 80px;
	border-radius: 6px;
	overflow: hidden;
	flex-shrink: 0;
	background: #f3f4f6;
}

.item-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.item-thumbnail.no-image {
	background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
}

.item-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.item-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	color: #111827;
	line-height: 1.3;
}

.item-date {
	margin: 0;
	font-size: 0.875rem;
	color: #6b7280;
}

.item-link {
	color: #3b82f6;
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 500;
	margin-top: auto;
	align-self: flex-start;
}

.item-link:hover {
	text-decoration: underline;
}

.no-results {
	grid-column: 1 / -1;
	text-align: center;
	padding: 3rem;
	color: #6b7280;
	font-size: 1rem;
}

/* List Loading Skeleton */
.list-loading {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 1.5rem;
}

.skeleton-item {
	height: 120px;
	background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
	background-size: 200% 100%;
	animation: loading 1.5s infinite;
	border-radius: 8px;
}

@keyframes loading {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* Pagination */
.destinations-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 2rem;
	flex-wrap: wrap;
}

.page-btn {
	padding: 0.5rem 1rem;
	background: white;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s ease-in-out;
}

.page-btn:hover:not(:disabled) {
	background: #f9fafb;
	border-color: #9ca3af;
}

.page-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.page-btn:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.page-numbers {
	display: flex;
	gap: 0.25rem;
	align-items: center;
}

.page-number {
	min-width: 40px;
	padding: 0.5rem;
	background: white;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s ease-in-out;
}

.page-number:hover {
	background: #f9fafb;
	border-color: #9ca3af;
}

.page-number.active {
	background: #3b82f6;
	border-color: #3b82f6;
	color: white;
}

.page-number:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.page-ellipsis {
	padding: 0 0.25rem;
	color: #9ca3af;
}

.page-info {
	text-align: center;
	margin-top: 1rem;
	color: #6b7280;
	font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1023px) {
	.destinations-content-wrapper {
		grid-template-columns: 1fr;
	}

	.destinations-map-container {
		height: 500px;
		margin-bottom: 2rem;
	}
}

@media (max-width: 768px) {
	.destinations-map-filters {
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}

	.filter-group input[type="text"],
	.filter-group select {
		width: 100%;
		min-width: auto;
	}

	.apply-filters-btn {
		width: 100%;
	}

	.destinations-list {
		grid-template-columns: 1fr;
	}

	.destinations-map-container {
		height: 400px;
	}

	.reset-view-btn span {
		display: none;
	}

	.reset-view-btn {
		padding: 0.5rem;
	}

	.map-legend {
		right: 10px;
		bottom: 10px;
		font-size: 0.75rem;
	}

	.leaflet-popup-content {
		min-width: 200px;
	}

	.destinations-pagination {
		gap: 0.25rem;
	}

	.page-btn {
		padding: 0.5rem 0.75rem;
		font-size: 0.813rem;
	}

	.page-number {
		min-width: 36px;
		font-size: 0.813rem;
	}
}

@media (max-width: 480px) {
	.destination-item {
		flex-direction: column;
	}

	.item-thumbnail {
		width: 100%;
		height: 150px;
	}
}
