<?php
/**
 * Mloun Demo Bar — frontend styles (v1.2).
 *
 * Layout uses CSS custom properties set inline from plugin settings:
 * --mdb-bg, --mdb-text, --mdb-height, --mdb-btn-bg, --mdb-btn-text
 */

.mloun-demo-bar {
	position: relative !important;
	z-index: 99999 !important;
	background: var(--mdb-bg, #1f2937) !important;
	color: var(--mdb-text, #f9fafb) !important;
	height: var(--mdb-height, 56px) !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18) !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
	font-size: 14px !important;
	line-height: 1.4 !important;
	transition: transform 0.3s ease, opacity 0.3s ease !important;
}

/* Override theme styles with higher specificity */
html body .mloun-demo-bar,
div.mloun-demo-bar {
	background: var(--mdb-bg, #1f2937) !important;
	color: var(--mdb-text, #f9fafb) !important;
}

.mloun-demo-bar.mdb-context-page {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
}

body.admin-bar .mloun-demo-bar.mdb-context-page {
	top: 32px;
}

.mloun-demo-bar.mdb-hidden {
	transform: translateY(-110%);
	opacity: 0;
	pointer-events: none;
}

.mdb-inner {
	display: flex;
	align-items: center;
	gap: 16px;
	height: 100%;
	padding: 0 20px;
	max-width: 100%;
	box-sizing: border-box;
	flex-wrap: nowrap;
}

/* Three-section layout */
.mdb-left {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
	flex: 0 0 auto;
}

.mdb-center {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	min-width: 0;
	max-width: 300px;
	margin: 0 auto;
}

.mdb-right {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
	flex: 0 0 auto;
}

/* Logo */
.mdb-logo {
	display: inline-flex;
	align-items: center;
	height: calc(var(--mdb-height, 56px) - 18px);
}

.mdb-logo img {
	max-height: 100%;
	width: auto;
	display: block;
}

/* Site switcher */
.mdb-site-switch select {
	appearance: none;
	background: rgba(255, 255, 255, 0.15) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ffffff' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 10px center;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-radius: 6px;
	color: inherit;
	font-size: 13px;
	font-weight: 600;
	padding: 4px 28px 4px 10px;
	max-width: 200px;
	min-width: 120px;
	height: 32px;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.mdb-site-switch select:hover,
.mdb-site-switch select:focus {
	border-color: #fff;
	background-color: rgba(255, 255, 255, 0.22);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	outline: none;
}

.mdb-site-switch select option {
	color: #111827;
	background: #ffffff;
	font-weight: 500;
}

/* Custom text */
.mdb-custom-text {
	font-size: 13px;
	font-weight: 500;
	opacity: 0.9;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Device switcher */
.mdb-devices {
	display: flex;
	align-items: center;
	gap: 4px;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 8px;
	padding: 4px;
}

.mdb-device {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 30px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	opacity: 0.65;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease;
	padding: 0;
}

.mdb-device:hover {
	opacity: 1;
}

.mdb-device.is-active {
	background: rgba(255, 255, 255, 0.18);
	opacity: 1;
}

/* Contact icons */
.mdb-contact {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	opacity: 0.9;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
	text-decoration: none;
	padding: 0;
}

.mdb-contact:hover {
	opacity: 1 !important;
	background: rgba(255, 255, 255, 0.2) !important;
	color: inherit !important;
	transform: scale(1.08);
}

/* Make sure QR trigger also gets the same hover style */
.mdb-contact.mdb-qr-trigger:hover {
	opacity: 1 !important;
	background: rgba(255, 255, 255, 0.2) !important;
}

/* QR popup */
.mdb-qr {
	position: relative;
	display: inline-flex;
}

.mdb-qr-popup {
	position: absolute;
	top: calc(100% + 12px);
	right: 0;
	background: #ffffff;
	border-radius: 10px;
	padding: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	z-index: 100000;
}

.mdb-qr-popup::before {
	content: "";
	position: absolute;
	top: -6px;
	right: 14px;
	width: 12px;
	height: 12px;
	background: #ffffff;
	transform: rotate(45deg);
}

.mdb-qr-popup img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}

.mdb-qr:hover .mdb-qr-popup {
	display: block;
}

.mdb-qr-popup[hidden] {
	display: none !important;
}

/* Purchase button */
.mdb-purchase {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--mdb-btn-bg, #10b981);
	color: var(--mdb-btn-text, #ffffff);
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding: 8px 18px;
	text-decoration: none;
	white-space: nowrap;
	transition: filter 0.15s ease, transform 0.1s ease;
}

.mdb-purchase:hover {
	filter: brightness(1.1);
	color: var(--mdb-btn-text, #ffffff);
}

.mdb-purchase:active {
	transform: translateY(1px);
}

.mdb-purchase[hidden] {
	display: none !important;
}

/* Close button */
.mdb-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	opacity: 0.7;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease;
	padding: 0;
}

.mdb-close:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.12);
}

/* ------------------------------------------------------------------
 * Preview area (full demo page)
 * ------------------------------------------------------------------ */

body.mloun-demo-bar-page {
	margin: 0;
	padding: 0;
	background: #f3f4f6;
}

/* Fix white line below bar */
body.mloun-demo-bar-page .mloun-demo-bar {
	margin-bottom: 0 !important;
	padding-bottom: 0 !important;
	border-bottom: none !important;
}

body.mloun-demo-bar-page .mdb-frame-wrap {
	padding-top: var(--mdb-height, 56px);
	height: 100vh;
	overflow: hidden;
	box-sizing: border-box;
}

body.admin-bar .mloun-demo-bar-page .mdb-frame-wrap {
	padding-top: calc(var(--mdb-height, 56px) + 32px);
}

.mdb-frame-wrap {
	display: flex;
	justify-content: center;
	height: calc(100vh - var(--mdb-height, 56px));
	overflow: hidden;
	box-sizing: border-box;
	transition: padding 0.3s ease;
}

.mdb-frame-wrap.mdb-fullscreen {
	padding-top: 0 !important;
}

.mdb-frame-inner {
	width: 100%;
	height: 100%;
	margin: 0;
	background: #ffffff;
	transition: width 0.35s ease;
	overflow: hidden;
	box-sizing: border-box;
}

body.mloun-demo-bar-page .mdb-frame-inner {
	height: calc(100vh - var(--mdb-height, 56px));
}

body.admin-bar.mloun-demo-bar-page .mdb-frame-inner {
	height: calc(100vh - var(--mdb-height, 56px) - 32px);
}

.mdb-frame-wrap.mdb-fullscreen .mdb-frame-inner {
	height: 100vh;
	max-width: 100% !important;
}

.mdb-frame-inner.mdb-framed {
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.18);
}

.mdb-frame-inner iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #ffffff;
}

.mdb-empty {
	padding: 60px 20px;
	text-align: center;
	color: #6b7280;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ------------------------------------------------------------------
 * Shortcode embed
 * ------------------------------------------------------------------ */

.mloun-demo-bar-embed {
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	overflow: hidden;
	background: #ffffff;
}

.mloun-demo-bar-embed .mdb-frame-wrap {
	height: var(--mdb-embed-height, 600px);
}

/* ------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------ */

@media screen and (max-width: 900px) {
	.mdb-devices {
		display: none;
	}

	.mdb-custom-text {
		display: none;
	}

	.mdb-inner {
		gap: 10px;
		padding: 0 12px;
	}
}

@media screen and (max-width: 782px) {
	body.admin-bar .mloun-demo-bar.mdb-context-page {
		top: 46px;
	}

	body.admin-bar.mloun-demo-bar-page .mdb-frame-wrap {
		padding-top: calc(var(--mdb-height, 56px) + 46px);
	}

	body.admin-bar.mloun-demo-bar-page .mdb-frame-inner {
		height: calc(100vh - var(--mdb-height, 56px) - 46px);
	}
}

@media screen and (max-width: 560px) {
	.mdb-site-switch select {
		max-width: 130px;
	}

	.mdb-purchase {
		padding: 7px 12px;
	}

	.mdb-contact:not(.mdb-qr-trigger) {
		display: none;
	}
}
