/**
 * GoValid QR Label Layout styles.
 *
 * Full-screen modal overlay for designing and exporting
 * printable QR code label sheets.
 *
 * @package GoValid_QR
 */

/* --------------------------------------------------------
   CSS Custom Properties (scoped to overlay)
   -------------------------------------------------------- */
.govalid-label-layout-overlay {
	--gv-primary: #2563eb;
	--gv-primary-light: #dbeafe;
	--gv-primary-dark: #1e40af;
	--gv-gray-50: #f9fafb;
	--gv-gray-100: #f3f4f6;
	--gv-gray-200: #e5e7eb;
	--gv-gray-300: #d1d5db;
	--gv-gray-400: #9ca3af;
	--gv-gray-500: #6b7280;
	--gv-gray-600: #4b5563;
	--gv-gray-700: #374151;
	--gv-gray-800: #1f2937;
	--gv-gray-900: #111827;
	--gv-radius: 10px;
	--gv-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	--gv-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
	--gv-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* --------------------------------------------------------
   Overlay & Container
   -------------------------------------------------------- */
.govalid-label-layout-overlay {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	flex-direction: column;
}

.govalid-label-layout-container {
	width: 100%;
	height: 100%;
	background: #fff;
	display: flex;
	flex-direction: column;
}

/* --------------------------------------------------------
   Header Bar
   -------------------------------------------------------- */
.govalid-ll-header {
	height: 56px;
	min-height: 56px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px;
	background: var(--gv-gray-800);
	color: #fff;
	box-sizing: border-box;
}

.govalid-ll-header-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.govalid-ll-header-left .dashicons {
	color: #fff;
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.govalid-ll-header-left h2 {
	margin: 0;
	font-size: 16px;
	color: #fff;
	font-weight: 600;
	line-height: 1;
}

.govalid-ll-header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.govalid-ll-header-actions .govalid-btn {
	font-size: 12px;
	padding: 5px 10px;
}

.govalid-ll-header-actions .govalid-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* --------------------------------------------------------
   Close Button
   -------------------------------------------------------- */
.govalid-ll-close-btn {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--gv-transition);
}

.govalid-ll-close-btn:hover {
	background: rgba(255, 255, 255, 0.15);
}

.govalid-ll-close-btn .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
}

/* --------------------------------------------------------
   Body (two-panel layout)
   -------------------------------------------------------- */
.govalid-ll-body {
	display: flex;
	flex-direction: row;
	flex: 1;
	overflow: hidden;
}

/* --------------------------------------------------------
   Controls Panel (left)
   -------------------------------------------------------- */
.govalid-ll-controls {
	width: 320px;
	min-width: 320px;
	overflow-y: auto;
	background: #fff;
	border-right: 1px solid var(--gv-gray-200);
	padding: 16px;
	box-sizing: border-box;
}

/* --------------------------------------------------------
   Accordion Sections
   -------------------------------------------------------- */
.govalid-ll-section {
	margin-bottom: 12px;
	border-bottom: 1px solid var(--gv-gray-200);
	padding-bottom: 12px;
}

.govalid-ll-section:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.govalid-ll-section-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	user-select: none;
	margin: 0 0 8px;
	padding: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--gv-gray-800);
	line-height: 1.4;
	background: none;
	border: none;
	width: 100%;
	text-align: left;
}

.govalid-ll-section-toggle:hover {
	color: var(--gv-primary);
}

.govalid-ll-section-toggle .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	color: var(--gv-gray-400);
	transition: transform var(--gv-transition);
}

.govalid-ll-section.collapsed .govalid-ll-section-toggle .dashicons {
	transform: rotate(-90deg);
}

.govalid-ll-section-body {
	overflow: hidden;
}

.govalid-ll-section.collapsed .govalid-ll-section-body {
	display: none;
}

/* --------------------------------------------------------
   Form Fields
   -------------------------------------------------------- */
.govalid-ll-field {
	margin-bottom: 10px;
}

.govalid-ll-field:last-child {
	margin-bottom: 0;
}

.govalid-ll-field > label {
	display: block;
	font-size: 12px;
	color: var(--gv-gray-600);
	margin-bottom: 4px;
	font-weight: 500;
	line-height: 1.4;
}

.govalid-ll-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

/* --------------------------------------------------------
   Input Controls
   -------------------------------------------------------- */
.govalid-ll-input {
	width: 100%;
	padding: 6px 8px;
	border: 1px solid var(--gv-gray-300);
	border-radius: 6px;
	font-size: 13px;
	color: var(--gv-gray-800);
	background: #fff;
	box-sizing: border-box;
	transition: border-color var(--gv-transition), box-shadow var(--gv-transition);
}

.govalid-ll-input:focus {
	outline: none;
	border-color: var(--gv-primary);
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Range slider */
.govalid-ll-range {
	width: 100%;
	accent-color: var(--gv-primary);
	cursor: pointer;
}

/* Color picker */
.govalid-ll-color {
	width: 32px;
	height: 32px;
	border: none;
	cursor: pointer;
	padding: 0;
	border-radius: 4px;
	background: none;
}

.govalid-ll-color::-webkit-color-swatch-wrapper {
	padding: 2px;
}

.govalid-ll-color::-webkit-color-swatch {
	border: 1px solid var(--gv-gray-300);
	border-radius: 4px;
}

/* Radio group */
.govalid-ll-radio-group {
	display: flex;
	flex-direction: row;
	gap: 12px;
}

.govalid-ll-radio {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	color: var(--gv-gray-700);
	cursor: pointer;
}

.govalid-ll-radio input[type="radio"] {
	accent-color: var(--gv-primary);
}

/* Style buttons (bold, italic, etc.) */
.govalid-ll-style-btn {
	width: 28px;
	height: 28px;
	border: 1px solid var(--gv-gray-300);
	background: #fff;
	cursor: pointer;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--gv-gray-600);
	font-size: 13px;
	transition: background var(--gv-transition), color var(--gv-transition),
		border-color var(--gv-transition);
}

.govalid-ll-style-btn:hover {
	background: var(--gv-gray-50);
	border-color: var(--gv-gray-400);
}

.govalid-ll-style-btn.active {
	background: var(--gv-primary);
	color: #fff;
	border-color: var(--gv-primary);
}

.govalid-ll-btn-group > div {
	display: flex;
	flex-direction: row;
	gap: 4px;
}

/* --------------------------------------------------------
   Frame Selector Grid
   -------------------------------------------------------- */
.govalid-ll-frame-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.govalid-ll-frame-option {
	width: 48px;
	height: 48px;
	border: 2px solid var(--gv-gray-200);
	border-radius: 6px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background: #fff;
	transition: border-color var(--gv-transition), background var(--gv-transition);
}

.govalid-ll-frame-option:hover {
	border-color: var(--gv-gray-400);
}

.govalid-ll-frame-option.active {
	border-color: var(--gv-primary);
	background: var(--gv-primary-light);
}

.govalid-ll-frame-option img {
	max-width: 36px;
	max-height: 36px;
	object-fit: contain;
}

/* --------------------------------------------------------
   QR Tags
   -------------------------------------------------------- */
.govalid-ll-qr-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	max-height: 200px;
	overflow-y: auto;
}

.govalid-ll-qr-tag {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: var(--gv-gray-100);
	border: 1px solid var(--gv-gray-200);
	border-radius: 20px;
	padding: 3px 6px 3px 10px;
	font-size: 12px;
	color: var(--gv-gray-700);
	cursor: grab;
	max-width: 100%;
	box-sizing: border-box;
	transition: background var(--gv-transition), border-color var(--gv-transition);
}

.govalid-ll-qr-tag:hover {
	background: var(--gv-gray-200);
}

.govalid-ll-qr-tag-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 150px;
}

.govalid-ll-qr-tag-remove {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--gv-gray-300);
	color: #fff;
	border: none;
	cursor: pointer;
	font-size: 12px;
	line-height: 18px;
	text-align: center;
	flex-shrink: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--gv-transition);
}

.govalid-ll-qr-tag-remove:hover {
	background: var(--gv-primary);
}

/* SortableJS drag states */
.govalid-ll-qr-tag.sortable-ghost {
	opacity: 0.4;
}

.govalid-ll-qr-tag.sortable-drag {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------
   Preview Area (right panel)
   -------------------------------------------------------- */
.govalid-ll-preview-area {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: var(--gv-gray-100);
	overflow: hidden;
}

/* Preview Toolbar */
.govalid-ll-preview-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 16px;
	background: #fff;
	border-bottom: 1px solid var(--gv-gray-200);
	flex-shrink: 0;
}

/* Zoom Controls */
.govalid-ll-zoom-controls {
	display: flex;
	align-items: center;
	gap: 4px;
}

.govalid-ll-zoom-btn {
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--gv-gray-300);
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	color: var(--gv-gray-600);
	transition: background var(--gv-transition);
	padding: 0;
}

.govalid-ll-zoom-btn:hover {
	background: var(--gv-gray-100);
}

.govalid-ll-zoom-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

#govalid-ll-zoom-level {
	min-width: 48px;
	text-align: center;
	font-size: 12px;
	color: var(--gv-gray-600);
	font-weight: 500;
}

/* Page Navigation */
.govalid-ll-page-nav {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--gv-gray-600);
}

/* Preview Scroll Area */
.govalid-ll-preview-scroll {
	flex: 1;
	overflow: auto;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: 24px;
}

/* --------------------------------------------------------
   Paper Preview
   -------------------------------------------------------- */
.govalid-ll-paper {
	background: #fff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
	position: relative;
	transform-origin: top center;
	transition: transform 0.15s ease;
}

/* Label Grid */
.govalid-ll-grid {
	position: absolute;
	display: grid;
}

/* Individual Cell */
.govalid-ll-cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	position: relative;
	box-sizing: border-box;
}

.govalid-ll-cell img {
	display: block;
	object-fit: contain;
}

.govalid-ll-cell.govalid-ll-cell-empty {
	border: 1px dashed var(--gv-gray-300);
	color: var(--gv-gray-400);
	font-size: 10px;
}

/* Cell Frame (decorative border overlay) */
.govalid-ll-cell-frame {
	position: absolute;
	inset: 0;
	pointer-events: none;
	box-sizing: border-box;
}

/* Cell Label Text */
.govalid-ll-cell-label {
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	line-height: 1.2;
	max-width: 100%;
	box-sizing: border-box;
	padding: 1px 2px;
}

/* --------------------------------------------------------
   Frame Style Variants
   (border-width, border-color, background-color,
    and box-shadow values are applied inline by JS)
   -------------------------------------------------------- */
.govalid-ll-frame-basic .govalid-ll-cell-frame {
	border-style: solid;
}

.govalid-ll-frame-rounded .govalid-ll-cell-frame {
	border-style: solid;
	border-radius: 8px;
}

.govalid-ll-frame-double .govalid-ll-cell-frame {
	border-style: double;
}

.govalid-ll-frame-dashed .govalid-ll-cell-frame {
	border-style: dashed;
}

.govalid-ll-frame-dotted .govalid-ll-cell-frame {
	border-style: dotted;
}

.govalid-ll-frame-shadow .govalid-ll-cell-frame {
	border: none;
}

.govalid-ll-frame-pill .govalid-ll-cell-frame {
	border-style: solid;
	border-radius: 50%;
}

.govalid-ll-frame-groove .govalid-ll-cell-frame {
	border-style: groove;
}

.govalid-ll-frame-ridge .govalid-ll-cell-frame {
	border-style: ridge;
}

.govalid-ll-frame-inset .govalid-ll-cell-frame {
	border-style: inset;
}

.govalid-ll-frame-outset .govalid-ll-cell-frame {
	border-style: outset;
}

.govalid-ll-frame-ticket .govalid-ll-cell-frame {
	border-style: dashed;
	border-radius: 12px;
}

.govalid-ll-frame-elegant .govalid-ll-cell-frame {
	border-style: solid;
}

.govalid-ll-frame-glow .govalid-ll-cell-frame {
	border-style: solid;
}

.govalid-ll-frame-stamp .govalid-ll-cell-frame {
	border-style: solid;
}

/* --------------------------------------------------------
   Add More Picker Sub-modal
   -------------------------------------------------------- */
.govalid-ll-picker-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
}

.govalid-ll-picker {
	background: #fff;
	border-radius: 12px;
	width: 500px;
	max-height: 80vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.govalid-ll-picker-header {
	padding: 16px;
	border-bottom: 1px solid var(--gv-gray-200);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.govalid-ll-picker-header h3 {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--gv-gray-800);
}

.govalid-ll-picker-body {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
}

.govalid-ll-picker-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	border-radius: 6px;
	cursor: pointer;
	transition: background var(--gv-transition);
}

.govalid-ll-picker-item:hover {
	background: var(--gv-gray-50);
}

.govalid-ll-picker-item img {
	width: 36px;
	height: 36px;
	border-radius: 4px;
	object-fit: contain;
	flex-shrink: 0;
}

.govalid-ll-picker-item span {
	font-size: 13px;
	color: var(--gv-gray-700);
}

.govalid-ll-picker-footer {
	padding: 12px 16px;
	border-top: 1px solid var(--gv-gray-200);
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

/* --------------------------------------------------------
   Export Loading Overlay
   -------------------------------------------------------- */
.govalid-ll-loading {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.85);
	z-index: 20;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.govalid-ll-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--gv-gray-200);
	border-top-color: var(--gv-primary);
	border-radius: 50%;
	animation: govalid-ll-spin 0.8s linear infinite;
}

.govalid-ll-loading span {
	font-size: 13px;
	color: var(--gv-gray-600);
	font-weight: 500;
}

@keyframes govalid-ll-spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* --------------------------------------------------------
   Preset Section
   -------------------------------------------------------- */
.govalid-ll-preset-section {
	border-bottom: 1px solid var(--gv-gray-200);
	padding-bottom: 12px;
}

.govalid-ll-preset-section h3 {
	margin: 0 0 8px;
}

.govalid-ll-preset-row {
	margin-bottom: 6px;
}

.govalid-ll-preset-row select {
	width: 100%;
}

.govalid-ll-preset-actions {
	display: flex;
	gap: 6px;
}

.govalid-ll-preset-actions .govalid-btn {
	flex: 1;
}

.govalid-ll-preset-actions .govalid-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.govalid-ll-preset-actions .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
	vertical-align: middle;
	margin-top: -2px;
}

/* --------------------------------------------------------
   Responsive (max-width: 900px)
   -------------------------------------------------------- */
@media (max-width: 900px) {
	.govalid-ll-body {
		flex-direction: column;
	}

	.govalid-ll-controls {
		width: 100%;
		min-width: 100%;
		max-height: 280px;
		border-right: none;
		border-bottom: 1px solid var(--gv-gray-200);
	}

	.govalid-ll-header-actions .govalid-btn {
		font-size: 11px;
		padding: 4px 8px;
	}

	.govalid-ll-header-left h2 {
		font-size: 14px;
	}

	.govalid-ll-preview-scroll {
		padding: 16px;
	}
}
