/* GeoThirdparty - Map Explorer styles */

.geothirdparty-split {
	display: flex;
	flex-direction: row;
	gap: 12px;
	width: 100%;
	min-height: 75vh;
}

.geothirdparty-left {
	flex: 0 0 35%;
	max-width: 35%;
	min-width: 320px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.geothirdparty-right {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
}

.geothirdparty-filters {
	padding: 10px;
	background: #f7f7f7;
	border-bottom: 1px solid #eee;
}

.geothirdparty-filters .geothirdparty-row {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
	margin-bottom: 6px;
}

.geothirdparty-filters .geothirdparty-row input[type="text"],
.geothirdparty-filters .geothirdparty-row select {
	height: 28px;
	box-sizing: border-box;
}

.geothirdparty-filters .geothirdparty-row a.button,
.geothirdparty-filters .geothirdparty-row a.butAction {
	line-height: 26px;
	padding-top: 0;
	padding-bottom: 0;
	font-size: 0.9em;
}

.geothirdparty-filters input[type="text"] {
	flex: 1 1 150px;
	min-width: 100px;
	padding: 4px 6px;
}

.geothirdparty-filters select {
	padding: 4px 6px;
}

.geothirdparty-filters label {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.9em;
}

.geothirdparty-list {
	flex: 1 1 auto;
	overflow-y: auto;
	max-height: 60vh;
}

.geothirdparty-list table {
	width: 100%;
	border-collapse: collapse;
}

.geothirdparty-list thead th {
	position: sticky;
	top: 0;
	background: #f0f0f0;
	text-align: left;
	padding: 6px 8px;
	border-bottom: 1px solid #ddd;
	font-size: 0.85em;
	z-index: 1;
}

.geothirdparty-list tbody tr {
	cursor: pointer;
	border-bottom: 1px solid #f0f0f0;
}

.geothirdparty-list tbody tr:hover {
	background: #eef5fc;
}

.geothirdparty-list tbody tr.selected {
	background: #d6e9f8;
	font-weight: bold;
}

.geothirdparty-list tbody td {
	padding: 6px 8px;
	vertical-align: top;
	font-size: 0.9em;
}

/* Sentinel element placed at the bottom of the scrollable list. The
   IntersectionObserver fires when this becomes visible, triggering the
   next page to be loaded. Keeping it small and unobtrusive. */
.geothirdparty-list-sentinel {
	height: 1px;
	width: 100%;
	pointer-events: none;
}

.geothirdparty-pagination {
	padding: 6px 10px;
	border-top: 1px solid #eee;
	background: #fafafa;
	font-size: 0.9em;
	display: flex;
	gap: 6px;
	align-items: center;
	flex-wrap: wrap;
}

.geothirdparty-pagination a.button.disabled {
	opacity: 0.5;
	pointer-events: none;
}

.geothirdparty-pagination .geothirdpage-info {
	color: #555;
	font-size: 0.95em;
}

#geothirdparty-page-select {
	display: inline-block;
	padding: 2px 4px;
	border: 1px solid #ccc;
	border-radius: 2px;
	font-size: 0.95em;
	background: #fff;
	min-width: 55px;
}

.geothirdparty-loadmore {
	text-align: center;
	padding: 10px;
	background: #fafafa;
	border-top: 1px solid #eee;
}

.geothirdparty-loadmore .butAction.disabled {
	opacity: 0.5;
	pointer-events: none;
	cursor: not-allowed;
}

.geothirdparty-radius-bar {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 8px 12px;
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

.geothirdparty-radius-bar label {
	font-weight: bold;
}

.geothirdparty-radius-bar select {
	padding: 4px 8px;
}

.geothirdparty-radius-bar .geothirdparty-radius-info {
	margin-left: auto;
	color: #555;
	font-size: 0.9em;
}

.geothirdparty-map {
	flex: 1 1 auto;
	min-height: 500px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #e8eef3;
	min-width: 0;
}

/* Map inside a third-party card tab — full width, no flex needed */
.geothirdparty-map-tab {
	width: 100%;
	height: 500px;
	margin: 10px 0;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #e8eef3;
}

/* Radius bar in tab mode */
.geothirdparty-tab-radius {
	margin-bottom: 6px;
	padding: 4px 0;
}

.geothirdparty-tab-radius label {
	font-weight: bold;
	margin-right: 6px;
}

.geothirdparty-nearby {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 10px;
	display: flex;
	flex-direction: column;
	min-height: 200px;
}

#geothirdparty-nearby-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	position: relative;
	min-height: 120px;
	max-height: 420px;
	overflow-y: auto;
}

#geothirdparty-nearby-body.geothirdparty-nearby-empty {
	justify-content: center;
	align-items: center;
}

.geothirdparty-nearby-empty-inner {
	color: #888;
	font-style: italic;
	padding: 10px;
	text-align: center;
}

.geothirdparty-nearby h3 {
	margin: 0 0 8px 0;
	font-size: 1.05em;
}

.geothirdparty-nearby-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}

.geothirdparty-nearby-header h3 {
	margin: 0;
}

.geothirdparty-nearby-toggle {
	font-size: 0.85em;
	color: #555;
	white-space: nowrap;
	cursor: pointer;
}

.geothirdparty-nearby table {
	width: 100%;
	border-collapse: collapse;
}

/* Scrollable table container — used in geonearby_tab.php for the
   nearby-companies list. Gives a fixed max-height so many rows don't
   stretch the page. */
.geothirdparty-scroll-table {
	max-height: 420px;
	overflow-y: auto;
	overflow-x: auto;
}
.geothirdparty-scroll-table table {
	margin: 0;
}

.geothirdparty-nearby thead th {
	background: #f0f0f0;
	text-align: left;
	padding: 6px 8px;
	border-bottom: 1px solid #ddd;
	font-size: 0.85em;
}

.geothirdparty-nearby tbody td {
	padding: 6px 8px;
	font-size: 0.9em;
	border-bottom: 1px solid #f0f0f0;
}

.geothirdparty-nearby tbody tr {
	cursor: pointer;
}

.geothirdparty-nearby tbody tr:hover {
	background: #f4faff;
}

/* Google Maps / directions button — match Dolibarr's native .butAction
   look exactly. We don't apply that class to avoid clashes with the
   theme's own .butAction rules, but we copy the same visual style here
   using the same CSS variables. */
a.geothirdparty-gmaps-btn,
.geothirdparty-gmaps-btn {
	display: inline-block;
	margin: 0 2px;
	padding: 4px 12px;
	font-weight: bold;
	font-size: 0.95em;
	text-transform: uppercase;
	text-decoration: none;
	/* Use the same variables Dolibarr's .butAction uses. If a theme does
	   not define them, fall back to a neutral light grey. */
	color: var(--textbutaction, #222) !important;
	background: var(--butactionbg, linear-gradient(to bottom, #fdfdfd, #e6e6e6)) !important;
	border: 1px solid #aaa !important;
	border-radius: 3px !important;
	box-shadow: none !important;
	line-height: 1.8em;
	cursor: pointer;
	white-space: nowrap;
}

a.geothirdparty-gmaps-btn:hover,
a.geothirdparty-gmaps-btn:focus,
.geothirdparty-gmaps-btn:hover,
.geothirdparty-gmaps-btn:focus {
	text-decoration: none !important;
	color: var(--textbutaction, #222) !important;
	background: linear-gradient(to bottom, #f0f0f0, #d8d8d8) !important;
	border-color: #888 !important;
}

.geothirdparty-gmaps-btn i {
	margin: 0 4px 0 0;
	color: inherit;
}

.geothirdparty-empty {
	padding: 30px;
	text-align: center;
	color: #888;
	font-style: italic;
}

.geothirdparty-loading {
	text-align: center;
	padding: 12px;
	color: #555;
}

.geothirdparty-error {
	padding: 10px;
	background: #fce4e4;
	color: #842029;
	border: 1px solid #f5c2c7;
	border-radius: 4px;
	margin: 8px 0;
}

.geothirdparty-error-address {
	padding: 10px;
	margin: 8px 12px;
	background: #fff3cd;
	color: #856404;
	border: 1px solid #ffeeba;
	border-radius: 4px;
	font-size: 0.95em;
	word-break: break-all;
}

.geothirdparty-selected-info {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 10px 14px;
	margin: 0;
}

.geothirdparty-selected-info .geothirdparty-selected-info-name {
	font-weight: bold;
	font-size: 1em;
	color: #2c3e50;
	margin-bottom: 2px;
}

.geothirdparty-selected-info .geothirdparty-selected-info-address {
	font-size: 0.9em;
	color: #555;
	word-break: break-all;
}

/* Regen page */
#geothirdparty-regen-results {
	display: flex;
	gap: 20px;
	margin-top: 10px;
}

.geothirdparty-regen-col {
	flex: 1;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 10px 14px;
	min-height: 200px;
}

.geothirdparty-regen-col h3 {
	margin: 0 0 8px 0;
	font-size: 1em;
}

.geothirdparty-regen-list {
	list-style: none;
	padding: 0;
	margin: 0;
	max-height: 500px;
	overflow-y: auto;
}

.geothirdparty-regen-item {
	padding: 8px 10px;
	margin: 4px 0;
	border: 1px solid #e5e5e5;
	background: #fafafa;
	border-radius: 3px;
	font-size: 0.9em;
}

.geothirdparty-regen-addr {
	color: #666;
	font-size: 0.85em;
	display: block;
	margin-left: 8px;
}

.geothirdparty-regen-coords {
	color: #2e7d32;
	font-family: monospace;
	font-size: 0.85em;
}

/* Lists: spacing inside the info-box */
#geothirdparty-regen-results .geothirdparty-regen-list {
	list-style: none;
	padding: 8px 10px;
	margin: 6px 0 0 0;
	max-height: 500px;
	overflow-y: auto;
}

/* Gap between the two list columns */
#geothirdparty-regen-results > tbody > tr > td + td {
	padding-left: 20px !important;
}

/* Override Dolibarr's titlefield width on regen page */
#geothirdparty-regen-progress > tbody > tr > td.titlefield,
#geothirdparty-regen-progress td.titlefield,
.geothirdparty-regen-progress-label {
	width: 1px !important;
	max-width: none !important;
	min-width: 0 !important;
	white-space: nowrap;
	padding-right: 6px !important;
}

.geothirdparty-popup h4 {
	margin: 0 0 4px 0;
	font-size: 1em;
	color: #c0392b;
}

.geothirdparty-popup.geothirdparty-popup-nearby h4 {
	color: #1f6fdc;
}

.geothirdparty-popup .geothirdparty-popup-distance {
	font-weight: bold;
	color: #1f6fdc;
}

.geothirdparty-popup a {
	color: #1f6fdc;
	text-decoration: none;
}

.geothirdparty-popup a:hover {
	text-decoration: underline;
}

/* Google Maps InfoWindow inner styling */
.gm-style .gm-style-iw-c {
	padding: 12px !important;
}

.gm-style .gm-style-iw-d {
	overflow: auto !important;
}

/* Make sure the tab content has the same split layout */
.geothirdparty-tab .geothirdparty-split {
	min-height: 60vh;
}

@media (max-width: 992px) {
	.geothirdparty-split {
		flex-direction: column;
	}
	.geothirdparty-left {
		flex: 1 1 auto;
		max-width: 100%;
		min-width: 0;
	}
}

/* Address update dialog */
.geothirdparty-address-dialog {
	padding: 4px;
}
.geothirdparty-address-dialog em {
	font-size: 0.9em;
	word-break: break-word;
}
