/**
 * Widget Settings Page Styles
 *
 * Refined utilitarian layout: toggle card, compact shortcodes,
 * organized sections with preview + fields, collapsible advanced.
 *
 * @link       https://github.com/sitestaffr/sitestaffr-plugin
 * @since      0.11.96
 *
 * @package    SiteStaffr
 * @subpackage SiteStaffr/assets/css
 */

/* ==========================================================================
   SHORTCODE LABEL + CLICKABLE SHORTCODES — in section headers
   ========================================================================== */

.pe-ws-shortcode-label {
	font-size: 12px;
	font-weight: 500;
	color: #646970;
	margin-left: auto;
	margin-right: 6px;
}

.pe-ws-shortcode-click {
	display: inline-flex;
	align-items: center;
	background: #fff;
	padding: 4px 12px;
	border: 1px solid #dcdad4;
	border-radius: 4px;
	font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
	font-size: 12px;
	color: #d63638;
	cursor: pointer;
	transition: all 0.2s ease;
	user-select: all;
	max-width: 100%;
	white-space: normal;
	overflow-wrap: anywhere;
	word-break: break-word;
	overflow: visible;
}

.pe-ws-shortcode-click:hover {
	background: #f0ebe0;
	border-color: #c3c4c7;
}

.pe-ws-shortcode-click.copied {
	color: #00a32a;
	border-color: #00a32a;
	background: #f0faf0;
}

/* ==========================================================================
   SECTION CARDS — Fixed Widget, Button Widget
   ========================================================================== */

.pe-ws-section {
	background: #fff;
	border: 1px solid #e0ddd6;
	border-radius: 10px;
	margin-bottom: 20px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	overflow: visible;
}

.pe-ws-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	row-gap: 8px;
	height: 60px;
	padding: 0 18px;
	border-bottom: 1px solid #f0ebe0;
	border-radius: 10px 10px 0 0;
	background: #FAF8F4;
}

.pe-ws-section-title {
	display: flex;
	align-items: center;
	gap: 0;
}

.pe-ws-section-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1d2327;
	display: flex;
	align-items: center;
	gap: 8px;
}

.pe-ws-section-header h3 .dashicons {
	color: #00838f;
}

/* Auto-display toggle row */
.pe-ws-auto-display-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 24px;
	border-bottom: 1px solid #f0ebe0;
	background: #ffffff;
}

.pe-ws-toggle-label {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	white-space: nowrap;
}

.pe-ws-toggle-label input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.pe-ws-toggle-switch {
	position: relative;
	display: inline-block;
	width: 38px;
	height: 22px;
	background: #c3c4c7;
	border-radius: 11px;
	transition: background 0.2s ease;
	flex-shrink: 0;
}

.pe-ws-toggle-switch::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	background: #ffffff;
	border-radius: 50%;
	transition: transform 0.2s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.pe-ws-toggle-label input:checked + .pe-ws-toggle-switch {
	background: #00838F;
}

.pe-ws-toggle-label input:checked + .pe-ws-toggle-switch::after {
	transform: translateX(16px);
}

.pe-ws-toggle-text {
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
}

.pe-ws-toggle-description {
	font-size: 12px;
	color: #8c8f94;
	line-height: 1.4;
}

.pe-ws-section-body {
	padding: 24px;
}

/* Two-column layout: preview | fields */
.pe-ws-two-col {
	display: grid;
	grid-template-columns: 260px 1fr;
	gap: 32px;
}

/* Preview column */
.pe-ws-preview-col {
	height: fit-content;
	align-self: flex-start;
}

/* Sticky preview variant (used by Button section only) */
.pe-ws-preview-col--sticky {
	position: -webkit-sticky;
	position: sticky;
	top: 72px;
}

/* Fields column */
.pe-ws-fields-col {
	min-width: 0;
}

/* ==========================================================================
   SECTION FOOTER — per-section save button
   ========================================================================== */

.pe-ws-section-footer {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 24px;
	border-top: 1px solid #f0ebe0;
	background: #fff;
}

.pe-ws-save-btn {
	min-width: 160px;
}

.pe-ws-save-status {
	font-size: 13px;
	font-weight: 500;
	color: #00a32a;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.pe-ws-save-status.visible {
	opacity: 1;
}

.pe-ws-save-status.error {
	color: #d63638;
}

/* ==========================================================================
   FORM FIELDS
   ========================================================================== */

/* Single field */
.pe-ws-field {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}

.pe-ws-field > label {
	width: 100px;
	font-size: 13px;
	font-weight: 500;
	color: #1d2327;
	flex-shrink: 0;
}

.pe-ws-field input[type="text"],
.pe-ws-field select {
	width: 240px;
	height: 32px;
	padding: 4px 8px;
	font-size: 13px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
}

.pe-ws-field input[type="checkbox"] {
	margin: 0 5px 0 0;
}

.pe-ws-radius-lock-toggle {
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	line-height: 1;
}

.pe-ws-radius-lock-toggle input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	margin: 0;
}

.pe-ws-radius-lock-toggle .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	color: #8c8f94;
	transition: color 0.15s ease;
}

.pe-ws-radius-lock-toggle:hover .dashicons {
	color: #00838f;
}

.pe-ws-radius-lock-toggle.is-locked .dashicons {
	color: #00838f;
}

.pe-ws-radius-heading {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 12px;
}

.pe-ws-radius-heading-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #00838f;
}

.pe-ws-radius-heading--light {
	margin-bottom: 10px;
}

.pe-ws-radius-heading--light .pe-ws-radius-heading-label {
	color: #50575e;
}

.pe-ws-radius-group.is-locked .pe-ws-radius-input[data-radius-role="slave"] {
	background-color: #f6f7f7;
	color: #8c8f94;
}

/* Compact field variant (inside field-rows) */
.pe-ws-field--compact > label {
	width: auto;
	margin-right: 4px;
}

.pe-ws-field--compact input[type="text"],
.pe-ws-field--compact select {
	width: 110px;
}

/* Field row — multiple compact fields inline */
.pe-ws-field-row {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}

.pe-ws-field-row .pe-ws-field {
	margin-bottom: 0;
	flex: 0 0 auto;
}

/* Color picker width override */
.sitestaffr-color-field {
	max-width: 100px;
}

/* Number input with px suffix */
.pe-ws-input-px {
	display: flex;
	align-items: center;
	gap: 4px;
}

.pe-ws-input-px input[type="number"] {
	width: 70px;
	height: 32px;
	padding: 4px 8px;
	font-size: 13px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	-moz-appearance: textfield;
}

.pe-ws-input-px input[type="number"]::-webkit-inner-spin-button,
.pe-ws-input-px input[type="number"]::-webkit-outer-spin-button {
	opacity: 1;
}

.pe-ws-px-suffix {
	font-size: 12px;
	color: #787c82;
	font-weight: 500;
	user-select: none;
}

/* ==========================================================================
   TABS — section-level tab navigation
   ========================================================================== */

.pe-ws-tabs {
	display: flex;
	gap: 0;
	border-bottom: 2px solid #e8e5dd;
	margin-bottom: 16px;
}

.pe-ws-tab {
	padding: 10px 20px;
	font-size: 13px;
	font-weight: 600;
	color: #50575e;
	background: transparent;
	border: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.pe-ws-tab:hover {
	color: #00838F;
}

.pe-ws-tab.is-active {
	color: #00838F;
	border-bottom-color: #1FB6CC;
}

.pe-ws-tabpanel[hidden] {
	display: none;
}

/* Hide border width/color when style is "none" */
.pe-ws-border-dependent.is-hidden {
	display: none;
}

/* ==========================================================================
   FIELD GROUPS — visual clustering with left accent
   ========================================================================== */

.pe-ws-group {
	padding: 16px 0;
	border-bottom: 1px solid #f0ebe0;
}

.pe-ws-group:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.pe-ws-group:first-child {
	padding-top: 0;
}

.pe-ws-group h4 {
	margin: 0 0 12px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #00838F;
}

/* ==========================================================================
   WIDGET PREVIEWS — re-used from previous version
   ========================================================================== */

/* Fixed Widget Preview */
.sitestaffr-preview-widget-container {
	position: relative;
	width: 100%;
	height: 200px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-radius: 8px;
	overflow: hidden;
}

.sitestaffr-preview-scene {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.sitestaffr-preview-widget {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.sitestaffr-preview-tooltip {
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	padding: 6px 10px;
	border-radius: 6px;
	font-size: 12px;
	white-space: nowrap;
	margin-bottom: 8px;
}

.sitestaffr-preview-branding {
	margin-top: 8px;
	font-size: 11px;
	color: rgba(255, 255, 255, 0.7);
	display: inline-flex;
	align-items: center;
	gap: 2px;
	line-height: 1;
}

.sitestaffr-preview-branding .sitestaffr-tooltip-trigger {
	margin-left: 0;
	display: inline-flex;
	align-items: center;
	line-height: 1;
}

.sitestaffr-preview-branding .dashicons {
	font-size: 13px;
	width: 13px;
	height: 13px;
	line-height: 13px;
	color: rgba(255, 255, 255, 0.7);
}

.sitestaffr-widget-trigger {
	width: 60px;
	height: 60px;
	border-radius: 20px 20px 20px 0;
	border: none;
	background-color: #0073aa;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	transition: all 0.3s ease;
}

.sitestaffr-widget-trigger:hover {
	transform: scale(1.05);
}

.sitestaffr-widget-icon {
	stroke: currentColor;
}

.sitestaffr-widget-branding {
	margin-top: 8px;
	text-align: center;
	font-size: 11px;
	color: rgba(255, 255, 255, 0.9);
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Button Widget Preview */
.sitestaffr-button-preview-container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 80px;
	background: #ffffff;
	border: 1px solid #e8e5dd;
	border-radius: 8px;
	padding: 20px;
}

.sitestaffr-button-preview {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	line-height: 1.4;
}

.sitestaffr-button-preview:hover {
	opacity: 0.9;
}

.sitestaffr-button-preview svg {
	display: block;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1200px) {
	.pe-ws-two-col {
		grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
		gap: 24px;
	}
}

@media (max-width: 1024px) {
	.pe-ws-two-col {
		grid-template-columns: 1fr;
	}

	.pe-ws-preview-col--sticky {
		position: sticky;
		top: 56px; /* WP admin bar 46px + 10px buffer */
	}

	.pe-ws-section-header {
		height: auto;
		min-height: 60px;
		padding: 12px 18px;
		gap: 8px;
	}

	.pe-ws-section-title {
		width: 100%;
	}

	.pe-ws-shortcode-label {
		margin-left: 0;
		display: block;
	}

	.pe-ws-shortcode-click {
		width: 100%;
		overflow: visible;
		white-space: normal;
		overflow-wrap: anywhere;
		word-break: break-word;
	}

	.pe-ws-auto-display-row {
		flex-wrap: wrap;
		padding: 12px 16px;
	}

	.pe-ws-toggle-label {
		white-space: normal;
	}

	.pe-ws-section-footer {
		padding: 14px 16px;
		flex-wrap: wrap;
	}
}

@media (max-width: 782px) {

	.pe-ws-section-body {
		padding: 16px;
	}

	.pe-ws-field {
		flex-direction: column;
		align-items: flex-start;
	}

	.pe-ws-field > label {
		width: 100%;
		margin-bottom: 4px;
	}

	.pe-ws-field input[type="text"],
	.pe-ws-field select {
		width: 100%;
	}

	.pe-ws-field-row {
		flex-direction: column;
		gap: 12px;
	}

	.pe-ws-field--compact input[type="text"],
	.pe-ws-field--compact select {
		width: 100%;
	}

	.sitestaffr-preview-widget-container {
		height: 150px;
	}
}

/* Pulse hover animation for button preview */
@keyframes pe-pulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.05); }
	100% { transform: scale(1); }
}

.pe-preview-pulse {
	animation: pe-pulse 0.6s ease;
}
