/**
 * Serafino App Shell v4.7.4 — takeover + header unificato + layout shop stabile.
 */

:root {
	--sof-app-max-width: 1760px;
	--sof-app-gutter: clamp(12px, 3vw, 48px);
	--sof-app-sidebar-w: 320px;
	--sof-app-cart-w: 420px;
	--sof-app-font-base: 17px;
	--sof-app-line: 1.6;
	--sof-app-gold: #efc973;
	--sof-app-bg: #050403;
	--sof-app-surface: #181411;
	--sof-app-cream: #f6efe4;
}

html.sof-app-mode-active,
body.sof-app-mode-active,
body.sof-app-takeover {
	width: 100%;
	min-height: 100%;
	margin: 0 !important;
	padding: 0 !important;
	background: var(--sof-app-bg) !important;
	overflow-x: hidden !important;
	font-size: var(--sof-app-font-base);
	line-height: var(--sof-app-line);
}

html.sof-app-mode-active {
	margin-top: 0 !important;
}

body.sof-app-mode-active #wpadminbar {
	display: none !important;
}

.sof-app-root {
	width: 100%;
	min-height: 100vh;
	min-height: 100dvh;
	margin: 0;
	padding: 0;
	background: var(--sof-app-bg);
}

.sof-app-shell--fullscreen {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
}

.sof-app-shell__main {
	width: 100%;
	max-width: var(--sof-app-max-width);
	margin: 0 auto;
	padding: 0 var(--sof-app-gutter) clamp(32px, 4vw, 56px);
	box-sizing: border-box;
}

.sof-global-nav,
body.sof-app-mode-active .sof-global-nav,
body.sof-app-mode-active .sof-density-control {
	display: none !important;
}

/* ── Header app unificato ── */
.sof-app-header {
	position: sticky;
	top: 0;
	z-index: 500;
	width: 100%;
	padding: 14px var(--sof-app-gutter);
	background: linear-gradient(180deg, rgba(5, 4, 3, 0.99), rgba(5, 4, 3, 0.95));
	border-bottom: 1px solid rgba(211, 154, 53, 0.35);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.sof-app-header__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 16px 24px;
	max-width: var(--sof-app-max-width);
	margin: 0 auto;
	box-sizing: border-box;
}

.sof-app-header__left,
.sof-app-header__right {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	min-width: 0;
	max-width: 100%;
}

.sof-app-header__left { justify-content: flex-start; }
.sof-app-header__right { justify-content: flex-end; }
.sof-app-header__center { justify-self: center; text-align: center; min-width: 0; }

.sof-app-nav__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	max-width: 100%;
	padding: 10px 16px;
	font-size: 0.95rem;
	font-weight: 600;
	color: rgba(246, 239, 228, 0.88) !important;
	text-decoration: none;
	border-radius: 12px;
	border: 1px solid rgba(246, 239, 228, 0.14);
	background: transparent;
	white-space: normal;
	text-align: center;
	box-sizing: border-box;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sof-app-nav__link:hover,
.sof-app-nav__link:focus-visible {
	color: var(--sof-app-gold) !important;
	border-color: rgba(211, 154, 53, 0.45);
	background: rgba(211, 154, 53, 0.12);
	outline: none;
}

.sof-app-nav__link.is-current {
	color: var(--sof-app-gold) !important;
	border-color: rgba(211, 154, 53, 0.55);
	background: rgba(122, 56, 69, 0.35);
}

.sof-app-nav__link--home {
	color: var(--sof-app-gold) !important;
	border-color: rgba(211, 154, 53, 0.5);
	background: rgba(211, 154, 53, 0.14);
}

.sof-app-header__logout {
	display: inline-flex;
	margin: 0;
}

.sof-app-header__logout .sof-btn--compact {
	min-height: 44px;
	padding: 10px 16px;
	font-size: 0.95rem;
}

.sof-app-header__logo-link {
	display: inline-block;
	text-decoration: none;
}

.sof-app-header__logo-img {
	max-height: 72px;
	max-width: 320px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.sof-app-header__logo-text {
	font-family: Georgia, "Times New Roman", serif;
	font-size: clamp(1.25rem, 2.2vw, 1.85rem);
	font-weight: 600;
	color: var(--sof-app-gold);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* ── Contenuto generale ── */
body.sof-app-mode-active .sof-shop,
body.sof-app-mode-active .sof-front-wrap,
body.sof-app-mode-active .sof-customer-area,
body.sof-app-mode-active .sof-owner-dashboard {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
}

body.sof-app-mode-active .sof-role-banner {
	display: none;
}

body.sof-app-mode-active .sof-shop__hero,
body.sof-app-mode-active .sof-owner-dashboard__hero,
body.sof-app-mode-active .sof-customer-area__hero {
	padding: 20px 0 24px;
}

body.sof-app-mode-active .sof-shop__title,
body.sof-app-mode-active .sof-owner-dashboard__title {
	font-size: clamp(1.65rem, 2.4vw, 2rem);
	margin: 0 0 8px;
	color: var(--sof-app-gold);
}

body.sof-app-mode-active .sof-shop__subtitle,
body.sof-app-mode-active .sof-owner-dashboard__subtitle {
	font-size: 1rem;
	max-width: 720px;
	color: rgba(246, 239, 228, 0.78);
	margin: 0;
}

/* ── Layout negozio: 3 colonne stabili desktop ── */
body.sof-app-mode-active .sof-shop__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 32px;
	align-items: start;
}

@media (min-width: 1280px) {
	body.sof-app-mode-active .sof-shop__layout,
	body.sof-app-mode-active .sof-shop-layout--three_columns .sof-shop__layout {
		grid-template-columns: var(--sof-app-sidebar-w) minmax(0, 1fr) var(--sof-app-cart-w);
		gap: 32px;
	}
}

body.sof-app-mode-active .sof-shop__sidebar,
body.sof-app-mode-active .sof-shop__catalog,
body.sof-app-mode-active .sof-shop__cart {
	min-width: 0;
	max-width: 100%;
}

body.sof-app-mode-active .sof-shop__catalog {
	grid-column: auto;
	overflow: visible;
}

body.sof-app-mode-active .sof-shop__cart-inner {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

@media (min-width: 1280px) {
	body.sof-app-mode-active .sof-shop-sticky {
		position: sticky;
		top: 100px;
		max-height: calc(100dvh - 112px);
		overflow-y: auto;
		overscroll-behavior: contain;
	}
}

/* Sidebar, checkout, card */
body.sof-app-mode-active .sof-shop__sidebar .sof-card-front,
body.sof-app-mode-active .sof-shop__cart .sof-card-front,
body.sof-app-mode-active .sof-card-front {
	padding: 24px;
	font-size: 16px;
	border-radius: 20px;
	border: 1px solid rgba(211, 154, 53, 0.28);
	background: var(--sof-app-surface);
}

body.sof-app-mode-active .sof-shop .sof-form-row label {
	font-size: 15px;
	font-weight: 600;
}

body.sof-app-mode-active .sof-shop .sof-form-row input,
body.sof-app-mode-active .sof-shop .sof-form-row select,
body.sof-app-mode-active .sof-shop .sof-form-row textarea {
	min-height: 48px;
	font-size: 1rem;
	padding: 12px 16px;
}

body.sof-app-mode-active #sof-btn-submit-order {
	min-height: 52px;
	font-size: 1.05rem;
	width: 100%;
	font-weight: 700;
}

/* ── Login staff / cliente ── */
body.sof-app-mode-active .sof-auth-wrap {
	max-width: 480px;
	margin: 32px auto;
	padding: 0;
}

body.sof-app-mode-active .sof-staff-login-screen .sof-card-front,
body.sof-app-mode-active .sof-customer-area > .sof-card-front {
	padding: 32px;
	border-radius: 22px;
}

body.sof-app-mode-active .sof-staff-login-screen h2,
body.sof-app-mode-active .sof-customer-area > .sof-card-front h2 {
	margin-top: 0;
	font-size: 1.5rem;
	color: var(--sof-app-gold);
}

body.sof-app-mode-active .sof-login-form .sof-form-row input {
	min-height: 52px;
	font-size: 1rem;
}

body.sof-app-mode-active .sof-btn--wide {
	width: 100%;
	min-height: 52px;
	margin-top: 8px;
}

/* ── Area staff / cliente ── */
body.sof-app-mode-active .sof-customer-area__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
	gap: 24px;
}

body.sof-app-mode-active .sof-owner-dashboard__analytics,
body.sof-app-mode-active .sof-owner-dashboard__console {
	margin-top: 24px;
}

body.sof-app-mode-active .sof-access-denied {
	max-width: 560px;
	margin: 32px auto;
}

/* Mobile header */
@media (max-width: 900px) {
	.sof-app-header__inner {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		grid-template-areas:
			"left right"
			"center center";
	}

	.sof-app-header__left { grid-area: left; min-width: 0; }
	.sof-app-header__right { grid-area: right; justify-content: flex-end; min-width: 0; }
	.sof-app-header__center { grid-area: center; padding-top: 8px; }

	.sof-app-nav__link {
		min-height: 40px;
		padding: 8px 12px;
		font-size: 0.88rem;
	}

	body.sof-app-mode-active .sof-shop[data-sof-surface="shop"] {
		padding-bottom: 96px;
	}
}

@media (max-width: 640px) {
	.sof-app-header__left,
	.sof-app-header__right {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
		width: 100%;
	}

	.sof-app-header__left .sof-app-nav__link,
	.sof-app-header__right .sof-app-nav__link,
	.sof-app-header__right .sof-app-header__logout .sof-btn--compact {
		width: 100%;
		justify-content: center;
	}
}

@media (max-width: 520px) {
	.sof-app-header__left,
	.sof-app-header__right {
		grid-template-columns: 1fr;
	}

	.sof-app-header__left .sof-app-nav__link,
	.sof-app-header__right .sof-app-nav__link,
	.sof-app-header__right .sof-app-header__logout .sof-btn--compact {
		padding: 8px 10px;
		font-size: 0.82rem;
	}
}
