/**
 * DCE Stylesheet Editor — New Design v2
 * Replaces legacy Adobe Muse absolute-positioning CSS
 * Prefix: .dce-ss-* for stylesheet-specific styles
 */

/* ============================================
   LAYOUT — Main sections (postbox style WP)
   ============================================ */

.dce-ss-section {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	box-shadow: 0 1px 1px rgba(0,0,0,.04);
	margin-bottom: 20px;
}

.dce-ss-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid #dcdcde;
	padding: 12px 20px;
}

.dce-ss-section-header h2 {
	font-size: 18px;
	font-weight: 400;
	margin: 0;
	padding: 0;
	color: #1d2327;
}

.dce-ss-section-body {
	padding: 20px;
}

/* ============================================
   HEADER — Name + Group row
   ============================================ */

.dce-ss-header-row {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: 20px;
	align-items: end;
}

.dce-ss-field-group {
	display: flex;
	flex-direction: column;
}

.dce-ss-field-group label {
	display: block;
	font-size: 12px;
	font-weight: 500;
	color: #50575e;
	margin-bottom: 4px;
}

.dce-ss-field-group input[type="text"],
.dce-ss-field-group select {
	height: 36px;
	width: 100%;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	padding: 0 12px;
	font-size: 13px;
	color: #1d2327;
	background: #fff;
	box-sizing: border-box;
}

.dce-ss-field-group select {
	padding-right: 28px;
}

.dce-ss-field-group input[type="text"]:focus,
.dce-ss-field-group select:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

/* ============================================
   MAX/MIN CHARACTERS — Global controls
   ============================================ */

.dce-ss-charcount-box {
	margin-top: 20px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #f6f7f7;
	padding: 16px 20px;
}

.dce-ss-charcount-toggle {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.dce-ss-charcount-toggle > input[type="checkbox"] {
	margin-top: 2px;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.dce-ss-charcount-toggle .dce-ss-charcount-label {
	font-size: 13px;
	font-weight: 500;
	color: #1d2327;
}

.dce-ss-charcount-options {
	margin-top: 12px;
	margin-left: 26px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.dce-ss-charcount-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #1d2327;
}

.dce-ss-charcount-row input[type="radio"] {
	width: 16px;
	height: 16px;
	margin: 0;
}

.dce-ss-charcount-computed {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 28px;
	padding: 0 8px;
	border-radius: 3px;
	background: #fff;
	border: 1px solid #dcdcde;
	font-size: 12px;
	color: #50575e;
	box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
}

.dce-ss-charcount-separator {
	color: #8c8f94;
	font-size: 14px;
}

.dce-ss-charcount-input {
	width: 80px !important;
	height: 32px !important;
	border: 1px solid #8c8f94 !important;
	border-radius: 4px !important;
	padding: 0 8px !important;
	font-size: 13px !important;
	text-align: center;
	background: #fff !important;
	box-shadow: inset 0 1px 2px rgba(0,0,0,.07) !important;
	box-sizing: border-box !important;
}

.dce-ss-charcount-input:focus {
	border-color: #2271b1 !important;
	box-shadow: 0 0 0 1px #2271b1 !important;
	outline: none;
}

.dce-ss-charcount-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 1px solid #c3c4c7;
	background: #fff;
	color: #8c8f94;
	font-size: 14px;
	flex-shrink: 0;
}

.dce-ss-charcount-text {
	color: #50575e;
	font-size: 13px;
}

.dce-ss-help-icon {
	color: #c3c4c7;
	font-size: 20px;
	text-decoration: none;
	cursor: help;
	line-height: 1;
}

.dce-ss-help-icon:hover {
	color: #8c8f94;
}

/* ============================================
   DUPLICABLE TOGGLE
   ============================================ */

.dce-ss-duplicable-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 16px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #fff;
	padding: 12px 16px;
}

.dce-ss-duplicable-row span {
	font-size: 13px;
	font-weight: 500;
	color: #1d2327;
}

/* WP-style toggle switch */
.dce-ss-toggle {
	position: relative;
	display: inline-block;
	width: 48px;
	height: 28px;
	flex-shrink: 0;
}

.dce-ss-toggle input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.dce-ss-toggle-slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #c3c4c7;
	border-radius: 14px;
	transition: background-color .2s;
}

.dce-ss-toggle-slider::before {
	position: absolute;
	content: "";
	height: 20px;
	width: 20px;
	left: 4px;
	bottom: 4px;
	background-color: #fff;
	border-radius: 50%;
	transition: transform .2s;
	box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.dce-ss-toggle input:checked + .dce-ss-toggle-slider {
	background-color: #2271b1;
}

.dce-ss-toggle input:checked + .dce-ss-toggle-slider::before {
	transform: translateX(20px);
}

/* ============================================
   FIELD BLOCKS — Container & sortable
   ============================================ */

#divStylesheetTypeField {
	display: none;
	border: none !important;
	padding: 0 !important;
}

.list_stylesheet_fields {
	list-style: none;
	margin: 0;
	padding: 0;
	max-width: none !important;
}

.pageFields {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	margin-bottom: 16px;
	overflow: hidden;
	width: 100% !important;
	box-sizing: border-box;
	padding-bottom: 0 !important;
	float: none !important;
	display: block !important;
}

.pageFields:after {
	display: none;
}

/* ============================================
   FIELD BLOCK — Header (bandeau)
   ============================================ */

.dce-ss-block-header {
	display: grid;
	grid-template-columns: auto 1fr auto auto auto;
	align-items: center;
	gap: 8px;
	background: #f6f7f7;
	border-bottom: 1px solid #dcdcde;
	padding: 10px 16px;
	cursor: pointer;
	position: relative;
	user-select: none;
}

.dce-ss-block-header:hover {
	background: #f0f0f1;
}

.dce-ss-chevron {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	color: #50575e;
	font-size: 18px;
	transition: transform .2s;
	flex-shrink: 0;
}

.dce-ss-chevron.collapsed {
	transform: rotate(-90deg);
}

.dce-ss-block-title {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: #1d2327;
	min-width: 0;
}

.dce-ss-block-title .dce-ss-type-label {
	font-weight: 600;
}

.dce-ss-block-title .dce-ss-field-name {
	color: #50575e;
}

.dce-ss-tag-badge {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 3px;
	background: #fff;
	border: 1px solid #dcdcde;
	font-size: 12px;
	color: #50575e;
	font-family: monospace;
	pointer-events: none;
	box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.dce-ss-block-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	justify-self: end;
}

.dce-ss-block-actions .col-handle {
	cursor: move;
	color: #787c82;
	font-size: 18px;
	line-height: 1;
}

.dce-ss-block-actions .col-handle:hover {
	color: #1d2327;
}

.dce-ss-block-actions .dce-ss-delete-btn {
	color: #b32d2e;
	font-size: 18px;
	text-decoration: none;
	line-height: 1;
}

.dce-ss-block-actions .dce-ss-delete-btn:hover {
	color: #a00;
}

/* ============================================
   FIELD BLOCK — Body (content)
   ============================================ */

.dce-ss-block-body {
	padding: 16px 20px;
}

.dce-ss-block-body.collapsed {
	display: none;
}

.dce-ss-row {
	display: grid;
	gap: 16px;
	align-items: end;
	margin-bottom: 16px;
}

.dce-ss-row:last-child {
	margin-bottom: 0;
}

.dce-ss-row-3col {
	grid-template-columns: 1fr 1fr auto;
}

.dce-ss-row-2col {
	grid-template-columns: 1fr 1fr;
}

.dce-ss-block-field {
	display: flex;
	flex-direction: column;
}

.dce-ss-block-field > label,
.dce-ss-block-field > .dce-ss-label {
	font-size: 12px;
	font-weight: 500;
	color: #50575e;
	margin-bottom: 4px;
}

.dce-ss-block-field input[type="text"],
.dce-ss-block-field input[type="number"] {
	height: 36px;
	width: 100%;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	padding: 0 10px;
	font-size: 13px;
	color: #1d2327;
	background: #fff;
	box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
	box-sizing: border-box;
}

.dce-ss-block-field input[type="text"]:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

.dce-ss-checkbox-inline {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-top: 24px;
	font-size: 13px;
	color: #1d2327;
	white-space: nowrap;
}

.dce-ss-checkbox-inline input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 0;
}

.dce-ss-minmax-row {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 16px;
	margin-top: 16px;
}

.dce-ss-minmax-row .dce-ss-block-field {
	flex-shrink: 0;
}

.dce-ss-overflow-group {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-top: 24px;
}

.dce-ss-overflow-group input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 0;
}

.dce-ss-overflow-group label {
	font-size: 13px;
	color: #1d2327;
	white-space: nowrap;
}

.dce-ss-overflow-group .dce-ss-pct-field {
	width: 50px;
	height: 36px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	padding: 0 8px;
	font-size: 13px;
	text-align: center;
	box-sizing: border-box;
}

.dce-ss-overflow-group .dce-ss-pct-label {
	font-size: 13px;
	color: #50575e;
}

/* ============================================
   CHARACTER STYLES — Complex field
   ============================================ */

.dce-ss-charstyles {
	margin-top: 20px;
	border-top: 1px solid #dcdcde;
	padding-top: 16px;
}

.dce-ss-charstyles-title {
	font-size: 13px;
	font-weight: 500;
	color: #1d2327;
	margin-bottom: 12px;
}

.dce-ss-charstyles-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

.dce-ss-charstyle-icon-row {
	display: flex;
	align-items: end;
	gap: 8px;
}

.dce-ss-charstyle-icon-row input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin-bottom: 10px;
}

.dce-ss-charstyle-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 4px;
	background: #1d2327;
	color: #fff;
	font-size: 18px;
	font-weight: 700;
	flex-shrink: 0;
}

.dce-ss-charstyle-icon.italic {
	font-style: italic;
	font-weight: 400;
}

.dce-ss-charstyle-icon-row .dce-ss-block-field {
	flex: 1;
}

.dce-ss-charstyle-color-row {
	display: grid;
	grid-template-columns: auto 1fr 1fr auto;
	gap: 8px;
	align-items: end;
}

.dce-ss-charstyle-color-row input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin-bottom: 10px;
}

.dce-ss-color-swatch {
	width: 36px;
	height: 36px;
	border-radius: 4px;
	border: 1px solid #8c8f94;
	flex-shrink: 0;
	overflow: hidden;
	position: relative;
}

.prettyprint {
	display: flex;
	align-items: center;
	width: auto;
	height: 36px;
	margin: 0;
}

.prettyprint .ui-button-text-only .ui-button-text {
	padding: 0 !important;
	border: none !important;
}

.prettyprint .ui-button {
	padding: 0;
	margin: 0 4px;
}

#btn_color {
	border: none !important;
	width: 20px;
	vertical-align: middle;
}

.field_input_class_color {
	padding: 0 !important;
	width: 1px !important;
	height: 36px !important;
	border: none !important;
	background: transparent !important;
}

/* ============================================
   LIST FIELD — Items
   ============================================ */

.dce-ss-list-section {
	margin-top: 16px;
	display: grid;
	grid-template-columns: 1.4fr auto 1fr;
	gap: 16px;
	align-items: end;
}

.dce-ss-list-add-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	background: #fff;
	color: #2271b1;
	font-size: 18px;
	cursor: pointer;
	text-decoration: none;
}

.dce-ss-list-add-btn:hover {
	background: #f6f7f7;
	color: #135e96;
}

.dce-ss-list-delete-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	background: #fff;
	color: #b32d2e;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
}

.dce-ss-list-delete-btn:hover {
	background: #fcf0f1;
	color: #a00;
}

.dce-ss-list-elements label {
	font-size: 12px;
	font-weight: 500;
	color: #50575e;
	margin-bottom: 4px;
	display: block;
}

.field_list {
	width: 100% !important;
	min-height: 88px !important;
	height: auto !important;
	border: 1px solid #8c8f94 !important;
	border-radius: 4px;
	background: #fff;
	padding: 8px;
	font-size: 13px;
	color: #1d2327;
	resize: vertical;
}

.dce-ss-list-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
	justify-content: center;
}

/* ============================================
   ADD FIELD — Bottom bar
   ============================================ */

#divStylesheetType {
	border-top: none;
	padding-top: 0;
}

#divStylesheetTypeSelect {
	border: 1px solid #dcdcde !important;
	border-radius: 4px;
	background: #f6f7f7;
	padding: 16px 20px !important;
	margin: 20px auto 0 auto !important;
	width: auto !important;
	min-width: auto !important;
}

#divStylesheetTypeSelect .form-table-general {
	border: none;
	background: none;
	margin: 0;
	padding: 0;
}

.dce-ss-add-field-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
}

.dce-ss-add-field-row label {
	font-size: 13px;
	font-weight: 500;
	color: #1d2327;
}

.dce-ss-add-field-row select {
	height: 36px;
	min-width: 200px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	padding: 0 12px;
	font-size: 13px;
	background: #fff;
}

.dce-ss-add-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #2271b1;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	border: none;
	cursor: pointer;
	text-decoration: none;
	box-shadow: 0 1px 3px rgba(0,0,0,.12);
	transition: background .15s;
}

.dce-ss-add-btn:hover {
	background: #135e96;
	color: #fff;
}

/* ============================================
   BUTTONS — Bottom save/cancel
   ============================================ */

.dce-ss-buttons {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 20px;
}

.dce-ss-buttons .button-primary {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
	padding: 0 16px;
	height: 36px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 4px;
	cursor: pointer;
}

.dce-ss-buttons .button-primary:hover {
	background: #135e96;
	border-color: #135e96;
}

.dce-ss-buttons .button-secondary {
	background: #fff;
	border: 1px solid #8c8f94;
	color: #2c3338;
	padding: 0 16px;
	height: 36px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 4px;
	cursor: pointer;
}

.dce-ss-buttons .button-secondary:hover {
	background: #f6f7f7;
}

/* ============================================
   TOGGLE ALL — Fold/unfold button
   ============================================ */

.dce-ss-toggle-all-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	background: #fff;
	padding: 4px 8px;
	font-size: 16px;
	color: #1d2327;
	cursor: pointer;
	line-height: 1;
}

.dce-ss-toggle-all-btn:hover {
	background: #f6f7f7;
}

/* ============================================
   SAVING INDICATOR
   ============================================ */

#saving_indicator_loading {
	display: none;
	padding: 8px 16px;
	text-align: center;
	color: #50575e;
	font-size: 13px;
	font-style: italic;
}

/* ============================================
   ERROR / WARNING MESSAGE
   ============================================ */

#divStylesheetMaxNumber {
	display: none;
	border: 1px solid #dba617;
	background: #fcf9e8;
	border-radius: 4px;
	margin: 12px 0;
	padding: 10px 16px;
}

#divStylesheetMaxNumber .dce-ss-charcount-msg {
	position: relative;
	padding: 4px 0 4px 22px;
	font-size: 13px;
	line-height: 1.5;
	color: #6d5009;
}

#divStylesheetMaxNumber .dce-ss-charcount-msg::before {
	content: "\26A0";
	position: absolute;
	left: 0;
	top: 3px;
	font-size: 14px;
}

#divStylesheetMaxNumber .dce-ss-charcount-msg + .dce-ss-charcount-msg {
	border-top: 1px solid rgba(219, 166, 23, 0.3);
	margin-top: 4px;
	padding-top: 8px;
}

/* ============================================
   PAGE TITLE
   ============================================ */

.dce-ss-page-title {
	margin-bottom: 20px;
}

.dce-ss-page-title h1 {
	font-size: 23px;
	font-weight: 400;
	margin: 0 0 4px;
	color: #1d2327;
	display: flex;
	align-items: center;
	gap: 12px;
}

.dce-ss-page-title .dce-ss-subtitle {
	font-size: 13px;
	color: #50575e;
	margin: 0;
}

/* ============================================
   DESCRIPTION (creation mode)
   ============================================ */

.dce-ss-description {
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 16px 20px;
	margin-top: 16px;
	font-size: 13px;
	line-height: 1.6;
	color: #50575e;
}

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

@media screen and (max-width: 960px) {
	.dce-ss-header-row {
		grid-template-columns: 1fr;
	}
	.dce-ss-charstyles-grid {
		grid-template-columns: 1fr;
	}
	.dce-ss-row-3col {
		grid-template-columns: 1fr;
	}
	.dce-ss-list-section {
		grid-template-columns: 1fr;
	}
	.dce-ss-tag-badge {
		position: static;
		transform: none;
	}
	.dce-ss-block-header {
		grid-template-columns: auto 1fr auto;
	}
}

/* ============================================
   LEGACY COMPAT — Keep for JS compatibility
   ============================================ */

#list_stylesheet_fields span.col-handle {
	cursor: move;
}

.switch {
	display: none;
}

.dg-sublayer-wrapper > .dg-sublayer-input-field,
.dg-sublayer-wrapper > .dg-sublayer-title,
.dg-sublayer-wrapper > .dg-sublayer-xml-tag,
.dg-sublayer-wrapper > .dg-sublayer-xmltag,
.dg-sublayer-wrapper > .dg-sublayer-required,
.dg-sublayer-wrapper > .dg-sublayer-number,
.dg-sublayer-wrapper > .dg-sublayer-nav,
.dg-sublayer-wrapper > .clear {
	display: none;
}

.dce-ss-block-body .field_input_class,
.dce-ss-block-body .field_input_class_3 {
	padding: 0 10px !important;
	background-color: #fff !important;
	border: 1px solid #8c8f94 !important;
	box-shadow: inset 0 1px 2px rgba(0,0,0,.07) !important;
	border-radius: 4px;
	height: 36px;
	width: 100%;
	font-size: 13px;
	color: #1d2327;
	box-sizing: border-box;
}

.dce-ss-block-body .field_input_class:focus,
.dce-ss-block-body .field_input_class_3:focus {
	border-color: #2271b1 !important;
	box-shadow: 0 0 0 1px #2271b1 !important;
	outline: none;
}

.dce-ss-block-body .field_tag {
	width: 100%;
}

.dce-ss-section .form-table-general {
	border: none;
	background: none;
	margin: 0;
	padding: 0;
}

.dce-ss-block-body .field_numeric {
	width: 100% !important;
	max-width: 100px;
	background: #fff !important;
	border: 1px solid #8c8f94 !important;
}

.dce-ss-block-body .overflow_simple_class,
.dce-ss-block-body .overflow_complex_class {
	width: 50px !important;
}

.dce-ss-block-body .sign_simple_class,
.dce-ss-block-body .sign_complex_class {
	width: 100% !important;
}

/* Hidden char-count inputs — keep accessible for JS */
#cpt_number_stylesheet,
#cpt_number_min_stylesheet {
	border: none !important;
	background: transparent !important;
	width: auto;
	padding: 0;
	margin: 0;
	font-size: 12px;
	color: #50575e;
	pointer-events: none;
	position: absolute;
	opacity: 0;
	height: 0;
}

#lbl_cpt_number_stylesheet,
#lbl_cpt_number_min_stylesheet {
	border: none !important;
	background: transparent !important;
	width: 0;
	height: 0;
	padding: 0;
	margin: 0;
	opacity: 0;
	position: absolute;
}

.max_number_stylesheet,
.min_number_stylesheet {
	width: 80px;
	height: 32px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	padding: 0 8px;
	font-size: 13px;
	text-align: center;
	position: static !important;
	margin: 0 !important;
}

#is_defined_number_total_minimum {
	visibility: hidden;
	position: absolute;
}

.description_stylesheet_group {
	vertical-align: middle;
	text-align: center;
}

#stylesheet-filter .widefat td {
	vertical-align: middle !important;
	padding-bottom: 10px;
	padding-top: 10px;
}

#stylesheet-filter .widefat tbody th.check-column {
	vertical-align: middle !important;
	padding-bottom: 10px;
	padding-top: 10px;
}

#stylesheet_actions {
	width: 200px;
}

#stylesheet_search {
	width: 200px;
}

#iconMinMAx {
	display: none;
}
