/**
 * Blank Template Styles
 *
 * Styles for the plugin-owned HTML shell that bypasses theme wrappers.
 * Only loaded when Plugin Layout mode is active (default).
 *
 * Covers:
 *   1. Body layout (flex column, full viewport)
 *   2. Theme element hiding (hide any theme wrappers that slip through)
 *   3. Plugin header (sticky, logo, 64px height)
 *   4. Plugin footer (pushed to bottom, centered copyright)
 *   5. Page-specific layout helpers
 *   6. Admin bar offset
 *
 * @since 1.7.0
 */

/* =====================================================================
 * 1. Body Layout — Full viewport flex column
 * =================================================================== */

body.cwp-blank-template {
	margin: 0 !important;
	padding: 0 !important;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--cwp-bg, #fff);
}

/* =====================================================================
 * 2. Theme Element Hiding
 *
 * When wp_head() / wp_footer() fire, some themes inject markup via
 * hooks (skip-links, sticky navs, back-to-top). Hide anything that
 * isn't our plugin content.
 * =================================================================== */

body.cwp-blank-template > header:not(.cwp-plugin-header),
body.cwp-blank-template > footer:not(.cwp-plugin-footer),
body.cwp-blank-template > nav:not(.cwp-plugin-header *),
body.cwp-blank-template > .site-header,
body.cwp-blank-template > .site-footer,
body.cwp-blank-template > .ast-above-header,
body.cwp-blank-template > .ast-below-header,
body.cwp-blank-template > .ast-mobile-header-wrap,
body.cwp-blank-template > #ast-scroll-top {
	display: none !important;
}

/* =====================================================================
 * 3. Plugin Header — Sticky bar with site logo
 * =================================================================== */

.cwp-plugin-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	height: 64px;
	background: var(--cwp-bg, #fff);
	border-bottom: 1px solid var(--cwp-border, #ebebeb);
	display: flex;
	align-items: center;
}

.cwp-plugin-header__inner {
	width: 100%;
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px;
	display: flex;
	align-items: center;
	gap: 16px;
}

/* Logo link */
.cwp-plugin-header__logo {
	display: flex;
	align-items: center;
	text-decoration: none !important;
	color: inherit !important;
	line-height: 1;
}

.cwp-plugin-header__logo:hover {
	opacity: 0.8;
}

/* Logo image */
.cwp-plugin-header__logo-img {
	max-height: 36px;
	width: auto;
	object-fit: contain;
}

/* Text fallback when no logo set */
.cwp-plugin-header__site-name {
	font-size: 18px;
	font-weight: 700;
	color: var(--cwp-text, #222);
	letter-spacing: -0.02em;
}

/* ── Header navigation ─────────────────────────────────────────────── */
.cwp-plugin-header__nav {
	display: flex;
	align-items: center;
	gap: 24px;
	margin-left: auto;
}

.cwp-plugin-header__nav-link {
	font-size: 14px;
	font-weight: 500;
	color: var(--cwp-text, #222);
	text-decoration: none !important;
	transition: opacity 0.2s ease;
}

.cwp-plugin-header__nav-link:hover {
	opacity: 0.6;
}

.cwp-plugin-header__nav-cta {
	display: inline-block;
	padding: 8px 20px;
	font-size: 13px;
	font-weight: 600;
	color: #fff !important;
	background: var(--cwp-primary, #1B6B93);
	border-radius: 6px;
	text-decoration: none !important;
	transition: filter 0.2s ease;
}

.cwp-plugin-header__nav-cta:hover {
	filter: brightness(0.85);
}

@media (max-width: 600px) {
	.cwp-plugin-header__nav {
		gap: 16px;
	}

	.cwp-plugin-header__nav-link {
		font-size: 13px;
	}

	.cwp-plugin-header__nav-cta {
		padding: 6px 14px;
		font-size: 12px;
	}
}

/* =====================================================================
 * 4. Plugin Footer — Pushed to bottom via flex
 * =================================================================== */

.cwp-plugin-footer {
	margin-top: auto;
	background: var(--cwp-surface-alt, #f7f7f7);
	border-top: 1px solid var(--cwp-border, #ebebeb);
	padding: 24px 0;
}

.cwp-plugin-footer__inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px;
	text-align: center;
}

.cwp-plugin-footer__copyright {
	font-size: 13px;
	color: var(--cwp-text-muted, #717171);
	margin: 0;
	line-height: 1.5;
}

/* =====================================================================
 * 5. Page-Specific Layout
 * =================================================================== */

/* Property page — main content area grows to fill available space */
body.cwp-blank-template .cwp-property-page {
	flex: 1;
}

/* Search page — full viewport, no header/footer */
body.cwp-blank-template .cwp-search-page {
	flex: 1;
	min-height: 100vh;
}

/* =====================================================================
 * 6. Admin Bar Offset
 *
 * WordPress admin bar is 32px (desktop) or 46px (mobile <=782px).
 * Offset the sticky plugin header so it doesn't overlap.
 * =================================================================== */

.admin-bar.cwp-blank-template .cwp-plugin-header {
	top: 32px;
}

@media screen and ( max-width: 782px ) {
	.admin-bar.cwp-blank-template .cwp-plugin-header {
		top: 46px;
	}
}

/* =====================================================================
 * 7. Responsive — Mobile adjustments
 * =================================================================== */

@media screen and ( max-width: 768px ) {
	.cwp-plugin-header {
		height: 56px;
	}

	.cwp-plugin-header__inner {
		padding: 0 16px;
	}

	.cwp-plugin-header__logo-img {
		max-height: 28px;
	}

	.cwp-plugin-header__site-name {
		font-size: 16px;
	}

	.cwp-plugin-footer__inner {
		padding: 0 16px;
	}
}
