/* Demo page toolbar (breakpoint preview + "Pesan Sekarang").
   Config: Site Builder → Template Demo (TICKET-037). See
   includes/class-template-demo-toolbar.php for the render logic.

   These are the BASE styles. The "Akunika Demo Preview" widget's Style
   tab emits its own rules at higher specificity (`.akn-tpl-demo-toolbar
   .akn-tpl-demo-toolbar__bp`, `.akn-tpl-demo-toolbar #akn-tpl-demo-order-now`)
   loaded after this file, so an admin's Style choices always win — the
   `!important` here only exists to beat host-theme button resets, and
   the widget's overrides carry `!important` too so they beat this. */

:root {
	--akn-demo-bar-bg: #1A1F1D;
	--akn-demo-bar-text: #FFFFFF;
	--akn-demo-bp-active-bg: #2D5A4D;
	--akn-demo-btn-bg: #D4B038;
	--akn-demo-btn-text: #1A1F1D;
}

.akn-tpl-demo-toolbar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	/* Below the WP admin bar (z-index 99999) so its dropdowns aren't
	   covered — the toolbar still sits above all page content. */
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	background: var(--akn-demo-bar-bg, #1A1F1D);
	color: var(--akn-demo-bar-text, #fff);
	padding: 10px 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.akn-tpl-demo-toolbar--bottom {
	top: auto;
	bottom: 0;
}

/* Keep the WP admin bar (and its dropdowns) above our toolbar. */
#wpadminbar {
	z-index: 100000 !important;
}

/* "Edit Template Demo" admin-bar node — reuse Elementor's own icon
   (eicons glyph \e813, loaded with the admin bar) so it matches the
   "Edit with Elementor" node exactly. Same rule as Elementor's
   admin-bar.css `#wp-admin-bar-elementor_edit_page > .ab-item::before`. */
#wp-admin-bar-akn_edit_template_demo > .ab-item::before {
	content: "\e813";
	font-family: eicons;
	font-size: 18px;
	top: 3px;
}

/* Sit below the WordPress admin bar when it's showing (logged-in view). */
body.admin-bar .akn-tpl-demo-toolbar:not(.akn-tpl-demo-toolbar--bottom) {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .akn-tpl-demo-toolbar:not(.akn-tpl-demo-toolbar--bottom) {
		top: 46px;
	}
}

/* Not sticky (Premium opt-out) — sits at the very top/bottom of the page
   and scrolls away with the content. */
.akn-tpl-demo-toolbar--static {
	position: absolute;
}

/* Template title on the left (Signature) — the breakpoint switcher then
   sits centred (title + actions flank it, each takes half the slack). */
.akn-tpl-demo-toolbar__title {
	font-size: 13px;
	font-weight: 600;
	color: var(--akn-demo-bar-text, #fff);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.akn-tpl-demo-toolbar--has-title .akn-tpl-demo-toolbar__title,
.akn-tpl-demo-toolbar--has-title .akn-tpl-demo-toolbar__actions {
	flex: 1 1 0;
	min-width: 0;
}

.akn-tpl-demo-toolbar--has-title .akn-tpl-demo-toolbar__actions {
	justify-content: flex-end;
}

/* (Ruang untuk toolbar — lihat blok body.akn-demo-toolbar-top/bottom di
   bawah, pakai tinggi toolbar yang diukur JS.) */

.akn-tpl-demo-toolbar__breakpoints {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.akn-tpl-demo-toolbar__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Info "Digunakan N kali" — shown in place of "Pesan Sekarang" when the
   order flow isn't available for the site's license. */
.akn-tpl-demo-toolbar__usage {
	font-size: 12px;
	font-weight: 600;
	color: var(--akn-demo-bar-text, #fff);
	opacity: .85;
	white-space: nowrap;
}

.akn-tpl-demo-toolbar .akn-tpl-demo-toolbar__bp {
	border: 1px solid rgba(255, 255, 255, .35);
	background: transparent !important;
	color: var(--akn-demo-bar-text, #fff) !important;
	opacity: .7;
	border-radius: 6px !important;
	/* No min-height — vertical padding (Style tab) must change the button
	   height, not get absorbed by a fixed min. Default padding tuned so the
	   out-of-the-box height matches the old 34px min. */
	padding: 8px 12px !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-family: inherit;
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none !important;
}

.akn-tpl-demo-toolbar__bp-icon {
	width: 15px;
	height: 15px;
	flex: none;
}

.akn-tpl-demo-toolbar__bp.is-active {
	background: var(--akn-demo-bp-active-bg, #2D5A4D) !important;
	border-color: var(--akn-demo-bp-active-bg, #2D5A4D);
	color: #fff !important;
	opacity: 1;
}

/* Scoped one level deeper than a plain class so it beats host-theme
   `button` rules and inherited body line-height, WITHOUT !important on
   the typographic props — the widget's Typography control (specificity
   with an #id, loaded after) still overrides these. */
.akn-tpl-demo-toolbar .akn-tpl-demo-toolbar__order-now {
	background: var(--akn-demo-btn-bg, #D4B038) !important;
	color: var(--akn-demo-btn-text, #1A1F1D) !important;
	border: 1px solid transparent;
	border-radius: 999px !important;
	padding: 10px 20px !important;
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	box-shadow: none !important;
	text-shadow: none !important;
}

/* ---- Breakpoint / device preview (no iframe, no DOM moves) ----
   Any breakpoint with width > 0 turns <html> into a grey "stage" that
   doesn't scroll and <body> into a FIXED, centred device box. The
   device box's OWN content scrolls inside it and is clipped to the
   (optionally rounded) bezel.
     - width only         → box fills the height between toolbar & bottom
     - width + height set  → box capped to that height, centred in the
                             free area (viewport minus the toolbar).
   `--akn-demo-*-reserve` = space kept clear for the fixed toolbar. */
html.akn-demo-staged {
	background: #6B6D70 !important;
	overflow: hidden !important;
}

/* Normal scroll mode (no breakpoint active): reserve the toolbar's own
   measured height so content never slides under it. `--akn-demo-bar-h`
   is set by the toolbar JS (falls back to 56px before JS runs). */
body.akn-demo-toolbar-top {
	padding-top: var(--akn-demo-bar-h, 56px) !important;
	--akn-demo-top-reserve: calc(var(--akn-demo-bar-h, 56px) + 12px);
	--akn-demo-bottom-reserve: 16px;
}

body.akn-demo-toolbar-bottom {
	padding-bottom: var(--akn-demo-bar-h, 56px) !important;
	--akn-demo-top-reserve: 16px;
	--akn-demo-bottom-reserve: calc(var(--akn-demo-bar-h, 56px) + 12px);
}

/* With the WP admin bar showing, `body.akn-demo-bp` (position: fixed) is
   viewport-relative and ignores the html margin WP adds — so the device
   box's top reserve must add the admin bar's height itself. */
body.admin-bar.akn-demo-toolbar-top {
	--akn-demo-top-reserve: calc(var(--akn-demo-bar-h, 56px) + 12px + 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar.akn-demo-toolbar-top {
		--akn-demo-top-reserve: calc(var(--akn-demo-bar-h, 56px) + 12px + 46px);
	}
}

body.akn-demo-bp {
	position: fixed !important;
	left: 50% !important;
	width: min(var(--akn-demo-bp-w, 390px), 100vw - 24px) !important;
	min-width: 0 !important;
	max-width: none !important;
	margin: 0 0 0 calc(-1 * min(var(--akn-demo-bp-w, 390px), 100vw - 24px) / 2) !important;
	top: var(--akn-demo-top-reserve, 64px) !important;
	height: calc(100vh - var(--akn-demo-top-reserve, 64px) - var(--akn-demo-bottom-reserve, 16px)) !important;
	max-height: calc(100vh - var(--akn-demo-top-reserve, 64px) - var(--akn-demo-bottom-reserve, 16px)) !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	background: #fff !important;
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .4) !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	transition: none !important;
}

body.akn-demo-bp.akn-demo-bp-h {
	height: min(var(--akn-demo-bp-h, 844px), calc(100vh - var(--akn-demo-top-reserve, 64px) - var(--akn-demo-bottom-reserve, 16px))) !important;
	max-height: calc(100vh - var(--akn-demo-top-reserve, 64px) - var(--akn-demo-bottom-reserve, 16px)) !important;
	top: max(
		var(--akn-demo-top-reserve, 64px),
		calc(var(--akn-demo-top-reserve, 64px) + (100vh - var(--akn-demo-top-reserve, 64px) - var(--akn-demo-bottom-reserve, 16px) - var(--akn-demo-bp-h, 844px)) / 2)
	) !important;
}

body.akn-demo-bp.akn-demo-frame-on {
	border: 12px solid #14161A !important;
	border-radius: 42px;
}

/* Cover belum dibuka: di mode switcher Akunika, kotak perangkat (body) yang
   men-scroll, jadi `overflow-y: auto !important` di atas mengalahkan kunci
   `body.akn-cover-lock { overflow: hidden }` dan halaman tetap bisa digulir.
   Kunci scroll kotak perangkat itu selama Cover tertutup. */
body.akn-demo-bp.akn-cover-lock {
	overflow-y: hidden !important;
}

/* "Pesan Sekarang" panel — the WHOLE component (markup + styling) is the
   same as Widget Template List's `.akn-tpl-list-widget__order` panel,
   loaded via `template-list-widget.css` (enqueued in enqueue_assets()).
   Only the full-screen host wrapper is defined here: the Template List
   version lives INSIDE the portfolio modal (`position: absolute; inset:0`
   relative to that modal); on the demo page it needs its own fixed host. */
.akn-tpl-list-widget--demo-order {
	position: fixed;
	inset: 0;
	z-index: 1000001;
	pointer-events: none;
}

.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order {
	pointer-events: auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---- Pre-style: `.akn-tpl-list-widget__order-panel` verbatim ----
   Byte-for-byte the same declarations as the block in
   `assets/css/widgets/template-list-widget.css`, only every selector is
   prefixed with `.akn-tpl-list-widget--demo-order` so the panel renders
   identically even on the theme-heavy demo page (the Template List page
   this component was built for is usually an Elementor canvas with no
   theme button/input CSS to fight). The widget's own Style-tab controls
   (`Widget_Demo_Preview::register_order_modal_style_controls()`) use the
   same prefix and load later, so they still override these.

   Kept in sync with template-list-widget.css when that file changes. */
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-panel {
	width: 100%;
	max-width: 440px;
	max-height: 100%;
	overflow-y: auto;
	background: #fff;
	border-radius: 16px;
	padding: 24px;
	box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5);
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--akn-tpl-n300, #D8DEDB);
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-head-main { min-width: 0; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-title { margin: 0; font-size: 18px; color: var(--akn-tpl-n900, #1A1F1D); }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-close {
	flex-shrink: 0;
	border: none;
	background: transparent;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: var(--akn-tpl-n500, #8A9490);
	padding: 0;
	box-shadow: none;
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-close:hover,
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-close:focus,
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-close:active {
	background: transparent;
	box-shadow: none;
	color: var(--akn-tpl-n900, #1A1F1D);
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-price { margin-top: 4px; font-size: 15px; font-weight: 700; color: var(--akn-tpl-primary, #2D5A4D); }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-price[hidden] { display: none; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-price-prefix { font-weight: 600; color: var(--akn-tpl-n500, #8A9490); }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-message:empty { display: none; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-message { font-size: 13px; color: var(--akn-tpl-n700, #4A5550); margin: 6px 0; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-prompt { font-size: 13px; color: var(--akn-tpl-n700, #4A5550); margin: 0 0 10px; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-step[hidden] { display: none; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--akn-tpl-n700, #4A5550);
	margin-bottom: 12px;
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-input {
	display: block;
	width: 100%;
	margin-top: 6px;
	padding: 12px 14px;
	font: inherit;
	color: var(--akn-tpl-n900, #1A1F1D);
	background: var(--akn-tpl-n100, #F4F6F5);
	border: 1px solid var(--akn-tpl-n300, #D8DEDB);
	border-radius: 10px;
	box-shadow: none;
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-input:focus { outline: none; border-color: var(--akn-tpl-primary, #2D5A4D); background: #fff; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-primary {
	width: 100%;
	margin-top: 4px;
	padding: 13px 18px;
	font: inherit;
	font-weight: 600;
	color: #fff;
	background: var(--akn-tpl-primary, #2D5A4D);
	border: none;
	border-radius: 100px;
	cursor: pointer;
	box-shadow: none;
	text-shadow: none;
	letter-spacing: normal;
	text-transform: none;
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-primary:hover { background: var(--akn-tpl-primary-dark, #1D3B32); color: #fff; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-primary[disabled] { opacity: .6; cursor: default; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-ghost {
	margin-top: 12px;
	padding: 9px 16px;
	font: inherit;
	font-size: 13px;
	color: var(--akn-tpl-n700, #4A5550);
	background: transparent;
	border: 1px solid var(--akn-tpl-n300, #D8DEDB);
	border-radius: 100px;
	cursor: pointer;
	box-shadow: none;
	text-shadow: none;
	letter-spacing: normal;
	text-transform: none;
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-ghost:hover { color: var(--akn-tpl-n900, #1A1F1D); background: var(--akn-tpl-n100, #F4F6F5); }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-options { display: flex; flex-direction: column; gap: 8px; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 12px 14px;
	background: var(--akn-tpl-n100, #F4F6F5);
	border: 1px solid var(--akn-tpl-n300, #D8DEDB);
	border-radius: 10px;
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-option .akn-tpl-list-widget__order-primary {
	flex-shrink: 0;
	width: auto;
	margin-top: 0;
	padding: 8px 18px;
	font-size: 13px;
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-option-info { min-width: 0; }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-option-slug {
	min-width: 0;
	font-size: 13px;
	color: var(--akn-tpl-n700, #4A5550);
	word-break: break-all;
}
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-option-slug b { color: var(--akn-tpl-n900, #1A1F1D); }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-option-title { font-size: 14px; font-weight: 600; color: var(--akn-tpl-n900, #1A1F1D); }
.akn-tpl-list-widget--demo-order .akn-tpl-list-widget__order-option-price { margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--akn-tpl-primary, #2D5A4D); }

.hidden {
	display: none !important;
}

/* ---- Elementor editor preview (Widget_Demo_Preview::render) ----
   The demo design renders at its NATURAL height (no cap). The toolbar is
   `position: sticky`, so scrolling the Elementor canvas shows the sticky
   behaviour, the breakpoint chrome, and the Style-tab result exactly as
   on the live /demo-template/ page. */

/* Break the preview out of the widget's column/section padding so it's
   edge-to-edge like the fixed toolbar is on the real demo page. Classic
   full-bleed trick (same as Site_Builder\Order_Summary::render). */
.akn-demo-preview-editor {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	width: 100vw;
	max-width: 100vw;
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
}

.akn-demo-preview-editor__frame {
	position: relative;
	background: #fff;
	display: flex;
	flex-direction: column;
}

/* Toolbar inside the editor frame: sticky (default) or static (Premium
   opt-out) — NEVER fixed, that would cover the panel. Sticks against the
   Elementor canvas scroll, like it does against the window on the front. */
.akn-demo-preview-editor .akn-tpl-demo-toolbar {
	position: sticky;
	top: 0;
	z-index: 5;
	flex: none;
}

.akn-demo-preview-editor .akn-tpl-demo-toolbar--bottom {
	top: auto;
	bottom: 0;
	order: 2;
}

.akn-demo-preview-editor .akn-tpl-demo-toolbar--static {
	position: static;
}

.akn-demo-preview-editor__content {
	flex: 1 1 auto;
	min-height: 320px;
}

.akn-demo-preview-editor__device {
	width: 100%;
}

/* Full-width sections in the rendered design shouldn't blow past the
   editor frame. */
.akn-demo-preview-editor__content .elementor {
	max-width: 100% !important;
}

/* ---- Device-viewport mode (a breakpoint with width > 0 is active) ----
   The bezel stays vertically centred (`position: sticky`) while the
   canvas scrolls; only the SCREEN inside it scrolls (`overflow: hidden`
   on the bezel, `overflow-y: auto` on the screen). */
.akn-demo-preview-editor.is-device .akn-demo-preview-editor__content {
	background: #6B6D70;
	padding: 40px 16px;
	min-height: 100vh;
}

.akn-demo-preview-editor.is-device .akn-demo-preview-editor__device {
	width: var(--akn-dev-w, 390px);
	max-width: 100%;
	margin: 0 auto;
	position: sticky;
	top: 20px;
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
}

.akn-demo-preview-editor.is-device.is-device-h .akn-demo-preview-editor__device {
	height: var(--akn-dev-h, 844px);
	max-height: calc(100vh - 80px);
	top: max(20px, calc(50vh - (var(--akn-dev-h, 844px) / 2)));
}

/* Screen: pass-through in natural mode, the scroll area in device mode. */
.akn-demo-preview-editor__screen {
	display: contents;
}

.akn-demo-preview-editor.is-device .akn-demo-preview-editor__screen {
	display: block;
	height: 100%;
	max-height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
}

.akn-demo-preview-editor.is-device:not(.is-device-h) .akn-demo-preview-editor__screen {
	height: auto;
	overflow: visible;
	/* Frame reference for section height / sticky overlay layers (builder.css
	   TICKET-011f WS-2) — the editor device preview never gets `body.akn-demo-bp`
	   nor the dock container query, so `--akn-frame-h` would be undefined and
	   the layers would fall back to the full iframe height. */
	--akn-frame-h: calc(100vh - 80px);
}

.akn-demo-preview-editor.is-device.is-device-h .akn-demo-preview-editor__screen {
	--akn-frame-h: min(var(--akn-dev-h, 844px), calc(100vh - 80px));
}

/* Frame toggle ON → device bezel. */
.akn-demo-preview-editor.is-device.is-frame .akn-demo-preview-editor__device {
	border: 12px solid #14161A;
	border-radius: 40px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
}

.akn-demo-preview-editor__sample {
	padding: 22px 20px;
}

.akn-demo-preview-editor__sample strong {
	font-size: 15px;
	display: block;
	margin-bottom: 6px;
}

.akn-demo-preview-editor__sample p {
	margin: 0;
	font-size: 13px;
	color: #5A655F;
	line-height: 1.5;
}

.akn-demo-preview-editor__empty {
	margin: 0;
	padding: 40px 20px;
	font-size: 13px;
	color: #7A8580;
	text-align: center;
}
