.cdw-map-wrap {
	margin: 1.5em 0;
}

.cdw-leaflet-map {
	width: 100%;
	border-radius: 6px;
	border: 1px solid #d0d7de;
	z-index: 0;
}

.cdw-members-notice {
	background: #fff3cd;
	border: 1px solid #ffe69c;
	color: #664d03;
	padding: 8px 12px;
	border-radius: 4px;
	font-size: 0.9em;
	margin-bottom: 10px;
}

.cdw-marker-icon span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	font-size: 18px;
	background: #fff;
	border: 2px solid #0b5394;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Cluster circles (grouped pins at lower zoom levels) - styled in the
   plugin's own blue rather than the clustering library's default
   yellow/green/orange, so they read as part of the same map, and sized
   in three steps so a cluster of hundreds visually reads as "bigger"
   than a cluster of a handful. */
.cdw-cluster-icon {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #0b5394;
	color: #fff;
	font-weight: 700;
	border-radius: 50%;
	border: 3px solid rgba(11, 83, 148, 0.35);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.cdw-cluster-small {
	font-size: 12px;
}

.cdw-cluster-medium {
	font-size: 14px;
}

.cdw-cluster-large {
	font-size: 16px;
}

/* Everything below assumes this 14px base and sizes itself in em relative
   to it. Popups render as normal page content, so without an explicit
   font-size/line-height/color here, headings and paragraphs silently pick
   up whatever size the active theme uses for h3/p anywhere else on the
   site (which on some themes is very large, or a bold accent colour) -
   this reset is what keeps the popup looking the same regardless of theme. */
.cdw-popup {
	font-size: 14px;
	line-height: 1.45;
	color: #222;
}

.cdw-popup h3 {
	margin: 0 0 4px;
	font-size: 1.2em;
	line-height: 1.3;
	font-weight: 700;
	color: #1a1a1a;
}

/* Badges (Type/Status/Public-Private) sit on their own row at the very
   top of the popup, right-aligned - reads as a "top right" corner rather
   than being crammed onto the title's own line, and gives them the whole
   popup width to lay out in without fighting the title for space. The
   title comes second and wraps onto a further line if it's genuinely too
   long, rather than being squeezed or truncated. */
.cdw-popup-header {
	margin: 0 0 4px;
}

.cdw-popup-header h3 {
	margin: 0;
	white-space: normal;
	overflow-wrap: break-word;
	word-break: break-word;
}

.cdw-popup-badges {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 3px;
	margin: 0 0 3px;
}

.cdw-badge {
	display: inline-block;
	padding: 2px 5px;
	border-radius: 10px;
	font-size: 0.6em;
	font-weight: 700;
	line-height: 1.6;
	text-transform: uppercase;
	letter-spacing: 0.01em;
	white-space: nowrap;
}

.cdw-badge-type {
	background: #eaf1fb;
	color: #0b5394;
}

.cdw-badge-status {
	background: #fff;
	border: 1px solid;
}

.cdw-badge-public {
	background: #e6f4ea;
	color: #1e7e34;
}

.cdw-badge-private {
	background: #f1f1f1;
	color: #666;
}

.cdw-popup p {
	margin: 0 0 8px;
	font-size: 1em;
	line-height: 1.45;
}

.cdw-popup-type {
	font-size: 0.85em;
	color: #555;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin: 0 0 8px;
}

.cdw-popup-image {
	width: 100%;
	max-width: 260px;
	height: auto;
	border-radius: 4px;
	margin-bottom: 6px;
}

.cdw-approx-note {
	font-style: italic;
	color: #777;
	font-size: 0.85em;
}

/* Position box - decimal degrees and DDM (degrees + decimal minutes) shown
   side by side, since different apps need different formats: decimal
   pastes straight into Google Maps and most web maps, DDM is what marine
   chartplotter apps like Navionics need when you search/enter a position
   manually (their search box doesn't recognise plain decimal degrees). */
.cdw-popup-position {
	background: #f4f6f8;
	border: 1px solid #e1e6ea;
	border-radius: 6px;
	padding: 8px 10px;
	margin: 6px 0;
}

.cdw-popup-position-label {
	margin: 0 0 4px;
	font-weight: 600;
	font-size: 0.85em;
	color: #333;
}

.cdw-popup-position-row {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin: 2px 0;
	font-size: 0.9em;
}

.cdw-popup-position-tag {
	flex: 0 0 58px;
	font-size: 0.85em;
	font-weight: 600;
	color: #0b5394;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.cdw-popup-position-value {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color: #222;
}

.cdw-popup-tide-link {
	margin: 8px 0 0;
	padding-top: 6px;
	border-top: 1px dashed #d0d7de;
	font-size: 1em;
}

.cdw-popup-tide-link a {
	color: #0b5394;
	font-weight: 600;
	font-size: 1em;
	text-decoration: none;
}

.cdw-popup-tide-link a:hover {
	text-decoration: underline;
}

/* Short attribution line ("Source: Wrecksite.eu" etc.) shown just above the
   description - a citation, not part of the wreck's own history text.
   Kept slightly smaller than body text (it's a citation, not content) but
   close enough in size/contrast to the 14px base that it doesn't read as
   an afterthought next to it. */
.cdw-popup-source {
	color: #444;
	font-size: 0.9em;
	font-style: italic;
}

.cdw-popup {
	/* Matches the maxWidth passed to bindPopup() in public-map.js - Leaflet's
	   own popup maxWidth option (default 300) governs the actual popup
	   container width and takes priority over this CSS regardless of what
	   it says, so the two need to be kept in sync or this has no effect. */
	max-width: 340px;
	max-height: 420px;
	overflow-y: auto;
}

/* Members map description is raw post content (apply_filters('the_content'))
   and can carry its own p/list/heading/link/bold/italic tags from the WP
   editor - without these rules those tags fall through to the theme's own
   styling (the same bleed-through bug as the h3 fix above), which is what
   made "British, cargo ship, 3681 tons..." render like a heading. Sized in
   em relative to .cdw-popup's controlled 14px base, not the theme. */
.cdw-popup-description-label {
	margin: 4px 0 4px;
	font-weight: 600;
	font-size: 0.85em;
	color: #333;
}

.cdw-popup-description {
	font-size: 1em;
	line-height: 1.45;
	color: #222;
}

.cdw-popup-description p {
	margin: 0 0 8px;
	font-size: 1em;
	line-height: 1.45;
}

.cdw-popup-description p:last-child {
	margin-bottom: 0;
}

.cdw-popup-description ul,
.cdw-popup-description ol {
	margin: 0 0 8px;
	padding-left: 1.2em;
	font-size: 1em;
}

.cdw-popup-description a {
	color: #0b5394;
}

.cdw-popup-description h1,
.cdw-popup-description h2,
.cdw-popup-description h3,
.cdw-popup-description h4,
.cdw-popup-description h5,
.cdw-popup-description h6 {
	font-size: 1.05em;
	line-height: 1.3;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 6px;
}

.cdw-popup-description strong,
.cdw-popup-description b {
	font-weight: 700;
}

.cdw-popup-description em,
.cdw-popup-description i {
	font-style: italic;
}

.cdw-map-search {
	position: relative;
	margin-bottom: 8px;
}

.cdw-map-search-input {
	width: 100%;
	max-width: 360px;
	box-sizing: border-box;
	padding: 6px 10px;
	border: 1px solid #d0d7de;
	border-radius: 4px;
	font-size: 0.95em;
}

/* Shown instead of jumping straight to a wreck when the search box is
   given something that parses as a position (see parseCoordinateInput()
   in public-map.js) rather than a name - reuses the same
   status/list/goto/dist styling as the "Nearest to me" panel further
   down, since it's the same "ranked list of nearby wrecks" pattern. */
/* Floats over whatever's below (filter bar, map) like a dropdown, rather
   than sitting in normal document flow and shoving that content down the
   page every time someone searches a position - capped height with its
   own scrollbar once there are more than a handful of results, instead of
   just growing into one long solid block. */
.cdw-map-search-results {
	position: absolute;
	z-index: 500;
	top: 100%;
	left: 0;
	right: 0;
	max-width: 360px;
	max-height: 260px;
	overflow-y: auto;
	margin: 4px 0 0;
	padding: 8px;
	border: 1px solid #d0d7de;
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Type / Location / Era / Protection filter bar above each map. */
.cdw-map-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 10px;
	margin-bottom: 10px;
	padding: 10px 12px;
	border: 1px solid #d0d7de;
	border-radius: 6px;
	background: #f8f9fa;
}

.cdw-filter-field {
	display: flex;
	flex-direction: column;
	font-size: 0.85em;
	gap: 3px;
}

.cdw-filter-label {
	font-weight: 600;
	color: #333;
}

.cdw-filter-select {
	padding: 5px 8px;
	border: 1px solid #b7bec6;
	border-radius: 4px;
	font-size: 0.95em;
	min-width: 140px;
	background: #fff;
}

.cdw-filter-reset {
	padding: 6px 12px;
	border: 1px solid #b7bec6;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	font-size: 0.85em;
	align-self: flex-end;
}

.cdw-filter-reset:hover {
	background: #eef1f3;
}

.cdw-filter-count {
	font-size: 0.85em;
	color: #555;
	align-self: center;
}

.cdw-nearest-me-btn {
	padding: 6px 12px;
	border: 1px solid #0b5394;
	border-radius: 4px;
	background: #0b5394;
	color: #fff;
	cursor: pointer;
	font-size: 0.85em;
	align-self: flex-end;
	margin-left: auto;
}

.cdw-nearest-me-btn:hover {
	background: #093f70;
}

.cdw-nearest-me-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

.cdw-nearest-me-results {
	margin: -4px 0 10px;
	padding: 10px 12px;
	border: 1px solid #d0d7de;
	border-top: none;
	border-radius: 0 0 6px 6px;
	background: #fff;
}

.cdw-nearest-me-status {
	margin: 0 0 6px;
	font-size: 0.9em;
	color: #555;
}

.cdw-nearest-me-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cdw-nearest-me-goto {
	width: 100%;
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 8px;
	border: 1px solid #e1e6ea;
	border-radius: 4px;
	background: #f8f9fa;
	cursor: pointer;
	font-size: 0.9em;
	text-align: left;
}

.cdw-nearest-me-goto:hover {
	background: #eef1f3;
}

.cdw-nearest-me-dist {
	color: #0b5394;
	font-weight: 600;
	white-space: nowrap;
}

/* Dive-permission warning banner near the top of a marker popup. */
.cdw-popup-flag {
	padding: 6px 8px;
	border-radius: 4px;
	font-size: 0.85em;
	margin: 4px 0 8px;
}

.cdw-popup-flag-permission {
	background: #fff3cd;
	border: 1px solid #ffe69c;
	color: #664d03;
}

.cdw-popup-flag-no-dive {
	background: #f8d7da;
	border: 1px solid #f1aeb5;
	color: #58151c;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.cdw-popup-members {
	max-width: 340px;
}

.cdw-popup-gallery {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 4px 0;
}

.cdw-popup-gallery img {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 3px;
}

.cdw-dive-log-entry {
	border-top: 1px dashed #ccc;
	padding-top: 6px;
	margin-top: 6px;
	font-size: 0.9em;
}

/* Front-end dive report submission form ([cdw_dive_report]) and the "Plan
   a Dive" request form ([cdw_dive_request_form]) share this same styling -
   same look/field pattern, so they're styled together rather than
   duplicating every rule under a second class name. Deliberately no
   max-width here (same as .cdw-leaflet-map above) so it fills the same
   width as the map, rather than looking narrower next to it. */
.cdw-dive-report-form,
.cdw-dive-request-form {
	width: 100%;
	box-sizing: border-box;
	background: #fff;
	border: 1px solid #d0d7de;
	border-radius: 8px;
	padding: 20px 24px;
	margin: 1.5em 0;
	font-size: 1.05em;
}

.cdw-dive-report-form label,
.cdw-dive-request-form label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

.cdw-dive-report-form input[type="text"],
.cdw-dive-report-form input[type="date"],
.cdw-dive-report-form input[type="url"],
.cdw-dive-report-form input[type="file"],
.cdw-dive-report-form select,
.cdw-dive-report-form textarea,
.cdw-dive-request-form input[type="text"],
.cdw-dive-request-form input[type="date"],
.cdw-dive-request-form input[type="email"],
.cdw-dive-request-form textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	font-size: 1em;
	border: 1px solid #b7bec6;
	border-radius: 4px;
}

/* Each field gets its own clearly bordered box, so it's obvious where one
   field ends and the next begins, and where input is expected. */
.cdw-dr-field {
	border: 1px solid #d8dce1;
	border-radius: 6px;
	padding: 10px 14px;
	margin-bottom: 14px;
	background: #fafbfc;
}

.cdw-dr-field:focus-within {
	border-color: #0b5394;
	background: #fff;
}

.cdw-dive-report-row,
.cdw-dive-request-row {
	display: flex;
	gap: 14px;
	flex-wrap: wrap;
}

.cdw-dive-report-row .cdw-dr-field,
.cdw-dive-request-row .cdw-dr-field {
	flex: 1 1 150px;
}

.cdw-dive-report-intro,
.cdw-dive-request-intro {
	background: #eef4fb;
	border: 1px solid #cfe0f2;
	border-radius: 6px;
	padding: 10px 14px;
	margin: 0 0 16px;
	font-size: 1em;
}

.cdw-dr-required {
	color: #b32d2e;
	font-weight: 400;
	font-size: 0.85em;
}

.cdw-dive-report-submit-row,
.cdw-dive-request-submit-row {
	margin: 20px 0 0;
	text-align: center;
}

/* Deliberately NOT relying on WordPress's "button"/"button-primary"
   classes here - those only get their look from wp-admin's core CSS,
   which isn't loaded on the front end, so the button would otherwise
   render as a small, unstyled native button and be easy to miss. This
   needs to be big and unmistakable, especially for members less used to
   filling in forms on a computer. */
.cdw-dive-report-submit,
.cdw-dive-request-submit {
	display: inline-block;
	width: 100%;
	max-width: 420px;
	padding: 18px 24px;
	font-size: 1.3em;
	font-weight: 700;
	color: #fff;
	background: #1a6b32;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.cdw-dive-report-submit:hover,
.cdw-dive-request-submit:hover {
	background: #145326;
}

.cdw-dive-report-submit:focus,
.cdw-dive-request-submit:focus {
	outline: 3px solid #8fc9a0;
	outline-offset: 2px;
}

.cdw-dive-report-submit:active,
.cdw-dive-request-submit:active {
	background: #0f3f1c;
}

/* Honeypot field on the dive request form - visually hidden but still
   present/focusable in the DOM (real screen-reader-only hiding, not
   display:none, so it doesn't get flagged as fake by simple bot heuristics
   that check for that) so a bot filling every field trips it while a real
   visitor never sees or touches it. */
.cdw-dr-hp {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.cdw-dive-report-empty {
	padding: 10px 14px;
	background: #f8f9fa;
	border: 1px solid #d0d7de;
	border-radius: 6px;
}

.cdw-dive-log-source-badge {
	display: inline-block;
	font-size: 0.8em;
	font-weight: 600;
	color: #6b4a00;
	background: #fff3cd;
	border: 1px solid #ffe69c;
	border-radius: 4px;
	padding: 2px 6px;
	margin: 2px 0 4px;
}

.cdw-dive-report-notice,
.cdw-dr-notice {
	padding: 10px 14px;
	border-radius: 4px;
	margin-bottom: 14px;
}

.cdw-notice-success {
	background: #d4edda;
	border: 1px solid #badbcc;
	color: #0f5132;
}

.cdw-notice-error {
	background: #f8d7da;
	border: 1px solid #f5c2c7;
	color: #842029;
}

/* "Download GPX" / "Report a problem" row at the bottom of every popup. */
.cdw-popup-actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin: 10px 0 4px;
	padding-top: 8px;
	border-top: 1px solid #e1e6ea;
}

.cdw-popup-actions button {
	flex: 1 1 auto;
	padding: 6px 8px;
	font-size: 0.8em;
	border: 1px solid #b7bec6;
	border-radius: 4px;
	background: #f8f9fa;
	cursor: pointer;
	white-space: nowrap;
}

.cdw-popup-actions button:hover {
	background: #eef1f3;
}

.cdw-flag-form {
	margin: 6px 0 2px;
	padding: 8px;
	background: #fafbfc;
	border: 1px solid #e1e6ea;
	border-radius: 4px;
}

.cdw-flag-form textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 6px 8px;
	font-size: 0.85em;
	border: 1px solid #b7bec6;
	border-radius: 4px;
	margin-bottom: 6px;
	resize: vertical;
}

/* Honeypot field - kept in the tab/DOM flow so a bot filling every input
   still catches it, but invisible and unreachable to a real visitor. */
.cdw-flag-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.cdw-flag-form .cdw-flag-submit {
	padding: 6px 10px;
	font-size: 0.8em;
	border: 1px solid #0b5394;
	border-radius: 4px;
	background: #0b5394;
	color: #fff;
	cursor: pointer;
}

.cdw-flag-form .cdw-flag-submit:hover {
	background: #093f70;
}

.cdw-flag-form .cdw-flag-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

.cdw-flag-status {
	margin-left: 8px;
	font-size: 0.8em;
	color: #777;
}

.cdw-flag-thanks {
	margin: 0;
	font-size: 0.85em;
	color: #0f5132;
}

/* [cdw_wreck_list] / [cdw_wreck_list_members] sortable table. */
.cdw-list-wrap {
	margin: 1.5em 0;
}

.cdw-list-search {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
	flex-wrap: wrap;
}

.cdw-list-search-input {
	flex: 1 1 260px;
	max-width: 360px;
	box-sizing: border-box;
	padding: 6px 10px;
	border: 1px solid #d0d7de;
	border-radius: 4px;
	font-size: 0.95em;
}

.cdw-list-count {
	font-size: 0.85em;
	color: #555;
}

.cdw-list-table-wrap {
	overflow-x: auto;
	border: 1px solid #d0d7de;
	border-radius: 6px;
}

.cdw-list-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92em;
}

.cdw-list-table th,
.cdw-list-table td {
	padding: 8px 10px;
	text-align: left;
	border-bottom: 1px solid #e1e6ea;
	white-space: nowrap;
}

.cdw-list-table thead th {
	background: #f8f9fa;
	font-weight: 600;
	position: sticky;
	top: 0;
}

.cdw-list-table tbody tr:hover {
	background: #f8f9fa;
}

.cdw-list-title {
	font-weight: 600;
	white-space: normal;
}

.cdw-list-sortable {
	cursor: pointer;
	user-select: none;
}

.cdw-list-sortable:hover {
	background: #eef1f3;
}

.cdw-list-sortable::after {
	content: '';
	display: inline-block;
	width: 0.7em;
	margin-left: 4px;
	opacity: 0.35;
}

.cdw-list-sort-asc::after {
	content: '▲';
	opacity: 1;
}

.cdw-list-sort-desc::after {
	content: '▼';
	opacity: 1;
}

.cdw-list-empty {
	padding: 16px;
	text-align: center;
	color: #666;
}
