/* =========================================
   QRFORGE — style.css
   Matches invoice-generator design system
   ========================================= */
:root {
	--primary: #ff9901;
	--primary-hover: #e68a00;
	--primary-light: #fff7e6;
	--dark: #061d33;
	--mid: #4a5568;
	--muted: #9ca3af;
	--border: #e2e8f0;
	--bg: #f7f8fa;
	--white: #ffffff;
	--radius: 10px;
	--radius-sm: 6px;
	--shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
	--font-body: 'DM Sans', sans-serif;
	--font-mono: 'IBM Plex Mono', monospace;
}

.qr-app {
	margin-bottom: 40px;
	width: 100%;
}

.qr-app .app-container.qr-container {
	max-width: 1100px;
	display: grid;
	grid-template-columns: 420px 1fr;
	gap: 0;
	padding: 0;
	overflow: hidden;
	background: var(--white);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	text-align: left;
	margin: auto;
}

/* PANELS */
.qr-panel {
	min-height: 500px;
}

.qr-form-panel {
	background: var(--white);
	border-right: 1px solid var(--border);
	padding: 28px 24px;
	overflow-y: auto;
}

.qr-preview-panel {
	background: var(--bg);
	display: flex;
	flex-direction: column;
	min-height: 0;
}

/* DIVIDER */
.qr-divider {
	border: none;
	border-top: 1px solid var(--border);
	margin: 18px 0;
}

/* FIELDSETS */
.qr-fieldset {
	margin-bottom: 4px;
}

.qr-fieldset-title {
	font-family: var(--font-body);
	font-size: 13px;
	font-weight: 700;
	color: var(--dark);
	margin-bottom: 12px;
	letter-spacing: 0.01em;
}

.qr-optional {
	font-size: 10px;
	font-weight: 500;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-left: 4px;
}

/* DATA TYPE PILLS */
.qr-type-options {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.qr-type-btn {
	font-family: var(--font-body);
	font-size: 12px;
	font-weight: 600;
	padding: 6px 14px;
	border-radius: 20px;
	border: 1.5px solid var(--border);
	background: var(--white);
	color: var(--mid);
	cursor: pointer;
	transition: all 0.2s ease;
}

.qr-type-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
}

.qr-type-btn.active {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
}

/* FIELDS */
.qr-field {
	display: flex;
	flex-direction: column;
	margin-bottom: 10px;
}

.qr-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.qr-field label {
	font-family: var(--font-body);
	font-size: 12px;
	font-weight: 600;
	color: var(--dark);
	margin-bottom: 5px;
	cursor: pointer;
}

.qr-field input,
.qr-field textarea,
.qr-field select {
	font-family: var(--font-body);
	font-size: 14px;
	color: var(--dark);
	background: var(--white);
	border: 1.8px solid #ccc;
	border-radius: var(--radius-sm);
	padding: 9px 12px;
	transition: border-color 0.25s ease, box-shadow 0.25s ease;
	outline: none;
	resize: vertical;
}

.qr-field input:focus,
.qr-field textarea:focus,
.qr-field select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 6px 2px rgba(255, 153, 1, 0.25);
}

.qr-field select {
	appearance: none;
	background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 16 16%22%3E%3Cpath fill=%22555555%22 d=%22M1 4h14l-7 7-7-7z%22/%3E%3C/svg%3E');
	background-repeat: no-repeat;
	background-position: right 10px center;
	padding-right: 30px;
	cursor: pointer;
}

.qr-checkbox-field label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	cursor: pointer;
}

.qr-checkbox-field input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: var(--primary);
}

/* LOGO UPLOAD */
.qr-logo-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	min-height: 40px;
}

#qrLogoThumb {
	height: 40px;
	max-width: 80px;
	object-fit: contain;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	padding: 3px 6px;
	background: var(--bg);
}

.qr-logo-upload-btn {
	font-family: var(--font-body);
	font-size: 12px;
	font-weight: 600;
	padding: 7px 12px;
	border-radius: var(--radius-sm);
	border: 1.5px dashed #ccc;
	background: transparent;
	color: var(--mid);
	cursor: pointer;
	transition: all 0.2s ease;
}

.qr-logo-upload-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
	background: var(--primary-light);
	border-style: solid;
}

.qr-logo-remove-btn {
	font-family: var(--font-body);
	font-size: 11px;
	font-weight: 600;
	padding: 5px 9px;
	border-radius: var(--radius-sm);
	border: 1.5px solid #fca5a5;
	background: transparent;
	color: #ef4444;
	cursor: pointer;
	transition: all 0.15s ease;
}

.qr-logo-remove-btn:hover {
	background: #fef2f2;
}

/* FORM ACTIONS */
.qr-form-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 16px;
}

.qr-btn {
	font-family: var(--font-body);
	font-size: 13px;
	font-weight: 700;
	padding: 10px 18px;
	border-radius: var(--radius-sm);
	border: 1.8px solid transparent;
	cursor: pointer;
	transition: all 0.25s ease;
	letter-spacing: 0.02em;
}

.qr-btn-ghost {
	background: transparent;
	border-color: #ccc;
	color: var(--mid);
}

.qr-btn-ghost:hover {
	border-color: var(--dark);
	color: var(--dark);
}

.qr-btn-primary {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	justify-content: center;
}

.qr-btn-primary:hover {
	background: var(--primary-hover);
	border-color: var(--primary-hover);
}

/* TOOLBAR */
.qr-preview-toolbar {
	background: var(--white);
	border-bottom: 1px solid var(--border);
	overflow-y: auto;
	flex-shrink: 0;
	padding-top: 15px;
}

.qr-panel-label {
	font-family: var(--font-body);
	font-size: 10px;
	font-weight: 700;
	color: var(--muted);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	display: inline;
	margin-bottom: 0;
}

.qr-toolbar-section {
	padding: 14px 20px;
	border-bottom: 1px solid var(--border);
}

.qr-toolbar-section:last-child {
	border-bottom: none;
}

.qr-tool-row {
	display: flex;
	gap: 10px;
	align-items: flex-end;
	flex-wrap: wrap;
	margin-top: 6px;
	padding-bottom: 5px;
    padding-left: 2px;
}

.qr-tool-row:first-child {
	margin-top: 0;
}

.qr-tool-group {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.qr-tool-group label {
	font-family: var(--font-body);
	font-size: 11px;
	font-weight: 600;
	color: var(--mid);
	margin-bottom: 6px;
}

.qr-tool-grow {
	flex: 1;
}

.qr-tool-select {
	font-family: var(--font-body);
	font-size: 12px;
	color: var(--dark);
	background: var(--white);
	border: 1.5px solid #ccc;
	border-radius: var(--radius-sm);
	padding: 7px 26px 7px 10px;
	outline: none;
	cursor: pointer;
	appearance: none;
	background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 16 16%22%3E%3Cpath fill=%22555555%22 d=%22M1 4h14l-7 7-7-7z%22/%3E%3C/svg%3E');
	background-repeat: no-repeat;
	background-position: right 10px center;
	padding-right: 30px;
	transition: border-color 0.2s;
}

.qr-tool-select:focus {
	border-color: var(--primary);
}

.qr-color-picker {
	width: 44px;
	height: 44px;
	border-radius: var(--radius-sm);
	box-shadow: 0 0 0 1.5px var(--border), 0 2px 6px rgba(0, 0, 0, 0.08);
	cursor: pointer;
	border: none;
	padding: 0;
	transition: box-shadow 0.2s;
}

.qr-color-picker:hover {
	box-shadow: 0 0 0 2px var(--primary), 0 2px 8px rgba(0, 0, 0, 0.12);
}

.qr-color-picker::-webkit-color-swatch-wrapper {
	padding: 3px;
}

.qr-color-picker::-webkit-color-swatch {
	border: none;
	border-radius: 3px;
}

.qr-slider-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
}

.qr-slider-wrap input[type="range"] {
	flex: 1;
	-webkit-appearance: none;
	appearance: none;
	height: 4px;
	border-radius: 2px;
	background: var(--border);
	outline: none;
	cursor: pointer;
}

.qr-slider-wrap input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--primary);
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.qr-slider-val {
	font-family: var(--font-mono);
	font-size: 11px;
	color: var(--muted);
	min-width: 56px;
	text-align: right;
}

/* ACCORDION */
.qr-accordion .qr-accordion-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	padding: 0;
	user-select: none;
}

.qr-accordion-header[aria-expanded="true"] {
	margin-bottom: 12px;
}

.qr-accordion-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.qr-accordion-chevron {
	color: var(--muted);
	transition: transform 0.2s ease;
	flex-shrink: 0;
}

.qr-accordion-header[aria-expanded="false"] .qr-accordion-chevron {
	transform: rotate(-90deg);
}

.qr-accordion-body {
	overflow: hidden;
	transition: max-height 0.25s ease, opacity 0.2s ease;
	max-height: 400px;
	padding: 15px 0 0;
	opacity: 1;
}

.qr-accordion-body.qr-collapsed {
	max-height: 0;
	opacity: 0;
	display: none;
}

.qr-reset-btn {
	font-family: var(--font-body);
	font-size: 11px;
	font-weight: 600;
	padding: 3px 9px;
	border-radius: 20px;
	border: 1.5px solid var(--border);
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	transition: all 0.15s ease;
}

.qr-reset-btn:hover {
	border-color: var(--mid);
	color: var(--mid);
}

/* PREVIEW */
.qr-preview-wrap {
	padding: 24px 20px;
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

.qr-preview-label {
	font-family: var(--font-body);
	font-size: 11px;
	font-weight: 700;
	color: var(--muted);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 10px 0 18px;
	border-bottom: 1px solid var(--border);
	margin-bottom: 8px;
	width: 100%;
}

.qr-preview {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 280px;
	width: 100%;
	margin-bottom: 20px;
}

.qr-placeholder {
	font-family: var(--font-body);
	font-size: 13px;
	color: var(--muted);
	text-align: center;
	padding: 40px 20px;
}

#qrOutput {
	display: flex;
	justify-content: center;
}

#qrOutput svg {
	border-radius: var(--radius-sm);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.qr-download-row {
	display: flex;
	gap: 8px;
	width: 100%;
	max-width: 380px;
	margin-bottom: 20px;
}

/* TOAST */
.qr-toast {
	position: fixed;
	bottom: 28px;
	left: 50%;
	transform: translateX(-50%) translateY(10px);
	background: var(--dark);
	color: var(--white);
	font-family: var(--font-body);
	font-size: 13px;
	font-weight: 500;
	padding: 10px 20px;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	opacity: 0;
	transition: opacity 0.2s, transform 0.2s;
	pointer-events: none;
	z-index: 4000;
	white-space: nowrap;
}

.qr-toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* RESPONSIVE */
@media(max-width:860px) {
	.qr-app .app-container.qr-container {
		grid-template-columns: 1fr;
		max-width: 500px;
		margin: auto;
	}

	.qr-form-panel {
		border-right: none;
		border-bottom: 1px solid var(--border);
	}

	.qr-preview-wrap {
		padding: 16px 12px;
	}
}

@media(max-width:520px) {
	.qr-field-row {
		grid-template-columns: 1fr;
	}

	.qr-download-row {
		flex-direction: column;
	}

	.qr-form-actions {
		flex-direction: column;
	}

	.qr-btn {
		width: 100%;
		text-align: center;
		justify-content: center;
	}
}