/**
 * TFM Multi Location - Public Styles
 *
 * @package TFM_Multi_Location
 */

/* CSS Variables */
:root {
	--tfm-primary: #FF6B35;
	--tfm-secondary: #004E89;
	--tfm-accent: #1A659E;
	--tfm-light: #F7F7F7;
	--tfm-dark: #2C2C2C;
	--tfm-success: #4CAF50;
	--tfm-error: #F44336;
	--tfm-border: #E0E0E0;
	--tfm-shadow: rgba(0, 0, 0, 0.1);
}

/* Location Map Container */
.tfm-ml-map-container {
	width: 100%;
	margin: 20px 0;
}

.tfm-ml-map {
	width: 100%;
	height: 500px;
	border-radius: 8px;
	overflow: hidden;
}

/* Map Info Window */
.tfm-ml-info-window {
	padding: 15px;
	max-width: 300px;
}

.tfm-ml-info-window h3 {
	margin: 0 0 10px 0;
	font-size: 18px;
	color: var(--tfm-dark);
}

.tfm-ml-info-window p {
	margin: 5px 0;
	font-size: 14px;
	color: #666;
}

.tfm-ml-info-window a {
	display: inline-block;
	margin-top: 10px;
	padding: 8px 16px;
	background: var(--tfm-primary);
	color: white;
	text-decoration: none;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	transition: background 0.3s ease;
}

.tfm-ml-info-window a:hover {
	background: var(--tfm-accent);
}

/* Location Search and Filters */
.tfm-ml-search-container {
	background: white;
	padding: 25px;
	border-radius: 8px;
	margin-bottom: 25px;
}

.tfm-ml-search-form {
	display: flex;
	flex-direction: column;
	gap: 15px;
}

.tfm-ml-search-row {
	display: flex;
	gap: 15px;
	align-items: flex-end;
	flex-wrap: wrap;
}

.tfm-ml-search-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
	min-width: 200px;
}

.tfm-ml-search-field.search-input {
	flex: 2;
	min-width: 300px;
}

.tfm-ml-search-field.radius-input {
	flex: 0 0 auto;
	min-width: 120px;
	max-width: 150px;
}

.tfm-ml-search-field label {
	font-weight: 600;
	color: var(--tfm-dark);
	font-size: 14px;
}

.tfm-ml-search-field input,
.tfm-ml-search-field select {
	padding: 12px;
	border: 2px solid var(--tfm-border);
	border-radius: 6px;
	font-size: 15px;
	transition: border-color 0.3s ease;
	width: 100%;
	box-sizing: border-box;
}

.tfm-ml-search-field input:focus,
.tfm-ml-search-field select:focus {
	outline: none;
	border-color: var(--tfm-primary);
}

.tfm-ml-search-buttons {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	flex-shrink: 0;
}

.tfm-ml-search-button {
	padding: 12px 30px;
	background: var(--tfm-primary);
	color: white;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.3s ease;
	white-space: nowrap;
}

.tfm-ml-search-button:hover {
	background: var(--tfm-accent);
}

.tfm-ml-search-button:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.tfm-ml-geolocate-button {
	padding: 12px 20px;
	background: var(--tfm-secondary);
	color: white;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.tfm-ml-geolocate-button:hover {
	background: var(--tfm-accent);
}

.tfm-ml-geolocate-button:disabled {
	background: #ccc;
	cursor: not-allowed;
	opacity: 0.7;
}

/* Loading Spinner for Geolocate Button */
.tfm-ml-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: tfm-spin 0.8s linear infinite;
}

@keyframes tfm-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.tfm-ml-loading .tfm-ml-spinner {
	vertical-align: middle;
	margin-right: 4px;
}

/* Advanced Filters Toggle */
.tfm-ml-filters-toggle {
	margin-top: 15px;
	padding-top: 15px;
	border-top: 1px solid var(--tfm-border);
}

.tfm-ml-filters-toggle button {
	background: transparent;
	border: none;
	color: var(--tfm-primary);
	font-weight: 600;
	cursor: pointer;
	font-size: 14px;
}

.tfm-ml-advanced-filters {
	display: none;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--tfm-border);
}

.tfm-ml-advanced-filters.active {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 15px;
}

/* Location Results List */
.tfm-ml-results-container {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
	margin: 20px 0;
}

.tfm-ml-location-card {
	background: white;
	border-radius: 8px;
	padding: 20px;
	position: relative;
}

/* Featured Location Badge */
.tfm-ml-featured-badge {
	display: inline-block;
	padding: 4px 12px;
	background: #FFD700;
	color: white;
	border-radius: 4px;
	z-index: 10;
}

.tfm-ml-location-card .tfm-ml-featured-badge.badge-top-left {
	position: absolute !important;
	top: 15px !important;
	left: 15px !important;
	transform: none !important;
}

.tfm-ml-location-card .tfm-ml-featured-badge.badge-top-right {
	position: absolute !important;
	top: 15px !important;
	right: 15px !important;
	left: auto !important;
	transform: none !important;
}

.tfm-ml-location-card .tfm-ml-featured-badge.badge-top-center {
	position: absolute !important;
	top: 15px !important;
	left: 50% !important;
	right: auto !important;
	transform: translateX(-50%) !important;
}

.tfm-ml-location-card .tfm-ml-featured-badge.badge-inline {
	position: relative !important;
	vertical-align: middle;
	margin-left: 8px;
}

.tfm-ml-location-card h3 {
	margin: 0 0 15px 0;
	font-size: 20px;
	color: var(--tfm-dark);
}

.tfm-ml-location-card .location-info {
	margin-bottom: 15px;
}

.tfm-ml-location-card .location-info p {
	margin: 8px 0;
	font-size: 14px;
	color: #666;
	display: flex;
	align-items: start;
	gap: 8px;
}

.tfm-ml-location-card .location-info .icon {
	margin-top: 2px;
	flex-shrink: 0;
}

/* Location Field Items with Icons */
.tfm-ml-location-card .location-field-item {
	display: flex;
	align-items: start;
	gap: 10px;
	margin-bottom: 12px;
}

.tfm-ml-location-card .location-field-item:last-child {
	margin-bottom: 0;
}

.tfm-ml-location-card .location-field-item .field-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	margin-top: 2px;
}

.tfm-ml-location-card .location-field-item .field-content {
	flex: 1;
	font-size: 14px;
	color: #666;
	line-height: 1.6;
}

.tfm-ml-location-card .location-field-item .field-label {
	font-weight: 600;
	color: var(--tfm-dark);
}

.tfm-ml-location-card .location-field-item .field-value {
	color: #666;
}

.tfm-ml-location-card .location-field-item .field-value a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s ease;
}

.tfm-ml-location-card .location-field-item .field-value a:hover {
	color: var(--tfm-primary);
}

/* Phone links - inherit color from parent, underline on hover for clarity */
.tfm-ml-location-card .location-field-item .field-value a[href^="tel:"] {
	color: inherit;
}

.tfm-ml-location-card .location-field-item .field-value a[href^="tel:"]:hover {
	color: var(--tfm-primary);
	text-decoration: underline;
}

/* Email links */
.tfm-ml-location-card .location-field-item .field-value a[href^="mailto:"] {
	color: var(--tfm-primary);
}

.tfm-ml-location-card .location-field-item .field-value a[href^="mailto:"]:hover {
	color: var(--tfm-accent);
}

.tfm-ml-location-card .location-distance {
	display: inline-block;
	padding: 4px 10px;
	background: var(--tfm-light);
	border-radius: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--tfm-accent);
	margin-bottom: 10px;
}

.tfm-ml-location-card .location-link {
	display: inline-block;
	padding: 10px 20px;
	background: var(--tfm-primary);
	color: white;
	text-decoration: none;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	transition: background 0.3s ease;
}

.tfm-ml-location-card .location-link:hover {
	background: var(--tfm-accent);
}

/* Map Center Button */
.tfm-ml-center-map {
	position: absolute;
	bottom: 10px;
	right: 10px;
	width: 32px;
	height: 32px;
	background: #007cba;
	color: #ffffff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	transition: all 0.3s ease;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	z-index: 10;
	opacity: 1;
	visibility: visible;
}

/* Position classes */
.tfm-cm-pos-br .tfm-ml-center-map {
	bottom: var(--cm-off-y, 10px);
	right: var(--cm-off-x, 10px);
}

.tfm-cm-pos-bl .tfm-ml-center-map {
	bottom: var(--cm-off-y, 10px);
	left: var(--cm-off-x, 10px);
}

.tfm-cm-pos-tr .tfm-ml-center-map {
	top: var(--cm-off-y, 10px);
	right: var(--cm-off-x, 10px);
}

.tfm-cm-pos-tl .tfm-ml-center-map {
	top: var(--cm-off-y, 10px);
	left: var(--cm-off-x, 10px);
}

.tfm-ml-center-map:hover {
	background: var(--tfm-accent);
	transform: scale(1.1);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.tfm-ml-center-map:active {
	transform: scale(0.95);
}

.tfm-ml-center-map i,
.tfm-ml-center-map svg {
	font-size: 14px;
	width: 14px;
	height: 14px;
	color: inherit;
	fill: currentColor;
	pointer-events: none;
}

/* Loading State */
.tfm-ml-loading {
	text-align: center;
	padding: 40px;
	color: #666;
}

.tfm-ml-loading::after {
	content: '';
	display: inline-block;
	width: 30px;
	height: 30px;
	margin-left: 10px;
	border: 3px solid var(--tfm-border);
	border-top-color: var(--tfm-primary);
	border-radius: 50%;
	animation: tfm-ml-spin 1s linear infinite;
}

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

/* No Results */
.tfm-ml-no-results {
	text-align: center;
	padding: 40px;
	background: var(--tfm-light);
	border-radius: 8px;
	color: #666;
	font-size: 16px;
}


/* Location Gallery Widget */
.tfm-ml-location-gallery {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 15px;
	margin: 20px 0;
}

.tfm-ml-gallery-item {
	position: relative;
	overflow: hidden;
	display: block;
	aspect-ratio: 1 / 1; /* Default fallback, overridden by Elementor */
}

.tfm-ml-gallery-link {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	text-decoration: none;
	overflow: hidden;
}

.tfm-ml-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	flex-shrink: 0;
	transition: all 0.3s ease;
}

/* When lightbox is disabled (no link wrapper) */
.tfm-ml-gallery-item > img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* Hover Overlay */
.tfm-ml-gallery-item::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: transparent;
	opacity: 0;
	transition: opacity 0.3s ease;
	z-index: 1;
	pointer-events: none;
}

.tfm-ml-gallery-link:hover::before {
	opacity: 1;
}

/* Overlay Icon */
.tfm-ml-gallery-overlay-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	opacity: 0;
	transition: opacity 0.3s ease;
	z-index: 2;
	pointer-events: none;
}

.tfm-ml-gallery-link:hover .tfm-ml-gallery-overlay-icon {
	opacity: 1;
}

/* Hover Animation: Zoom In */
.tfm-hover-zoom .tfm-ml-gallery-link:hover img {
	transform: scale(1.1);
}

/* Hover Animation: Zoom Out */
.tfm-hover-zoom-out .tfm-ml-gallery-link:hover img {
	transform: scale(0.9);
}

/* Hover Animation: Fade */
.tfm-hover-opacity .tfm-ml-gallery-link:hover img {
	opacity: 0.7;
}

/* Hover Animation: Grayscale */
.tfm-hover-grayscale img {
	filter: grayscale(100%);
	transition: filter 0.3s ease;
}

.tfm-hover-grayscale .tfm-ml-gallery-link:hover img {
	filter: grayscale(0%);
}

/* Gallery Caption */
.tfm-ml-gallery-caption {
	margin-top: 10px;
	text-align: center;
	font-size: 14px;
}

/* Legacy Gallery Support (for shortcodes) */
.tfm-ml-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 15px;
	margin: 20px 0;
}

.tfm-ml-gallery .tfm-ml-gallery-item {
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	aspect-ratio: 1;
}

.tfm-ml-gallery .tfm-ml-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.tfm-ml-gallery .tfm-ml-gallery-item:hover img {
	transform: scale(1.1);
}

/* Single Location Template */
.tfm-ml-single-location {
	max-width: 1200px;
	margin: 0 auto;
}

.tfm-ml-location-header {
	margin-bottom: 30px;
}

.tfm-ml-location-header h1 {
	font-size: 36px;
	margin-bottom: 15px;
	color: var(--tfm-dark);
}

.tfm-ml-location-details {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
	margin: 30px 0;
}

.tfm-ml-location-info-box {
	background: white;
	padding: 25px;
	border-radius: 8px;
}

.tfm-ml-location-info-box h2 {
	font-size: 24px;
	margin-bottom: 20px;
	color: var(--tfm-dark);
}

/* Pagination */
.tfm-ml-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 10px;
	margin-top: 30px;
	padding: 20px 0;
}

.tfm-ml-pagination .page-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 8px 12px;
	background: white;
	border: 2px solid var(--tfm-border);
	border-radius: 6px;
	color: var(--tfm-dark);
	text-decoration: none;
	font-weight: 600;
	transition: all 0.3s ease;
	cursor: pointer;
	font-size: 14px;
}

.tfm-ml-pagination .page-link:hover {
	background: var(--tfm-primary);
	color: white;
	border-color: var(--tfm-primary);
}

.tfm-ml-pagination .page-link.active {
	background: var(--tfm-primary);
	color: white;
	border-color: var(--tfm-primary);
	cursor: default;
	pointer-events: none;
}

/* Social Media Icons */
.tfm-ml-social-icons {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 5px;
}

.tfm-ml-social-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #f0f0f0;
	transition: all 0.3s ease;
	text-decoration: none;
}

.tfm-ml-social-icon i {
	font-size: 18px;
	transition: color 0.3s ease;
}

.tfm-ml-social-icon:hover {
	transform: translateY(-2px);
}

/* Field Icon Styles */
.tfm-ml-field-with-icon {
	display: flex;
	align-items: center;
	gap: 0;
	flex-wrap: wrap;
}

.tfm-ml-field-icon {
	display: inline-block;
	line-height: 1;
	transition: all 0.3s ease;
	text-align: center;
	flex-shrink: 0;
}

.tfm-ml-field-icon i,
.tfm-ml-field-icon svg {
	width: 1em;
	height: 1em;
	display: block;
	position: relative;
}

/* Icon Outline Style */
.tfm-ml-field-icon.tfm-ml-icon-outline {
	border: 1px solid currentColor;
}

/* Icon Stacked Style - Perfect Square with padding */
.tfm-ml-field-icon.tfm-ml-icon-stacked {
	padding: 0.5em;
	display: inline-block;
	line-height: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
	.tfm-ml-search-form {
		grid-template-columns: 1fr;
	}

	.tfm-ml-location-details {
		grid-template-columns: 1fr;
	}

	.tfm-ml-results-container {
		grid-template-columns: 1fr;
	}

	.tfm-ml-gallery {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	}
}

