/* ---------------- Security & Insurance page ---------------- */

.moss-si-page { padding: 32px 0 0; }

.moss-si-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 28px;
	border-bottom: 1px solid #e5e7eb;
	margin-bottom: 32px;
}
.moss-si-tab {
	position: relative;
	padding: 0 0 14px;
	font-size: 14px;
	font-weight: 500;
	color: #94a3b8;
	white-space: nowrap;
}
.moss-si-tab::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -1px;
	width: 100%;
	height: 2px;
	background: var(--moss-orange);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.25s ease;
}
.moss-si-tab.is-active { color: #0f172a; font-weight: 700; }
.moss-si-tab.is-active::after { transform: scaleX(1); }

.moss-si-section { scroll-margin-top: 24px; margin-bottom: 40px; }

.moss-si-pending {
	color: #b7791f;
	background: #fdf3e0;
	border: 1px dashed #e0b168;
	border-radius: 8px;
	padding: 14px 16px;
	font-size: 13.5px;
}

.moss-si-title {
	font-size: 26px;
	font-weight: 800;
	letter-spacing: 0.02em;
	color: #0f172a;
	margin: 0 0 20px;
}

/* ---- บริการฉุกเฉิน (Security) ---- */

.moss-si-emergency-title {
	font-size: 20px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 20px;
}

.moss-si-filter-bar {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 18px 20px;
	margin-bottom: 20px;
}
.moss-si-filter-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 12.5px;
	color: #64748b;
}
.moss-si-filter-field select,
.moss-si-filter-field input {
	width: 100%;
	height: 40px;
	box-sizing: border-box;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 0 12px;
	font-family: inherit;
	font-size: 13.5px;
	color: #1f2937;
	background: #fff;
	outline: none;
}
.moss-si-filter-search { position: relative; display: block; }
.moss-si-filter-search input { padding-right: 38px; }
.moss-si-filter-search button {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	color: var(--moss-blue);
	display: flex;
	padding: 6px;
}

.moss-si-view-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}
.moss-si-region-label {
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
}
.moss-si-view-toggle {
	display: flex;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	overflow: hidden;
}
.moss-si-view-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	background: #fff;
	border: none;
	padding: 8px 14px;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	color: #475569;
	cursor: pointer;
}
.moss-si-view-btn + .moss-si-view-btn { border-left: 1px solid #cbd5e1; }
.moss-si-view-btn.is-active { background: var(--moss-blue); color: #fff; }

.moss-si-map-view {
	display: grid;
	/* 356px to match the sidebar card's own Figma width spec (confirmed
	   2026-10-03) so each card fills the column edge-to-edge. */
	grid-template-columns: 1fr 356px;
	gap: 16px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 16px;
	margin-bottom: 40px;
}
.moss-si-map-view[hidden] { display: none; }
.moss-si-map-frame {
	/* Only the left corners are rounded, matching the Figma spec exactly
	   (top-left/bottom-left 10px, right corners square) - confirmed
	   2026-10-03. */
	border-radius: 10px 0 0 10px;
	overflow: hidden;
	min-height: 606px;
}
.moss-si-map-frame iframe {
	width: 100%;
	height: 100%;
	min-height: 606px;
	border: 0;
	display: block;
}
.moss-si-google-map { width: 100%; height: 100%; min-height: 606px; }
/* The InfoWindow card shown on a marker click or from the sidebar list
   (see mossSiPopupContent() in mgw-security-insurance.js) - confirmed
   2026-10-03. Google's own InfoWindow chrome already renders a white,
   shadowed, rounded bubble with a downward tail, so this only styles our
   own content inside it; .gm-style-iw-* below trims Google's default
   padding so that content can sit flush. */
.moss-si-popup {
	display: flex;
	width: 260px;
}
.moss-si-popup-thumb {
	flex-shrink: 0;
	width: 90px;
	min-height: 90px;
	background-color: #94a3b8;
	background-size: cover;
	background-position: center;
}
.moss-si-popup-body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 8px;
	padding: 10px;
	min-width: 0;
}
.moss-si-popup-name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: #1f2937;
	text-decoration: none;
}
.moss-si-popup-name:hover { text-decoration: underline; }
.moss-si-popup-badges { display: flex; }
.moss-si-popup-badge img { width: 10px; height: 10px; }
.gm-style-iw-d { overflow: hidden !important; }
.gm-style-iw-c { padding: 0 !important; border-radius: 10px !important; }
/* Hides Google's own close "X" control, matching the design exactly -
   confirmed 2026-10-03. Undocumented internal class (Google could rename
   it in a future Maps JS API release, in which case the X would just
   reappear rather than break anything) - the popup can still be
   dismissed by clicking elsewhere on the map or another marker/item.
   .gm-style-iw-chrome is the bar Google reserves ABOVE the content purely
   to hold that close button - hiding just the button left its space
   behind as a gap above the photo, so the whole bar needs hiding too. */
.gm-ui-hover-effect { display: none !important; }
.gm-style-iw-chrome { display: none !important; }
/* A second, separate empty element Google still renders alongside
   .gm-style-iw-chrome - confirmed 2026-10-03, also needs hiding or it
   keeps reserving its own sliver of space above the content. */
.gm-style-iw-ch { display: none !important; }
.moss-si-map-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-height: 606px;
	overflow-y: auto;
	/* Keeps the scrollbar off the cards' own shadow/edge, matching the
	   design's visible scrollbar sitting in its own gutter - confirmed
	   2026-10-03. */
	padding-right: 4px;
}
/* Hidden by the filter bar (mossSiApplyFilters() in
   mgw-security-insurance.js) toggling the `hidden` attribute - needs this
   explicit override because [hidden]'s UA-stylesheet `display: none` has
   the same specificity as this class's own `display: flex` below, so
   source order alone would let this rule win and leave filtered-out
   items visible - confirmed 2026-10-03. */
.moss-si-map-item[hidden], .moss-si-place-card[hidden] { display: none; }
.moss-si-map-item {
	display: flex;
	flex-shrink: 0;
	/* Fixed card size, matching the Figma spec exactly (356x144, 10px
	   radius, white, 0/4/10/0 #000 10% shadow) - confirmed 2026-10-03.
	   Reverted from a brief attempt at stretching cards to fill the map's
	   full height: the fixed size is the actual spec. */
	width: 356px;
	height: 144px;
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 4px 10px rgba( 0, 0, 0, 0.1 );
	/* Now a <button> (opens the map popup) instead of a link out to
	   Google Maps - confirmed 2026-10-03 - so it needs its own reset to
	   still look/read like a plain card. */
	border: 0;
	padding: 0;
	text-align: left;
	font: inherit;
	cursor: pointer;
}
.moss-si-map-item:disabled {
	cursor: default;
	opacity: 0.6;
}
.moss-si-map-item-thumb {
	flex-shrink: 0;
	width: 140px;
	height: 100%;
	background-color: #94a3b8;
	background-image: linear-gradient(160deg, #cbd5e1, #94a3b8);
	background-size: cover;
	background-position: center;
}
/* Badge moved into the card body, below the name - matching the design
   exactly (confirmed 2026-10-03), replacing the old thumbnail-corner
   overlay position. */
.moss-si-map-item-type-badge { width: 22px; height: 22px; }
.moss-si-map-item-type-badge img { width: 13px; height: 13px; }
.moss-si-map-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	min-height: 220px;
	color: #64748b;
	font-size: 13px;
}
.moss-si-map-item-body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 6px;
	padding: 10px 14px 10px 12px;
	min-width: 0;
}
.moss-si-map-item-name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: #1f2937;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.moss-si-list-view[hidden] { display: none; }

.moss-si-region-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 28px;
	border-bottom: 1px solid #e5e7eb;
	margin-bottom: 24px;
}
.moss-si-region-tab {
	position: relative;
	background: none;
	border: none;
	padding: 0 0 12px;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 500;
	color: #94a3b8;
	cursor: pointer;
	white-space: nowrap;
}
.moss-si-region-tab.is-active { color: #0f172a; font-weight: 700; }
.moss-si-region-tab.is-active::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -1px;
	width: 100%;
	height: 2px;
	background: var(--moss-orange);
	border-radius: 2px;
}

.moss-si-place-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	margin-bottom: 40px;
}
.moss-si-place-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.moss-si-place-card:hover {
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
	transform: translateY(-2px);
}
.moss-si-place-cover {
	position: relative;
	display: block;
	height: 150px;
	background-color: #94a3b8;
	background-image: linear-gradient(160deg, #cbd5e1, #94a3b8);
	background-size: cover;
	background-position: center;
}
.moss-si-place-tag {
	position: absolute;
	top: 10px;
	left: 10px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: rgba(15, 23, 42, 0.72);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 6px;
}
.moss-si-place-tag-icon {
	width: 14px;
	height: 14px;
	filter: brightness(0) invert(1);
}

/* Type icon for a listing - the source SVGs (police.svg / hospital.svg)
   are already fully colored badge shapes (red shield / green cross), so
   this just sizes them - no background circle, no colour filter, or the
   icon's own colour gets erased into a blank dot. Positioned inline by
   default (the card body's badge row); .moss-si-type-badge-overlay
   switches it to sit on top of a cover image instead (map thumb, detail
   page cover). */
.moss-si-type-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}
.moss-si-type-badge img { width: 28px; height: 28px; }
.moss-si-type-badge-overlay { position: absolute; top: 10px; left: 10px; }
.moss-si-type-badge-row { display: flex; }

.moss-si-place-body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 16px 16px;
}
.moss-si-place-name {
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.5;
	color: #1f2937;
}
.moss-si-place-desc {
	font-size: 12.5px;
	line-height: 1.6;
	color: #64748b;
}
.moss-si-place-area {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: var(--moss-blue);
}
.moss-si-place-contact,
.moss-si-place-venues {
	font-size: 11.5px;
	line-height: 1.6;
	color: #64748b;
}
.moss-si-place-map-link {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 4px;
	font-size: 11.5px;
	font-weight: 600;
	color: var(--moss-blue);
	text-decoration: none;
}
.moss-si-place-map-link:hover { text-decoration: underline; }

/* ---------------- Directory listing detail page ---------------- */

.moss-sid-detail {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	overflow: hidden;
	margin: 24px 0 48px;
	max-width: 720px;
}
.moss-sid-detail-cover {
	position: relative;
	height: 280px;
	background-color: #94a3b8;
	background-image: linear-gradient(160deg, #cbd5e1, #94a3b8);
	background-size: cover;
	background-position: center;
}
.moss-sid-detail-tag { position: absolute; top: 16px; left: 16px; }
.moss-sid-detail-body {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 24px;
}
.moss-sid-detail-title {
	font-size: 22px;
	font-weight: 700;
	color: #1f2937;
	margin: 0;
}
.moss-sid-detail-desc {
	font-size: 14px;
	line-height: 1.7;
	color: #475569;
}
.moss-sid-detail-meta {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 8px;
	border-top: 1px solid #e5e7eb;
}
.moss-sid-detail-meta-row { font-size: 13px; }
.moss-sid-detail-map-link { font-size: 13px; }
.moss-sid-detail-back {
	margin-top: 8px;
	font-size: 13px;
	font-weight: 600;
	color: var(--moss-blue);
	text-decoration: none;
}
.moss-sid-detail-back:hover { text-decoration: underline; }

.moss-si-insurance-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 28px;
	border-bottom: 1px solid #e5e7eb;
	margin-bottom: 32px;
}
.moss-si-insurance-tab {
	position: relative;
	padding: 0 0 14px;
	font-size: 14px;
	font-weight: 500;
	color: #94a3b8;
	white-space: nowrap;
}
.moss-si-insurance-tab::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -1px;
	width: 100%;
	height: 2px;
	background: var(--moss-orange);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.25s ease;
}
.moss-si-insurance-tab.is-active { color: #0f172a; font-weight: 700; }
.moss-si-insurance-tab.is-active::after { transform: scaleX(1); }

.moss-si-ins-section { scroll-margin-top: 24px; margin-bottom: 40px; }
.moss-si-ins-section h2 {
	font-size: 19px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 14px;
}
.moss-si-ins-section h3 {
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 16px;
}
.moss-si-ins-section p {
	font-size: 14.5px;
	line-height: 1.8;
	color: #334155;
	margin: 0 0 24px;
}

.moss-si-ins-band {
	position: relative;
	left: 50%;
	right: 50%;
	width: 100vw;
	margin-left: -50vw;
	margin-right: -50vw;
	background: #f6fbff;
	padding-top: 28px;
	padding-bottom: 4px;
	padding-left: max(24px, calc((100vw - 1200px) / 2 + 24px));
	padding-right: max(24px, calc((100vw - 1200px) / 2 + 24px));
	box-sizing: border-box;
	margin-bottom: 24px;
	scroll-margin-top: 24px;
}
.moss-si-ins-band h3 { color: var(--moss-blue); }

.moss-si-ins-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin-bottom: 32px;
}
.moss-si-ins-grid-4 { grid-template-columns: repeat(2, 1fr); }

.moss-si-ins-card {
	display: flex;
	align-items: stretch;
	gap: 0;
	height: 74px;
	min-height: 0;
	max-height: 74px;
	box-sizing: border-box;
	background: #fff;
	border: 1px solid #ddf0ff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 4px 4px 0 #ddf0ff;
}
.moss-si-ins-icon-badge {
	flex-shrink: 0;
	width: 54px;
	background: var(--moss-blue);
	display: flex;
	align-items: center;
	justify-content: center;
}
.moss-si-ins-icon {
	width: 22px;
	height: 22px;
	background-color: #fff;
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	-webkit-mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-position: center;
}
.moss-si-ins-label {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 1px;
	padding: 6px 8px;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}
.moss-si-ins-label strong {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 12.5px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--moss-blue);
}
.moss-si-ins-label em {
	font-style: normal;
	font-size: 10.5px;
	font-weight: 400;
	line-height: 1.2;
	color: #64748b;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.moss-si-ins-arrow {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	padding-right: 12px;
	font-size: 16px;
	color: var(--moss-blue);
}

.moss-si-oic {
	scroll-margin-top: 24px;
	padding: 8px 0 24px;
}
.moss-si-oic h3 { font-size: 16px; margin: 0 0 4px; }
.moss-si-oic-en { font-size: 13px; color: #64748b; margin: 0 0 14px; }
.moss-si-oic p { font-size: 14px; line-height: 1.8; color: #334155; margin: 0 0 12px; }
.moss-si-oic a { color: var(--moss-blue); }

.moss-si-helpful { background: #f1f5f9; padding: 24px 0; margin-top: 8px; margin-bottom: 20px; }
.moss-si-helpful-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 20px;
	font-size: 14px;
	font-weight: 600;
	color: #1f2937;
}
.moss-si-helpful-btns { display: flex; gap: 10px; }
.moss-si-helpful-no,
.moss-si-helpful-yes {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 85px;
	height: 30px;
	border-radius: 100px;
	padding: 0;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	box-sizing: border-box;
}
.moss-si-helpful-no { background: #fff; border: 1px solid #cbd5e1; color: #334155; }
.moss-si-helpful-yes { background: var(--moss-blue); border: 1px solid var(--moss-blue); color: #fff; }

@media (max-width: 1000px) {
	.moss-si-map-view { grid-template-columns: 1fr; }
	.moss-si-map-list { max-height: 420px; }
	/* The card's 356px width is the Figma spec for the desktop sidebar
	   column - once that column collapses to full-width below the map,
	   fill the available space instead so it doesn't overflow a narrower
	   viewport. */
	.moss-si-map-item { width: 100%; max-width: 356px; }
	.moss-si-place-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
	.moss-si-filter-bar { grid-template-columns: 1fr; }
	.moss-si-place-grid { grid-template-columns: 1fr; }
	.moss-si-region-tabs { gap: 18px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
	.moss-si-ins-grid { grid-template-columns: 1fr; }
	.moss-si-ins-grid-4 { grid-template-columns: 1fr; }
	.moss-si-tabs,
	.moss-si-insurance-tabs { gap: 18px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
}
