:root {
	--bg: #0f172a;
	--card: #111827;
	--text: #e5e7eb;
	--muted: #94a3b8;
	--primary: #6366f1;
	--primary-600: #5458ee;
}

* { box-sizing: border-box; }

html, body, .app { height: 100%; }

body {
	margin: 0;
	background: radial-gradient(1200px 800px at 80% -20%, #111827, #0f172a);
	color: var(--text);
	font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", "Noto Sans", Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.app {
	display: grid;
	place-items: center;
	padding: 24px;
	position: relative;
}

/* Download PDF Button - Top Right Corner of Card */
.download-pdf-container {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 10;
}

.card {
	width: 100%;
	max-width: none;
	background: rgba(17, 24, 39, 0.92);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 16px;
	padding: 20px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
	position: relative;
}

h1 {
	margin: 0 0 12px 0;
	font-size: 24px;
}

.centered-title {
	text-align: center;
}

p { margin: 0 0 16px 0; color: var(--muted); }

.btn {
	appearance: none;
	cursor: pointer;
	border: none;
	border-radius: 10px;
	padding: 12px 16px;
	color: white;
	background: linear-gradient(135deg, var(--primary), var(--primary-600));
	box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
	transition: transform .08s ease, box-shadow .2s ease, filter .2s ease;
}

.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px) scale(0.99); box-shadow: 0 3px 12px rgba(99, 102, 241, 0.35); }

.btn:disabled,
.btn.disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background: rgba(255, 255, 255, 0.1);
	box-shadow: none;
}

.btn:disabled:hover,
.btn.disabled:hover {
	filter: none;
	transform: none;
}

.status { 
	min-height: 20px; 
	margin-top: 12px; 
	color: #a7f3d0; 
	display: none; /* Hide status messages */
} 

/* Canvas area */
.canvas-wrap {
	margin-top: 8px;
	display: grid;
	place-items: center;
}

#sketchCanvas {
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	width: 960px;
	height: 540px;
	margin: 0 auto;
}

.actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin: 8px 0 0 0;
}

.controls {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	margin: 12px 0 4px 0;
	gap: 6px;
}

.top-controls-row {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.dimensions-controls-row {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.kitchen-toggle-control {
	display: flex;
	align-items: center;
	gap: 10px;
}
.height-control {
	display: flex;
	align-items: center;
	gap: 10px;
}
.depth-control {
	display: flex;
	align-items: center;
	gap: 10px;
}
.size-control {
	display: flex;
	align-items: center;
	gap: 10px;
}

.size-control label {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: var(--muted);
	cursor: pointer;
}
.controls label {
	font-size: 12px;
	color: var(--muted);
}
.controls input,
.controls select {
	appearance: none;
	background: rgba(255,255,255,0.06);
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 8px;
	padding: 8px 10px;
	color: var(--text);
}

.controls input[type="checkbox"] {
	width: 16px;
	height: 16px;
	padding: 0;
	border-radius: 4px;
	cursor: pointer;
}

.controls input[type="checkbox"]:checked {
	background: var(--primary);
	border-color: var(--primary);
}

/* Modal Styles */
.modal {
	position: fixed;
	z-index: 1000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
}

.modal-content {
	background: var(--card);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 16px;
	margin: 1% auto;
	padding: 0;
	width: 90%;
	max-width: 700px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
	display: flex;
	flex-direction: column;
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 24px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-header h2 {
	margin: 0;
	font-size: 20px;
	color: var(--text);
}

.close {
	color: var(--muted);
	font-size: 28px;
	font-weight: bold;
	cursor: pointer;
	line-height: 1;
}

.close:hover {
	color: var(--text);
}

.modal-body {
	padding: 16px 24px;
	flex: 1;
	overflow-y: auto;
}

.modal-footer {
	display: flex;
	gap: 12px;
	justify-content: flex-end;
	padding: 16px 24px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	flex-shrink: 0;
}

.btn-secondary {
	background: rgba(255, 255, 255, 0.1);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
	background: rgba(255, 255, 255, 0.15);
}

.drawer-config {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.drawer-config label {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 14px;
	color: var(--text);
}

.drawer-config select {
	background: rgba(255,255,255,0.06);
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 8px;
	padding: 8px 12px;
	color: var(--text);
	min-width: 120px;
}

.drawer-config input[type="number"] {
	background: rgba(255,255,255,0.06);
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 8px;
	padding: 8px 12px;
	color: var(--text);
	min-width: 120px;
	pointer-events: auto;
	cursor: text;
}

.drawer-config input[type="number"]:focus {
	outline: none;
	border-color: var(--primary);
	background: rgba(255,255,255,0.1);
}

.drawer-height-section {
	background: rgba(99, 102, 241, 0.1);
	border: 1px solid rgba(99, 102, 241, 0.3);
	border-radius: 8px;
	padding: 12px;
	margin-top: 8px;
}

.drawer-height-section label {
	color: #a5b4fc;
	font-weight: 500;
}

.drawer-item {
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
	padding: 16px;
	margin-bottom: 12px;
}

.drawer-item h3 {
	margin: 0 0 12px 0;
	font-size: 16px;
	color: var(--text);
}

.drawer-item-controls {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px;
}

.drawer-item-controls label {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 12px;
	color: var(--muted);
}

.drawer-item-controls input,
.drawer-item-controls select {
	background: rgba(255,255,255,0.06);
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 6px;
	padding: 6px 8px;
	color: var(--text);
	font-size: 12px;
}

/* Floating Action Buttons */
.floating-actions {
	position: absolute;
	display: flex;
	flex-direction: column;
	gap: 6px;
	z-index: 100;
	pointer-events: none; /* Allow clicks to pass through to canvas */
}

.floating-actions .floating-btn {
	pointer-events: auto; /* Re-enable clicks for buttons */
}

.floating-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: rgba(17, 24, 39, 0.95);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: var(--text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(8px);
}

.floating-btn:hover {
	background: rgba(99, 102, 241, 0.9);
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.floating-btn:active {
	transform: scale(0.95);
}

#editDrawerBtn:hover {
	background: rgba(34, 197, 94, 0.9);
	box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

#duplicateDrawerBtn:hover {
	background: rgba(59, 130, 246, 0.9);
	box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

#moveLeftBtn:hover {
	background: rgba(245, 158, 11, 0.9);
	box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

#moveRightBtn:hover {
	background: rgba(245, 158, 11, 0.9);
	box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

#removeDrawerBtn:hover {
	background: rgba(239, 68, 68, 0.9);
	box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Add Drawer Button */
.add-drawer-btn {
	position: absolute;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	border: none;
	background: rgba(34, 197, 94, 0.9);
	border: 2px solid rgba(34, 197, 94, 0.3);
	color: white;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
	z-index: 100;
	pointer-events: auto;
}

.add-drawer-btn:hover {
	background: rgba(34, 197, 94, 1);
	transform: scale(1.1);
	box-shadow: 0 6px 16px rgba(34, 197, 94, 0.5);
}

.add-drawer-btn:active {
	transform: scale(0.95);
}

.height-validation {
	margin-top: 12px;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 12px;
	text-align: center;
}

.height-validation.error {
	background: rgba(239, 68, 68, 0.1);
	border: 1px solid rgba(239, 68, 68, 0.3);
	color: #fca5a5;
}

.height-validation.success {
	background: rgba(34, 197, 94, 0.1);
	border: 1px solid rgba(34, 197, 94, 0.3);
	color: #86efac;
}

/* Template Section Styles */
.template-section {
	margin-bottom: 20px;
	padding: 16px;
	background: rgba(255, 255, 255, 0.02);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
}

.template-section h3 {
	margin: 0 0 12px 0;
	font-size: 16px;
	color: var(--text);
}

.template-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	gap: 6px;
	margin-top: 6px;
}

.template-card {
	cursor: pointer;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 12px;
	padding: 4px;
	background: rgba(255, 255, 255, 0.05);
	transition: all 0.2s ease;
	text-align: center;
	position: relative; /* allow selected badge positioning */
}

.template-card:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.3);
	transform: translateY(-2px);
	position: relative;
	z-index: 10;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.template-card:hover .template-preview-svg,
.template-card:hover .template-preview-img {
	transform: scale(2.5); 
	z-index: 20;
	position: relative;
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}


.template-card.selected {
	background: rgba(99, 102, 241, 0.3);
	border-color: rgba(99, 102, 241, 0.5);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* When selected, disable hover zoom/effects */
.template-card.selected:hover {
	background: rgba(99, 102, 241, 0.3);
	border-color: rgba(99, 102, 241, 0.5);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.template-card.selected:hover .template-preview-svg,
.template-card.selected:hover .template-preview-img {
	transform: none;
	box-shadow: none;
}

/* Selected checkmark badge */
.template-card.selected::after {
	content: '\2713';
	position: absolute;
	top: 6px;
	right: 6px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #10b981; /* green */
	color: #ffffff;
	font-size: 14px;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.template-card.no-template {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.2);
}

.template-card.no-template:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.3);
}

.template-card.no-template.selected {
	background: rgba(255, 255, 255, 0.15);
	border-color: rgba(255, 255, 255, 0.4);
	box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.template-preview {
	width: 120px;
	height: 80px;
	margin: 0 auto 8px auto;
	display: flex;
	align-items: center;
	justify-content: center;
}

.template-preview-svg {
	width: 100%;
	height: 100%;
	transition: all 0.3s ease;
}

.template-preview-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 4px;
	transition: all 0.3s ease;
}

.template-name {
	font-size: 12px;
	color: var(--text);
	font-weight: 500;
	line-height: 1.2;
}

/* Add Drawers Section Styles */
.add-drawers-section {
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
	overflow: hidden;
	transition: all 0.3s ease;
}

.add-drawers-section h3 {
	margin: 0;
	padding: 12px 16px;
	background: rgba(255, 255, 255, 0.03);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	font-size: 16px;
	color: var(--text);
	cursor: pointer;
	user-select: none;
}

.add-drawers-section h3:hover {
	background: rgba(255, 255, 255, 0.05);
}

.add-drawers-content {
	padding: 16px;
	max-height: 400px;
	overflow-y: auto;
	transition: all 0.3s ease;
}

.add-drawers-section.collapsed .add-drawers-content {
	max-height: 0;
	padding-top: 0;
	padding-bottom: 0;
	overflow: hidden;
}

.add-drawers-section.collapsed h3 {
	border-bottom: none;
}

/* Kitchen Toggle Styles */
.kitchen-toggle {
	display: flex;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	overflow: hidden;
}

.kitchen-toggle-btn {
	appearance: none;
	cursor: pointer;
	border: none;
	background: transparent;
	color: var(--muted);
	padding: 8px 16px;
	font-size: 12px;
	transition: all 0.2s ease;
	border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.kitchen-toggle-btn:last-child {
	border-right: none;
}

.kitchen-toggle-btn:hover {
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
}

.kitchen-toggle-btn.active {
	background: rgba(99, 102, 241, 0.3);
	color: #a5b4fc;
	border-color: rgba(99, 102, 241, 0.5);
}

/* Quick Edit Modal Styles */
.quick-edit-modal .modal-content {
	max-width: 800px;
	width: 95%;
	max-height: 90vh;
}

.quick-edit-top-section {
	display: flex;
	gap: 20px;
	align-items: center;
	margin-bottom: 20px;
}

.quick-edit-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.quick-edit-field label {
	font-weight: 500;
	color: var(--text);
	font-size: 14px;
}

.quick-edit-field input {
	padding: 8px 12px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
	font-size: 14px;
	width: 120px;
}

.quick-edit-field input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.toggle-container {
	display: flex;
	align-items: center;
	gap: 8px;
}

.toggle-btn {
	padding: 6px 12px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 20px;
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
	font-size: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
	min-width: 40px;
}

.toggle-btn:hover {
	background: rgba(255, 255, 255, 0.1);
}

.toggle-btn.active {
	background: var(--primary);
	border-color: var(--primary);
	color: white;
}

.chip-container {
	display: flex;
	gap: 4px;
	min-height: 32px;
	cursor: pointer;
	padding: 4px;
	border-radius: 8px;
	transition: background-color 0.2s ease;
}

.chip-container:hover {
	background-color: rgba(255, 255, 255, 0.05);
}

.option-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	background: var(--primary);
	color: white;
	border-radius: 12px;
	font-size: 11px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.option-chip:hover {
	background: #5458ee;
}

.option-chip .remove-chip {
	background: none;
	border: none;
	color: white;
	font-size: 12px;
	cursor: pointer;
	padding: 0;
	margin-left: 4px;
}

.quick-edit-divider {
	height: 1px;
	background: rgba(255, 255, 255, 0.1);
	margin: 20px 0;
}

.quick-edit-bottom-section {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
}

.drawer-list-column {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

#drawerItemsList {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.drawer-item-btn {
	padding: 12px 16px;
	border: 2px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	min-width: 200px;
}

.drawer-item-btn:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
}

.drawer-item-btn.selected {
	border-color: #ef4444;
	background: rgba(239, 68, 68, 0.1);
}

.drawer-item-btn.edited {
	border-color: #10b981;
	background: rgba(16, 185, 129, 0.1);
}

.drawer-item-btn.edited.selected {
	border-color: #ef4444;
	background: rgba(239, 68, 68, 0.1);
}

.remove-drawer-item-btn {
	background: none;
	border: none;
	color: var(--muted);
	font-size: 16px;
	cursor: pointer;
	padding: 4px;
	border-radius: 4px;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

.remove-drawer-item-btn:hover {
	background: rgba(239, 68, 68, 0.2);
	color: #ef4444;
}

.add-drawer-item-btn {
	padding: 12px 16px;
	border: 2px dashed rgba(255, 255, 255, 0.3);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.05);
	color: var(--muted);
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	justify-content: flex-start;
	align-items: center;
	width: 100%;
	min-width: 200px;
	box-sizing: border-box;
	text-align: left;
	max-width: 100%;
	overflow: hidden;
}

.add-drawer-item-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
	background: rgba(99, 102, 241, 0.1);
}

.properties-column {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Sub-modal styles */
.sub-modal {
	position: fixed;
	z-index: 1001;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
}

.sub-modal-content {
	background: var(--card);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 12px;
	padding: 20px;
	min-width: 200px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.sub-modal-content h4 {
	margin: 0 0 16px 0;
	font-size: 16px;
	color: var(--text);
}

.option-btn {
	display: block;
	width: 100%;
	padding: 10px 16px;
	margin-bottom: 8px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: left;
}

.option-btn:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: var(--primary);
}

	.option-btn:last-child {
		margin-bottom: 0;
	}

/* Upper kitchen specific fields */
.upper-kitchen-fields {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Customize section */
.customize-section {
	display: flex;
	justify-content: center;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Toast Notification */
.toast {
	position: fixed;
	top: 20px;
	right: 20px;
	background: var(--card);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	padding: 16px 20px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	z-index: 10000;
	transform: translateX(100%);
	transition: transform 0.3s ease;
}

.toast.show {
	transform: translateX(0);
}

.toast-content {
	display: flex;
	align-items: center;
	gap: 12px;
}

.toast-icon {
	color: #10b981;
	flex-shrink: 0;
}

.toast-message {
	color: var(--text);
	font-size: 14px;
	font-weight: 500;
}

/* Text Input Modal Styles */
.text-input-section {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.text-input-section label {
	color: var(--text);
	font-weight: 500;
	margin-bottom: 8px;
}

#pdfTextInput {
	width: 100%;
	padding: 12px;
	border: 2px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
	font-family: 'Arial', 'Helvetica', sans-serif;
	font-size: 14px;
	line-height: 1.4;
	resize: vertical;
	min-height: 120px;
	max-height: 200px;
	transition: border-color 0.2s ease;
	box-sizing: border-box;
}

#pdfTextInput:focus {
	outline: none;
	border-color: var(--primary);
	background: rgba(255, 255, 255, 0.08);
}

#pdfTextInput::placeholder {
	color: var(--muted);
	font-style: italic;
}

.text-counter {
	text-align: right;
	font-size: 12px;
	color: var(--muted);
	margin-top: 4px;
}

/* Hebrew RTL Support */
html[dir="rtl"] {
	direction: rtl;
}

html[dir="rtl"] body {
	font-family: 'Arial', 'Tahoma', 'David', 'Times New Roman', serif;
}

html[dir="rtl"] .app {
	text-align: right;
}

html[dir="rtl"] .card {
	text-align: right;
}

html[dir="rtl"] .controls {
	text-align: right;
}

html[dir="rtl"] .controls label {
	text-align: right;
}

html[dir="rtl"] .modal-content {
	text-align: right;
}

html[dir="rtl"] .modal-header {
	text-align: right;
}

html[dir="rtl"] .modal-body {
	text-align: right;
}

html[dir="rtl"] .modal-footer {
	text-align: right;
}

html[dir="rtl"] .drawer-config {
	text-align: right;
}

html[dir="rtl"] .drawer-config label {
	text-align: right;
}

html[dir="rtl"] .template-section {
	text-align: right;
}

html[dir="rtl"] .add-drawers-section {
	text-align: right;
}

html[dir="rtl"] .quick-edit-field {
	text-align: right;
}

html[dir="rtl"] .quick-edit-field label {
	text-align: right;
}

html[dir="rtl"] .sub-modal-content {
	text-align: right;
}

html[dir="rtl"] .sub-modal-content h4 {
	text-align: right;
}

html[dir="rtl"] .option-btn {
	text-align: right;
}

html[dir="rtl"] .text-input-section {
	text-align: right;
}

html[dir="rtl"] .text-input-section label {
	text-align: right;
}

html[dir="rtl"] #pdfTextInput[dir="rtl"] {
	text-align: right;
	font-family: 'Arial', 'Tahoma', 'David', 'Times New Roman', serif;
}

/* RTL specific adjustments */
html[dir="rtl"] .download-pdf-container {
	left: 20px;
	right: auto;
}

html[dir="rtl"] .floating-actions {
	left: 10px;
	right: auto;
}

/* RTL positioning for add drawer button is handled by JavaScript */

html[dir="rtl"] .toast {
	left: 20px;
	right: auto;
	transform: translateX(-100%);
}

html[dir="rtl"] .toast.show {
	transform: translateX(0);
}

html[dir="rtl"] .text-counter {
	text-align: left;
}

/* RTL form elements */
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="text"],
html[dir="rtl"] textarea,
html[dir="rtl"] select {
	text-align: right;
	direction: rtl;
}

html[dir="rtl"] .controls input,
html[dir="rtl"] .controls select {
	text-align: right;
	direction: rtl;
}

html[dir="rtl"] .drawer-config input[type="number"] {
	text-align: right;
	direction: rtl;
}

html[dir="rtl"] .quick-edit-field input {
	text-align: right;
	direction: rtl;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
	.app {
		padding: 12px;
	}
	
	.card {
		padding: 16px;
		margin: 0;
		border-radius: 12px;
	}
	
	/* Download PDF Button - Mobile positioning */
	.download-pdf-container {
		position: absolute;
		top: 12px;
		right: 12px;
		z-index: 10;
	}
	
	html[dir="rtl"] .download-pdf-container {
		left: 12px;
		right: auto;
	}
	
	.download-pdf-container .btn {
		padding: 8px 12px;
		font-size: 12px;
	}
	
	/* Title adjustments */
	h1 {
		font-size: 20px;
		margin-bottom: 16px;
	}
	
	/* Controls mobile layout */
	.controls {
		margin: 8px 0;
		gap: 12px;
	}
	
	.top-controls-row {
		flex-direction: column;
		gap: 12px;
		align-items: stretch;
	}
	
	.dimensions-controls-row {
		flex-direction: column;
		gap: 12px;
		align-items: stretch;
	}
	
	.kitchen-toggle-control,
	.size-control,
	.height-control,
	.depth-control {
		justify-content: center;
		text-align: center;
	}
	
	.kitchen-toggle {
		width: 100%;
		justify-content: center;
	}
	
	.kitchen-toggle-btn {
		flex: 1;
		padding: 10px 16px;
		font-size: 14px;
	}
	
	/* Input fields mobile sizing */
	.controls input[type="number"] {
		width: 100%;
		max-width: 200px;
		padding: 10px 12px;
		font-size: 14px;
	}
	
	.controls label {
		font-size: 14px;
		margin-bottom: 4px;
		display: block;
	}
	
	/* Canvas mobile adjustments */
	#sketchCanvas {
		width: 100%;
		max-width: 100%;
		height: auto;
		min-height: 300px;
		max-height: 400px;
	}
	
	/* Floating actions mobile positioning */
	.floating-actions {
		position: fixed;
		top: 50%;
		left: 10px;
		transform: translateY(-50%);
		z-index: 100;
	}
	
	html[dir="rtl"] .floating-actions {
		left: auto;
		right: 10px;
	}
	
	.floating-btn {
		width: 36px;
		height: 36px;
		margin-bottom: 8px;
	}
	
	/* Add drawer button mobile positioning */
	.add-drawer-btn {
		width: 44px;
		height: 44px;
		position: fixed;
		bottom: 20px;
		right: 20px;
		z-index: 100;
	}
	
	html[dir="rtl"] .add-drawer-btn {
		right: auto;
		left: 20px;
	}
	
	/* Modal mobile adjustments */
	.modal-content {
		width: 95%;
		max-width: none;
		margin: 2% auto;
		max-height: 95vh;
	}
	
	.modal-header {
		padding: 12px 16px;
	}
	
	.modal-header h2 {
		font-size: 18px;
	}
	
	.modal-body {
		padding: 12px 16px;
	}
	
	.modal-footer {
		padding: 12px 16px;
		flex-direction: column;
		gap: 8px;
	}
	
	.modal-footer .btn {
		width: 100%;
		padding: 12px;
	}
	
	/* Quick edit modal mobile layout */
	.quick-edit-modal .modal-content {
		width: 98%;
		max-height: 95vh;
	}
	
	.quick-edit-top-section {
		flex-direction: column;
		gap: 16px;
		align-items: stretch;
	}
	
	.quick-edit-bottom-section {
		grid-template-columns: 1fr;
		gap: 20px;
	}
	
	.quick-edit-field {
		width: 100%;
	}
	
	.quick-edit-field input {
		width: 100%;
		max-width: none;
	}
	
	/* Drawer item buttons mobile */
	.drawer-item-btn {
		min-width: auto;
		width: 100%;
		padding: 14px 16px;
	}
	
	.add-drawer-item-btn {
		min-width: auto;
		width: 100%;
		padding: 14px 16px;
	}
	
	/* Template grid mobile */
	.template-grid {
		grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
		gap: 8px;
	}
	
	.template-card {
		padding: 8px 4px;
	}
	
	.template-preview {
		width: 80px;
		height: 60px;
	}
	
	.template-name {
		font-size: 10px;
	}
	
	/* Sub-modal mobile */
	.sub-modal-content {
		width: 90%;
		max-width: 300px;
		padding: 16px;
	}
	
	.option-btn {
		padding: 12px 16px;
		font-size: 14px;
	}
	
	/* Toast mobile positioning */
	.toast {
		left: 12px;
		right: 12px;
		width: auto;
		transform: translateY(-100%);
	}
	
	html[dir="rtl"] .toast {
		left: 12px;
		right: 12px;
		transform: translateY(-100%);
	}
	
	.toast.show {
		transform: translateY(0);
	}
	
	/* Text input mobile */
	#pdfTextInput {
		font-size: 16px; /* Prevents zoom on iOS */
		min-height: 100px;
	}
	
	/* Kitchen toggle mobile improvements */
	.kitchen-toggle-btn {
		font-size: 13px;
		padding: 12px 8px;
	}
}

/* Small mobile screens */
@media (max-width: 480px) {
	.app {
		padding: 8px;
	}
	
	.card {
		padding: 12px;
	}
	
	h1 {
		font-size: 18px;
		margin-bottom: 12px;
	}
	
	.controls {
		gap: 8px;
	}
	
	.controls input[type="number"] {
		padding: 8px 10px;
		font-size: 16px; /* Prevents zoom on iOS */
	}
	
	#sketchCanvas {
		min-height: 250px;
		max-height: 300px;
	}
	
	.floating-btn {
		width: 32px;
		height: 32px;
	}
	
	.add-drawer-btn {
		width: 40px;
		height: 40px;
		bottom: 16px;
		right: 16px;
	}
	
	html[dir="rtl"] .add-drawer-btn {
		right: auto;
		left: 16px;
	}
	
	.modal-content {
		width: 98%;
		margin: 1% auto;
	}
	
	.template-grid {
		grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
		gap: 6px;
	}
	
	.template-preview {
		width: 70px;
		height: 50px;
	}
	
	.template-name {
		font-size: 9px;
	}
}