/**
 * E-Groblja – default styles. Everything is scoped under .egr / .egr-ovl so the theme is not
 * affected. Colours are CSS variables: override them in your theme, e.g.
 *
 *   .egr { --egr-accent: #8a6d1d; --egr-bg: #e4cb80; }   (the standalone app's sand background)
 *
 * Or dequeue completely:  add_action( 'wp_enqueue_scripts', function () {
 *     wp_dequeue_style( 'egroblja' ); }, 20 );
 */
.egr {
	--egr-bg: transparent;
	--egr-panel: #fff;
	--egr-text: inherit;
	--egr-muted: #6b6b6b;
	--egr-border: #d9d2c0;
	--egr-stripe: #faf6ec;
	--egr-hover: #f3ead2;
	--egr-accent: #8a6d1d;
	--egr-warn-bg: #fff3cd;
	--egr-warn-border: #e0c060;
	--egr-error-bg: #fdecea;
	--egr-error-border: #e3a29b;
	background: var(--egr-bg);
	color: var(--egr-text);
	margin: 1em 0;
}
.egr *, .egr *::before, .egr *::after { box-sizing: border-box; }

.egr-disclaimer, .egr-footer { text-align: center; color: var(--egr-muted); font-size: .92em; }

/* ---------- form ---------- */
.egr-form {
	display: flex; flex-wrap: wrap; gap: .75em 1em; align-items: flex-end; justify-content: center;
	margin: 1.25em 0;
}
.egr-field { display: flex; flex-direction: column; gap: .3em; }
.egr-field label { font-weight: 600; font-size: .92em; }
.egr-field input[type=text] { min-width: 18em; max-width: 100%; }
.egr-field input, .egr-field select { padding: .45em .6em; font: inherit; }
.egr-form select option:disabled { color: #999; }
.egr-buttons { display: flex; gap: .5em; }
.egr-btn {
	font: inherit; cursor: pointer; padding: .45em 1em; border: 1px solid var(--egr-border);
	background: var(--egr-panel); color: inherit; border-radius: 4px;
}
.egr-btn:hover:not(:disabled) { background: var(--egr-hover); }
.egr-btn:disabled { opacity: .45; cursor: default; }
.egr-btn-primary { background: var(--egr-accent); border-color: var(--egr-accent); color: #fff; }
.egr-btn-primary:hover { filter: brightness(1.1); background: var(--egr-accent); }

/* ---------- notices ---------- */
.egr-notice {
	text-align: center; padding: .6em .9em; margin: .9em auto; max-width: 100%;
	border: 1px solid var(--egr-border); background: var(--egr-panel);
}
.egr-notice-warn { background: var(--egr-warn-bg); border-color: var(--egr-warn-border); }
.egr-notice-error { background: var(--egr-error-bg); border-color: var(--egr-error-border); }

/* ---------- tables ---------- */
.egr-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.egr-table { width: 100%; border-collapse: collapse; background: var(--egr-panel); margin: 0; }
.egr-table th, .egr-table td { border: 1px solid var(--egr-border); padding: .4em .55em; text-align: left; vertical-align: middle; }
.egr-table thead th { background: var(--egr-stripe); font-weight: 600; white-space: nowrap; }
.egr-table tbody tr:nth-child(even) { background: var(--egr-stripe); }
.egr-table tbody tr:hover { background: var(--egr-hover); }
.egr-col-map, .egr-center { text-align: center !important; }
.egr-right { text-align: right !important; }
.egr-col-map img { display: inline-block; vertical-align: middle; }

/* ---------- pagination (templates/pagination.php) ---------- */
.egr-pagination { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5em 1em; margin: .8em 0; font-size: .92em; }
.egr-pagination-info { color: var(--egr-muted); }
.egr-pagination-links { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.egr-pagination-links li { margin: 0; padding: 0; }
.egr-page {
	display: inline-block; min-width: 2.2em; padding: .3em .6em; text-align: center; text-decoration: none;
	border: 1px solid var(--egr-border); border-radius: 4px; background: var(--egr-panel); color: inherit;
}
a.egr-page:hover { background: var(--egr-hover); }
.egr-page.is-current { background: var(--egr-accent); border-color: var(--egr-accent); color: #fff; font-weight: 600; }
.egr-page.is-disabled { opacity: .45; }
.egr-page-gap { border-color: transparent; background: transparent; }

/* ---------- detail ---------- */
.egr-back { margin: 0 0 .75em; }
.egr-title { margin: .2em 0 .6em; }
.egr-title small { display: block; font-size: .6em; font-weight: normal; color: var(--egr-muted); }
.egr-subtitle { font-size: 1.05em; margin: 1.2em 0 .5em; }
.egr-map { width: 100%; min-height: 320px; border: 1px solid var(--egr-border); background: #eee; }
.egr-photos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 1em 0; }
.egr-photos a { display: block; border: 1px solid #000; padding: 3px; background: #fff; }
.egr-photos img { display: block; width: 102px; height: 77px; object-fit: cover; }
.egr-btn-obit { margin: .4em 0; }
.egr-iw { font-size: 13px; line-height: 1.4; }

/* ---------- obituary list [egroblja_posmrtnice] (templates/obituaries*.php) ---------- */
.egr-obits-title { text-align: center; margin: .2em 0 .6em; }
.egr-label { font-weight: 600; font-size: .92em; }
.egr-inline { display: flex; gap: .4em; }
.egr-obits-form input[type=date] { min-width: 11em; }
.egr-buttons a.egr-btn { text-decoration: none; display: inline-flex; align-items: center; }
.egr-obit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 1em 0; }
.egr-obit-card {
	position: relative; display: flex; flex-direction: column; background: var(--egr-panel); border: 1px solid var(--egr-border);
	border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.egr-obit-card-grave {
	position: absolute; top: 8px; right: 8px; z-index: 1; display: block; line-height: 0; padding: 4px;
	background: var(--egr-panel); border: 1px solid var(--egr-border); border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.egr-obit-card-grave:hover { background: var(--egr-hover); }
.egr-obit-card-grave img { display: block; width: 25px; height: auto; }
.egr-obit-card-head { display: flex; gap: 14px; padding: 14px 52px 14px 14px; background: var(--egr-stripe); border-bottom: 1px solid var(--egr-border); }
.egr-obit-card-photo { flex: none; display: block; width: 100px; height: 140px; border: 1px solid var(--egr-border); background: #fff; }
.egr-obit-card-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.egr-obit-card-nophoto { display: flex; align-items: center; justify-content: center; font-size: 2.2em; color: var(--egr-muted); }
.egr-obit-card-id { min-width: 0; }
.egr-obit-card-citulja { padding: 14px; text-align: center; }
.egr-obit-card-citulja a { display: block; }
.egr-obit-card-citulja img { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid var(--egr-border); background: #fff; }
.egr-obit-card-source { margin: .4em 0 0; font-size: .85em; color: var(--egr-muted); }
.egr-obit-card-name { margin: 0 0 .3em; font-size: 1.1em; line-height: 1.3; }
.egr-obit-card-id p { margin: 0 0 .2em; }
.egr-obit-card-nick { font-style: italic; }
.egr-obit-card-years { font-weight: 600; }
.egr-obit-card-date { color: var(--egr-muted); font-size: .92em; }
.egr-obit-card-text { padding: 12px 14px; flex: 1 1 auto; font-size: .95em; }
.egr-obit-card-text p { margin: 0 0 .6em; }
.egr-obit-card-text p:last-child { margin-bottom: 0; }
.egr-obit-card-foot { padding: 6px 14px 10px; text-align: right; font-size: .85em; color: var(--egr-muted); }

/* ---------- map as background + information layer (templates/detail.php) ---------- */
.egr-mapwrap { position: relative; width: 100%; min-height: 420px; overflow: hidden; border: 1px solid var(--egr-border); background: #e8e8e8; }
.egr-mapwrap .egr-map { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; border: 0; }
.egr-map-layer {
	position: absolute; z-index: 2; top: 12px; left: 12px; bottom: 12px;
	width: min(560px, calc(100% - 24px)); display: flex; flex-direction: column;
	background: rgba(255, 255, 255, .96); color: #222; border-radius: 8px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, .28); overflow: hidden;
}
.egr-map-layer[hidden] { display: none; }
.egr-layer-head {
	display: flex; align-items: flex-start; justify-content: space-between; gap: .5em;
	padding: .7em .9em .5em; border-bottom: 1px solid var(--egr-border); background: var(--egr-stripe);
}
.egr-layer-head .egr-title { margin: 0; font-size: 1.15em; line-height: 1.3; }
.egr-layer-tools { display: flex; gap: 4px; flex: none; }
.egr-btn-icon { padding: .15em .55em; font-size: 1.1em; line-height: 1.4; }
.egr-layer-body { overflow: auto; -webkit-overflow-scrolling: touch; padding: .2em .9em .9em; flex: 1 1 auto; }
.egr-layer-body .egr-subtitle:first-child { margin-top: .6em; }
.egr-layer-show { position: absolute; z-index: 2; top: 12px; left: 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.egr-layer-show[hidden] { display: none; }
/* full screen (native or CSS fallback) */
.egr-mapwrap:fullscreen { width: 100vw; height: 100vh !important; border: 0; }
.egr-mapwrap:-webkit-full-screen { width: 100vw; height: 100vh !important; border: 0; }
.egr-mapwrap.egr-pseudo-fs { position: fixed; inset: 0; z-index: 2147482000; height: 100% !important; border: 0; }

.egr-map-error { position: absolute; z-index: 3; right: 12px; top: 12px; max-width: 420px; text-align: left; }
.egr-admin-notice { text-align: left; }

/* ---------- overlay (lightbox + obituary) ---------- */
html.egr-noscroll, html.egr-noscroll body { overflow: hidden; }
.egr-ovl {
	display: none; position: fixed; inset: 0; z-index: 2147483000; background: rgba(0, 0, 0, .85);
	overflow: auto; -webkit-overflow-scrolling: touch; padding: 16px;
	flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.egr-ovl.is-open { display: flex; }
.egr-ovl-x {
	position: fixed; top: 6px; right: 14px; width: 42px; height: 42px; border: 0; border-radius: 50%;
	background: rgba(0, 0, 0, .45); color: #fff; font-size: 34px; line-height: 1; cursor: pointer;
}
.egr-ovl-box { margin: auto; max-width: 100%; }
.egr-ovl-frame { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.egr-ovl-scroll { max-width: 92vw; max-height: 72vh; overflow: auto; }
.egr-ovl-img {
	display: block; margin: 0 auto; max-width: 88vw; max-height: 68vh; border: 3px solid #fff;
	box-shadow: 0 0 30px #000; cursor: zoom-in;
}
.egr-ovl-img.is-zoomed { max-width: none; max-height: none; cursor: zoom-out; }
.egr-ovl-arrow {
	position: absolute; top: 50%; transform: translateY(-50%); border: 0; color: #fff; font-size: 44px;
	line-height: 1; padding: 2px 14px; background: rgba(0, 0, 0, .45); border-radius: 6px; cursor: pointer;
}
.egr-ovl-prev { left: 8px; }
.egr-ovl-next { right: 8px; }
.egr-ovl-hint, .egr-ovl-count { color: #fff; font-size: 13px; margin-top: 8px; opacity: .85; }
.egr-ovl-close { margin-top: 12px; background: #fff; color: #000; border: 0; }
.egr-ovl-panel {
	display: inline-block; background: #fff; color: #222; max-width: 94vw; max-height: 82vh; overflow: auto;
	padding: 8px; border-radius: 6px; box-shadow: 0 0 30px #000; text-align: left;
}
.egr-obit-img { display: block; margin: 0 auto; max-width: 88vw; max-height: 74vh; border: 1px solid #999; }
.egr-obit-source { display: block; text-align: center; margin-top: 4px; }
.egr-obit-legacy { border-collapse: collapse; margin: 0 auto 1em; max-width: 600px; }
.egr-obit-legacy th, .egr-obit-legacy td { padding: 4px 8px; vertical-align: top; text-align: left; }
.egr-obit-photo img { width: 100px; height: 140px; object-fit: cover; }

/* ---------- small screens (same intent as the standalone media queries) ---------- */
@media (max-width: 768px) {
	.egr-obit-grid { grid-template-columns: 1fr; }
	.egr-results { font-size: 13px; }
	.egr-field input[type=text] { min-width: 0; width: 80vw; }
	.egr-form { justify-content: stretch; }
	.egr-pagination { justify-content: center; }
}
@media (max-width: 600px) {
	/* information layer becomes a bottom sheet over the lower part of the map */
	.egr-mapwrap { min-height: 520px; }
	.egr-map-layer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 62%; border-radius: 12px 12px 0 0; }
	.egr-layer-head .egr-title { font-size: 1em; }
	.gm-style-iw-d { overflow: auto !important; max-height: 78vh !important; }
	.egr-table th, .egr-table td { padding: 2px 4px; white-space: normal; word-break: break-word; }
}

/* ---------- debug boxes (Settings -> Debug, class EGR_Debug) ---------- */
.egr pre.egr-debug, pre.egr-debug {
	margin: 6px 0; padding: 8px 10px; background: #fffbe6; color: #3a3000; border: 1px dashed #d4b106;
	border-radius: 4px; font: 12px/1.45 Menlo, Consolas, "Liberation Mono", monospace; text-align: left;
	white-space: pre-wrap; word-break: break-all; overflow: auto; max-height: 70vh;
}
pre.egr-debug-summary { margin-top: 16px; }
.egr-debug-row td { padding: 0 4px !important; background: transparent !important; }
.egr-debug-files { margin: 0 0 16px; font: 12px/1.45 Menlo, Consolas, monospace; }
.egr-debug-files summary { cursor: pointer; padding: 4px 0; }
.egr-obit-card-debug { padding: 0 14px 10px; }
