/*----------------------------------------*/
/*  Section Card Layout
/*  Modern card-based docs builder UI.
/*----------------------------------------*/

// ==========================================================
//  SECTION LIST – container for all section cards
// ==========================================================
.ezd-section-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 20px;
	margin-bottom: 24px;
}

.ezd-section-card {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
	box-shadow:
		0 2px 4px -1px rgba(0, 0, 0, 0.04),
		0 1px 2px -1px rgba(0, 0, 0, 0.03);
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

	&:hover {
		border-color: #cbd5e1;
		box-shadow:
			0 6px 12px -3px rgba(0, 0, 0, 0.06),
			0 3px 5px -2px rgba(0, 0, 0, 0.03);
	}

	&.dd-is-dragging {
		opacity: 0.4;
		box-shadow: none;
		transform: none;
	}
}

// ==========================================================
//  SECTION HEADER – top bar of each card
// ==========================================================
.ezd-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	gap: 10px;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s ease;
	background-color: #f7f4f442;
}

.ezd-section-card:not(.ezd-section-collapsed) .ezd-section-header {
	border-bottom-color: #e2e8f0;
	background-color: #f4f4ff;
}

.ezd-section-header-left {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

// Drag handle – 6-dot grip
.ezd-section-drag-handle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	cursor: grab;
	color: #94a3b8;
	flex-shrink: 0;
	border-radius: 5px;
	transition: all 0.2s ease;

	&:hover {
		color: var(--ezd-drag-handle-hover-color, #4f46e5);
		background: #f1f5f9;
	}

	&:active {
		cursor: grabbing;
		background: #e2e8f0;
	}
}

// Collapse/expand chevron button
.ezd-section-collapse-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	color: #64748b;
	border-radius: 5px;
	flex-shrink: 0;
	transition: all 0.2s ease;

	&:hover {
		color: #1e293b;
		background: #f1f5f9;
	}

	&:focus {
		outline: none;
		box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
	}
}

.ezd-section-chevron {
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

	&.ezd-chevron-collapsed {
		transform: rotate(-90deg);
	}
}

// Vote pie chart (outlined donut)
.ezd-vote-pie {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	cursor: help;
	border-radius: 50%;

	svg {
		display: block;
	}
}



// Numbered badge
.ezd-section-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
	color: #4338ca;
	font-size: 12px;
	font-weight: 700;
	border-radius: 6px;
	flex-shrink: 0;
	line-height: 1;
	box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.35);
}

// Post status badge (draft / private / protected) – icon-only
// Icon colors match the filter bar (easydocs-btn-*-light --btn-icon values).
.ezd-section-status-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 6px;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	flex-shrink: 0;
	cursor: default;

	.dashicons {
		font-size: 13px;
		width: 13px;
		height: 13px;
	}

	// Private – blue (#0275d8, matches easydocs-btn-blue-light)
	&.ezd-status-private {
		background: #eff6ff;
		border-color: #bfdbfe;

		.dashicons {
			color: #0275d8;
		}
	}

	// Protected – orange (#cc8033, matches easydocs-btn-orange-light)
	&.ezd-status-protected {
		background: #fff7ed;
		border-color: #fed7aa;

		.dashicons {
			color: #cc8033;
		}
	}

	// Draft – dark grey (#424242, matches easydocs-btn-gray-light)
	&.ezd-status-draft {
		background: #f9fafb;
		border-color: #d1d5db;

		.dashicons {
			color: #424242;
		}
	}
}

// Section title
.ezd-section-title-text {
	font-size: 14.5px;
	font-weight: 600;
	color: #0f172a;
	margin: 0;
	line-height: 1.35;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 0 1 auto;
	transition: color 0.2s ease;

	a {
		color: inherit;
		text-decoration: none;
		transition: color 0.2s ease;

		&:hover {
			color: #4f46e5;
		}
	}
}

// Header action icons (right side)
.ezd-section-header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
	opacity: 0;
	transform: translateX(6px);
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ezd-section-header:hover .ezd-section-header-actions {
	opacity: 1;
}

.ezd-header-action-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 6px;
	color: #94a3b8;
	text-decoration: none;
	background: transparent;
	transition: all 0.2s ease;

	&:hover {
		color: #1e293b;
		background: #f1f5f9;
		transform: scale(1.05);
	}

	&.ezd-header-action-delete:hover {
		color: #ef4444;
		background: #fef2f2;
	}
}

.ezd-inline-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 5px 8px;
	border-radius: 4px;
	color: #9ca3af;
	text-decoration: none;
	transition:
		color 0.15s ease,
		background 0.15s ease;

	.dashicons {
		font-size: 15px;
		width: 15px;
		height: 15px;
		color: #9ca3af;
	}

	&:hover {
		color: #374151;
		background: #f3f4f6;
	}

	&.ezd-inline-action-delete:hover {
		color: #dc2626;
		background: #fef2f2;
	}

	&.eazydocs-pro-notice {
		.dashicons {
			color: #f1bd6c;
		}
	}
}

// Nested children indentation
.ezd-child-nested {
	padding-left: 20px;
}

// ==========================================================
//  EXPANDED / ACTIVE STATE – compact children area
// ==========================================================

// Children wrapper
.ezd-section-children-box {
	padding: 6px 10px 10px !important; // Override inline style
}

// Nested section list inside an expanded card: tighter spacing
.ezd-section-card > .ezd-section-children-box .ezd-section-list {
	gap: 5px;
	margin-top: 0;
	margin-bottom: 0;
}

// ── Nested child cards: flat row appearance ──
.ezd-section-card .ezd-section-card {
	border-radius: 6px;
	box-shadow: none;
	border-color: transparent;
	background: transparent;

	&:not(.ezd-section-collapsed),
	&:hover {
		border-color: #e2e8f0;
		box-shadow: none;
	}

	&.has-child:not(.ezd-section-collapsed) {
		border-color: #e2e8f0;
		box-shadow: none;
		> .ezd-section-header {
			background-color: #f8fafc;
		}
	}

	// Child card header: compact row
	.ezd-section-header {
		padding: 6px 8px;
		gap: 6px;
		border-bottom: none;
		background-color: transparent;
	}

	// No expanded-header styling on nested items
	&:not(.ezd-section-collapsed) .ezd-section-header {
		border-bottom-color: transparent;
		background-color: transparent;
	}

	// Smaller title in child rows
	.ezd-section-title-text {
		font-size: 13.5px;
		font-weight: 500;
	}

	// Smaller drag handle in child rows
	.ezd-section-drag-handle {
		width: 20px;
		height: 20px;
		opacity: 0;
		transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
	}

	&:hover > .ezd-section-header .ezd-section-drag-handle {
		opacity: 1;
	}

	// Smaller collapse chevron in child rows
	.ezd-section-collapse-btn {
		width: 20px;
		height: 20px;
	}

	// Smaller number badge in child rows
	.ezd-section-number {
		min-width: 18px;
		height: 18px;
		padding: 0 5px;
		font-size: 11px;
	}

	// Smaller action icons
	.ezd-header-action-icon {
		width: 26px;
		height: 26px;
	}

	// Status badge
	.ezd-section-status-badge {
		width: 18px;
		height: 18px;
		border-radius: 4px;

		.dashicons {
			font-size: 11px;
			width: 11px;
			height: 11px;
		}
	}
}

// Empty drop-zone inside expanded cards
.ezd-empty-dropzone {
	display: block;
	padding: 16px !important;
	margin-top: 4px !important;
	font-size: 13px !important;
	text-align: center;
	border: 1px dashed #e2e8f0 !important;
	color: #94a3b8 !important;
	border-radius: 6px;
}

// ==========================================================
//  COLLAPSED STATE
// ==========================================================
.ezd-section-collapsed {
	.ezd-section-body {
		display: none;
	}
}



// ==========================================================
//  ADD SUB-LESSON BUTTON
// ==========================================================
.ezd-add-sub-lesson-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 10px 20px;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	color: #374151;
	font-size: 12.5px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s ease;
	margin-top: 10px;

	&:hover {
		border-color: #9ca3af;
		background: #f9fafb;
		color: #111827;
	}

	&:focus {
		outline: none;
		box-shadow: 0 0 0 3px rgba(76, 76, 241, 0.12);
		border-color: var(--clr-blue, #4c4cf1);
	}

	&:active {
		transform: scale(0.98);
	}
}

.ezd-add-sub-lesson-icon {
	font-size: 16px;
	font-weight: 400;
	line-height: 1;
	color: #6b7280;
}

// ==========================================================
//  DRAG STATES FOR SECTION CARDS
// ==========================================================
body.ezd-is-dragging {
	.ezd-section-header-actions,
	.ezd-child-actions {
		opacity: 0 !important;
	}

	.ezd-child-row:hover {
		background: transparent;
	}

	.ezd-section-card:hover {
		border-color: #e2e6ea;
		box-shadow: none;
	}
}

// Drop indicator line – shown at the exact drop position during cross-container drags.
.ezd-drop-indicator {
	position: relative;
	height: 2px;
	margin: 2px 0;
	z-index: 10;
	pointer-events: none;
}

.ezd-drop-indicator-dot {
	position: absolute;
	left: -4px;
	top: -3px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #6366f1;
}

.ezd-drop-indicator-line {
	height: 2px;
	background: #6366f1;
	border-radius: 1px;
}

// ==========================================================
//  RTL SUPPORT
// ==========================================================
body.rtl {
	.ezd-section-header-left {
		flex-direction: row-reverse;
	}

	.ezd-child-nested {
		padding-left: 0;
		padding-right: 20px;
	}

	.ezd-section-header-actions {
		flex-direction: row-reverse;
	}

	.ezd-drop-indicator-dot {
		left: auto;
		right: -4px;
	}
}
