/* =========================================
   RESUMEBUILDER — 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;
}

/* APP WRAPPER */
.rb-app {
	margin-bottom: 40px;
	width: fit-content;
}

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

/* PANELS */
.rb-panel {
	min-height: 600px;
}

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

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

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

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

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

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

/* FIELDS */
.rb-field {
	display: flex;
	flex-direction: column;
	margin-bottom: 10px;
	width: 100%;
}

.rb-field-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.rb-field-row .rb-field {
	flex: 1;
    min-width: 130px;
}

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

.rb-field input,
.rb-field textarea {
	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;
	width: 100%;
}

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

/* REPEATABLE ITEMS */
.rb-items {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 8px;
}

.rb-item {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 10px 12px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	animation: rb-fadeIn 0.2s ease;
}

@keyframes rb-fadeIn {
	from {
		opacity: 0;
		transform: translateY(4px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.rb-item-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.rb-item-num {
	font-family: var(--font-mono);
	font-size: 10px;
	font-weight: 600;
	color: var(--muted);
}

.rb-item-remove {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--muted);
	font-size: 16px;
	padding: 2px 4px;
	border-radius: 4px;
	transition: color 0.15s, background 0.15s;
	line-height: 1;
}

.rb-item-remove:hover {
	color: #ef4444;
	background: rgba(239, 68, 68, 0.1);
}

.rb-item .rb-field-row {
	gap: 6px;
}

.rb-item .rb-field {
	margin-bottom: 0;
}

/* ADD ITEM */
.rb-add-item-btn {
	width: 100%;
	background: transparent;
	border: 1.5px dashed #ccc;
	border-radius: var(--radius-sm);
	color: var(--muted);
	font-family: var(--font-body);
	font-size: 13px;
	font-weight: 600;
	padding: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
}

.rb-add-item-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
	background: var(--primary-light);
}

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

.rb-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;
}

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

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

.rb-btn-primary {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
	font-size: 14px;
	padding: 10px 22px;
	display: flex;
	align-items: center;
	gap: 6px;
}

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

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

/* Panel label */
.rb-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;
}

/* Template picker */
.rb-toolbar-section {
	padding: 14px 20px;
	border-bottom: 1px solid var(--border);
}

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

.rb-template-options {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 8px;
}

.rb-tpl-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;
}

.rb-tpl-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
}

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

/* Tool row inside accordion */
.rb-tool-row {
	display: flex;
	gap: 10px;
	align-items: flex-end;
	flex-wrap: wrap;
}

.edit-colors-panel .rb-tool-group {
	text-align: center;
}

.edit-colors-panel .rb-tool-group label {
	margin-top: 5px;
}

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

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

.rb-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;
}

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

.rb-font-select {
	min-width: 120px;
}

.rb-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;
	margin: 3px;
	transition: box-shadow 0.2s;
}

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

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

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

/* ---- ACCORDION (matching invoice generator) ---- */
.rb-accordion .rb-accordion-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	padding: 0;
	user-select: none;
}

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

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

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

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

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

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

/* Reset button in accordion header */
.rb-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;
}

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

/* ---- PREVIEW ---- */
.rb-preview-wrap {
	padding: 24px 20px;
	flex: 1;
	overflow-y: auto;
}

.rb-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: 18px;
}

.rb-preview {
	display: flex;
	justify-content: center;
}

.rb-resume {
	background: white;
	width: 612px;
	min-height: 792px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	border-radius: var(--radius-sm);
	flex-shrink: 0;
	overflow: hidden;
	position: relative;
}

/* Editable elements */
.rb-resume [data-edit] {
	cursor: pointer;
	outline: 2px solid transparent;
	outline-offset: 1px;
	transition: outline-color 0.12s;
	border-radius: 2px;
}

.rb-resume [data-edit]:hover {
	outline-color: rgba(255, 153, 1, 0.35);
}

.rb-resume [data-edit].rb-selected {
	outline-color: var(--primary);
	outline-style: solid;
	background: rgba(255, 153, 1, 0.04);
}

.rb-resume [data-edit]:focus {
	outline-color: var(--primary);
}

/* INLINE TOOLBAR */
.rb-inline-toolbar {
	position: fixed;
	z-index: 5000;
	background: var(--white);
	border: 1.5px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	padding: 8px 12px;
	display: none;
	flex-direction: column;
	gap: 6px;
	min-width: 320px;
}

.rb-inline-toolbar.visible {
	display: flex;
}

.rb-it-row {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.rb-it-label {
	font-family: var(--font-body);
	font-size: 9px;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.rb-it-input {
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--dark);
	background: var(--bg);
	border: 1.5px solid var(--border);
	border-radius: 4px;
	padding: 4px 6px;
	width: 48px;
	outline: none;
	-moz-appearance: textfield;
	text-align: center;
}

.rb-it-input::-webkit-outer-spin-button,
.rb-it-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.rb-it-input:focus {
	border-color: var(--primary);
}

.rb-it-input-wide {
	width: 64px;
}

.rb-it-color {
	width: 28px;
	height: 26px;
	border: 1.5px solid var(--border);
	border-radius: 4px;
	padding: 1px;
	cursor: pointer;
	background: none;
}

.rb-it-color::-webkit-color-swatch-wrapper {
	padding: 0;
}

.rb-it-color::-webkit-color-swatch {
	border: none;
	border-radius: 2px;
}

.rb-it-select {
	font-family: var(--font-body);
	font-size: 11px;
	color: var(--dark);
	background: var(--white);
	border: 1.5px solid var(--border);
	border-radius: 4px;
	padding: 4px 6px;
	outline: none;
	cursor: pointer;
}

/* TOAST */
.of-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;
}

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

/* PRINT */
.rb-print-container {
	display: none;
}

@media print {
	@page {
		margin: 0;
		size: letter;
	}

	html,
	body {
		background: #fff !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	body.rb-printing > * {
		display: none !important;
	}

	body.rb-printing .rb-print-container {
		display: block !important;
		width: 100% !important;
		height: auto !important;
		margin: 0 !important;
		box-sizing: border-box !important;
		box-shadow: none !important;
		border-radius: 0 !important;
		background: #fff !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	body.rb-printing .rb-print-container * {
		visibility: visible !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	body.rb-printing .rb-print-container .rb-resume {
		box-shadow: none !important;
		border-radius: 0 !important;
		width: 100% !important;
		min-height: auto !important;
	}
}

.rb-print-container .rb-resume [data-edit] {
	cursor: default;
	outline: none !important;
}

/* RESPONSIVE */

@media(max-width:1000px) {
	.rb-app .app-container.rb-container {
		grid-template-columns: 1fr;
		margin: auto;
	}
	
	.rb-field-row .rb-field {
		min-width: 280px;
	}
}

@media(max-width:860px) {

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

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

@media(max-width:700px) {

	.rb-field-row .rb-field {
        min-width: 100%;
    }
	
	.rb-preview {
		overflow: scroll;
	}
	
	.rb-resume {
		width: fit-content;
	}
}

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

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

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

	.rb-inline-toolbar {
		min-width: 280px;
	}
}