* {
  box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	padding: 20px;
	display: flex;
	justify-content: center;
	align-items: center;
	font-family: "Segoe UI", Arial, sans-serif;
	background: linear-gradient(135deg, #f0f4f8, #d9e2ec);
	color: #333;
}

a {
	text-decoration: none;
}

#container {
	width: min(500px, 100%);
	background: #fff;
	margin: 20px auto;
	padding: 25px;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

h1 {
	margin: 0 0 8px;
	font-size: 1.6rem;
	text-align: center;
	color: #333;
}

.subtitle {
	margin-bottom: 25px;
	text-align: center;
	color: #64748b;
}

label {
	display: block;
	margin-top: 15px;
	margin-bottom: 6px;
	font-weight: 600;
	color: #334155;
}

input, textarea, select, button {
	width: 100%;
	padding: 11px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-family: inherit;
	font-size: 1rem;
}

input:focus, textarea:focus, select:focus {
	outline: none;
	border-color: #0078d7;
	box-shadow: 0 0 0 3px rgba(0, 120, 215, 0.12);
}

textarea {
	min-height: 120px;
	resize: vertical;
}

button {
	border: none;
	background: #0078d7;
	color: white;
	font-weight: 600;
	cursor: pointer;
}

button:hover:not(:disabled) {
	background: #005fa3;
}

button:disabled {
	background: #94a3b8;
	cursor: not-allowed;
}

.field-group {
	margin-bottom: 15px;
}

.error {
	min-height: 18px;
	margin-top: 5px;
	color: #dc2626;
	font-size: 0.85rem;
}

.help-text {
	margin-top: 5px;
	color: #64748b;
	font-size: 0.8rem;
}

/* TEXT QR SETTINGS */

.text-settings-row {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 15px;
	margin-top: 8px;
}

.text-error-level {
	flex: 1;
}

.text-error-level label {
	margin: 0 0 5px;
	font-size: 0.8rem;
}

.text-error-level select {
	padding: 8px;
	font-size: 0.85rem;
}

.character-counter {
	padding-bottom: 9px;
	text-align: right;
	color: #64748b;
	font-size: 0.82rem;
	white-space: nowrap;
}

.character-counter.limit {
	color: #dc2626;
	font-weight: 600;
}

#generateBtn {
	margin-top: 10px;
	padding: 14px;
}

/* QR PREVIEW */

#qrcode-wrapper {
	width: min(500px, 100%);
	height: 450px;
	margin: 25px auto 0;
	display: none;
	justify-content: center;
	align-items: center;
	overflow: hidden;
	border: 1px solid #cbd5e1;
	border-radius: 12px;
	background: #ffffff;
	box-sizing: border-box;
}

#qrcode-wrapper.active {
	display: grid;
	place-items: center;
}

#qrcode {
	width: 200px;
	height: 200px;
	margin: 0;
	display: grid;
	place-items: center;
	flex-shrink: 0;
	transition: width 0.2s ease, height 0.2s ease;
}

#qrcode canvas,
#qrcode img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	position: static !important;
}

#options {
	display: none;
	margin-top: 25px;
	padding-top: 20px;
	border-top: 1px solid #e2e8f0;
}

.section-title {
	margin-bottom: 15px;
	color: #1e293b;
	font-size: 1.1rem;
	font-weight: 700;
}

/* QR SETTINGS */

.range-label {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 20px;
}

.range-label label {
	margin: 0;
}

input[type="range"] {
	padding: 0;
	border: none;
}

/* COLOUR */

.color-presets {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 10px;
	margin-top: 10px;
}

.color-preset {
	height: 42px;
	padding: 0;
	border: 3px solid transparent;
	border-radius: 8px;
	cursor: pointer;
}

.color-preset.selected {
	border-color: #64748b;
	box-shadow: 0 0 0 2px white, 0 0 0 4px #0078d7;
}

.color-name {
	margin-top: 8px;
	text-align: center;
	color: #475569;
	font-size: 0.85rem;
}

.color-note {
	margin-top: 10px;
	padding: 10px;
	border-radius: 8px;
	background: #f1f5f9;
	color: #475569;
	font-size: 0.85rem;
}

.button-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	margin-top: 20px;
}

/* PASSWORD */

.password-wrapper {
	position: relative;
}

.password-wrapper input {
	padding-right: 80px;
}

.toggle-password {
	position: absolute;
	top: 50%;
	right: 8px;
	width: auto;
	padding: 6px 10px;
	transform: translateY(-50%);
	background: #64748b;
	font-size: 0.8rem;
}

/* EVENT */

.date-time-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 15px;
}

/* HISTORY */

#historySection {
	margin-top: 30px;
	padding-top: 25px;
	border-top: 1px solid #e2e8f0;
}

.history-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 15px;
	margin-bottom: 15px;
}

.history-header h2 {
	margin: 0;
	font-size: 1.2rem;
	color: #1e293b;
}

.clear-history-btn {
	width: auto;
	padding: 8px 12px;
	background: #dc2626;
	font-size: 0.8rem;
}

#historyList {
	display: grid;
	gap: 10px;
}

.history-empty {
	padding: 20px;
	border: 1px dashed #cbd5e1;
	border-radius: 10px;
	text-align: center;
	color: #94a3b8;
}

.history-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 12px;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	background: #f8fafc;
}

.history-info {
	min-width: 0;
	flex: 1;
}

.history-type {
	margin-bottom: 4px;
	color: #1e293b;
	font-weight: 700;
}

.history-preview {
	width: 100%;
	overflow-wrap: anywhere;
	word-break: break-word;
	white-space: normal;
	color: #64748b;
	font-size: 0.85rem;
	line-height: 1.4;
}

.history-date {
	margin-top: 4px;
	color: #94a3b8;
	font-size: 0.75rem;
}

.history-actions {
	display: flex;
	gap: 6px;
}

.history-actions button {
	width: auto;
	padding: 7px 10px;
	font-size: 0.8rem;
}

.history-load {
	background: #0078d7;
}

.history-delete {
	background: #dc2626;
}

/* Header */
.site-header {
	width: 100%;
	max-width: 1200px;
	height: 70px;
	margin-bottom: 19px;
	padding: 0 2px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.logo {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
}

.tool-switcher {
	display: flex;
	align-items: center;
	padding: 4px;
	gap: 4px;
	background: #f4f4f5;
	border: 2px solid #ffc067;
	border-radius: 12px;
}

.tool-link {
	padding: 4px 14px;
	color: #666;
	text-decoration: none;
	letter-spacing: 1px;
	font-size: 14px;
	border-radius: 8px;
	transition: all 0.2s ease;
}

.tool-link:hover {
	color: #111;
	background: #ffffff;
}

.tool-link.active {
	background: #ffc067;
	color: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
	cursor: default;
	pointer-events: none;
}

/* =========================
	 FOOTER
========================= */
.footer {
	margin-top: 39px;
	font-size: 0.9rem;
	color: #ef811a;
	text-align: center;
}


/* MOBILE */

@media (max-width: 650px) {

body {
	padding: 10px;
}

#container {
	margin: 0;
	padding: 20px;
}

#qrcode {
	max-width: calc(100vw - 40px);
	max-height: calc(100vw - 40px);
}

.date-time-grid {
	grid-template-columns: 1fr;
}

.text-settings-row {
	flex-direction: column;
	align-items: stretch;
}

.character-counter {
	padding-bottom: 0;
}

.history-header {
	align-items: flex-start;
	flex-direction: column;
}
}