* {
	box-sizing: border-box;
}

:root {
	--bg: #f5f4f1;
	--bg-soft: #fbfaf8;
	--surface: #ffffff;
	--surface-soft: #faf8f4;

	--sidebar: #161616;
	--sidebar-light: #222222;

	--primary: #d97706;
	--primary-hover: #b85f00;
	--primary-soft: #fff1df;
	--primary-soft-border: #f3cf9b;

	--accent: #e9b85a;
	--accent-dark: #c98a1f;

	--text: #171717;
	--text-soft: #4b5563;
	--text-muted: #6b7280;

	--border: #e7e2d9;
	--border-strong: #d8d0c3;

	--success-bg: #edf8f0;
	--success-text: #1f6b3b;
	--success-border: #b7dfc2;

	--error-bg: #fdf0f0;
	--error-text: #b42318;
	--error-border: #f0c7c7;

	--danger: #c62828;

	--shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.05);
	--shadow-md: 0 12px 30px rgba(0, 0, 0, 0.08);
	--shadow-lg: 0 18px 45px rgba(0, 0, 0, 0.12);

	--radius-sm: 10px;
	--radius-md: 14px;
	--radius-lg: 18px;
	--radius-xl: 22px;

	--transition: all 0.22s ease;
}

html,
body {
	margin: 0;
	padding: 0;
}

body {
	font-family: Arial, sans-serif;
	background: linear-gradient(180deg, #faf8f4 0%, #f4f1eb 100%);
	color: var(--text);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

a {
	color: var(--primary);
	text-decoration: none;
	transition: var(--transition);
}

a:hover {
	color: var(--primary-hover);
}

img {
	max-width: 100%;
	height: auto;
}

small {
	color: var(--text-muted);
}

hr {
	border: 0;
	border-top: 1px solid var(--border);
	margin: 24px 0;
}

.container {
	width: min(1240px, 92%);
	margin: 0 auto;
}

/* ===== HEADER / FOOTER PUBBLICI ===== */

.site-header,
.site-footer {
	background: linear-gradient(135deg, #161616 0%, #232323 100%);
	color: #ffffff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.site-header .nav,
.site-footer .container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 18px 0;
}

.site-header nav a {
	color: rgba(255, 255, 255, 0.88);
	margin-left: 18px;
	font-weight: 600;
	position: relative;
}

.site-header nav a:hover {
	color: #ffffff;
}

.site-header nav a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -6px;
	width: 0;
	height: 2px;
	background: var(--primary);
	transition: var(--transition);
}

.site-header nav a:hover::after {
	width: 100%;
}

.brand {
	font-weight: 700;
	font-size: 20px;
	letter-spacing: 0.2px;
	color: #ffffff;
}

/* ===== LAYOUT BASE ===== */

.page-content {
	padding: 36px 0 68px;
}

.hero,
.page-header,
.card,
.detail-page,
.auth-card,
.stat-card,
.admin-main,
.table-wrapper,
.gallery-card,
.side-card {
	background: var(--surface);
	border: 1px solid rgba(231, 226, 217, 0.95);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
}

.hero,
.page-header,
.detail-page {
	padding: 30px;
	margin-bottom: 24px;
}

.with-action {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
}

.cards-grid,
.stats-grid,
.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 22px;
}

.card,
.stat-card,
.gallery-card {
	overflow: hidden;
	transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover,
.stat-card:hover,
.gallery-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-lg);
	border-color: rgba(217, 119, 6, 0.18);
}

.card img,
.detail-cover,
.gallery-grid img,
.preview-image {
	width: 100%;
	display: block;
	border-radius: 12px;
}

.card img,
.detail-cover {
	object-fit: cover;
}

.card-body {
	padding: 20px;
}

.card-body h3,
.page-header h1,
.hero h1,
.detail-page h1,
.auth-card h1,
.auth-card h2 {
	margin-top: 0;
	margin-bottom: 12px;
	color: var(--text);
	letter-spacing: -0.02em;
}

.card-body p,
.detail-text,
.page-header p,
.hero p {
	color: var(--text-soft);
}

/* ===== BADGE ===== */

.badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--primary-soft);
	color: var(--primary-hover);
	padding: 7px 12px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	margin-bottom: 12px;
	border: 1px solid var(--primary-soft-border);
}

/* ===== TITOLI / TESTI ===== */

.section-title {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	margin: 34px 0 18px;
}

.section-title h2,
.section-title h3 {
	margin: 0;
	color: var(--text);
}

.detail-text {
	line-height: 1.8;
	margin: 18px 0 22px;
}

.task-list {
	padding-left: 22px;
	line-height: 1.9;
	color: var(--text-soft);
}

.task-list li::marker {
	color: var(--primary);
}

/* ===== ALERT ===== */

.alert {
	padding: 15px 18px;
	border-radius: 12px;
	margin-bottom: 18px;
	border: 1px solid transparent;
	font-weight: 600;
	box-shadow: var(--shadow-sm);
}

.success {
	background: var(--success-bg);
	color: var(--success-text);
	border-color: var(--success-border);
}

.error {
	background: var(--error-bg);
	color: var(--error-text);
	border-color: var(--error-border);
}

/* ===== BOTTONI ===== */

.button,
button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
	color: #ffffff;
	border: 0;
	padding: 12px 18px;
	border-radius: 12px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	box-shadow: 0 10px 24px rgba(217, 119, 6, 0.22);
	transition: var(--transition);
}

.button:hover,
button:hover {
	transform: translateY(-1px);
	filter: brightness(1.02);
	box-shadow: 0 14px 30px rgba(217, 119, 6, 0.28);
}

.button.secondary {
	background: linear-gradient(135deg, #5c5c5c 0%, #3f3f3f 100%);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.button.secondary:hover {
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.link-danger {
	background: transparent;
	color: var(--danger);
	padding: 0;
	box-shadow: none;
	font-weight: 700;
}

.link-danger:hover {
	color: #8f1d1d;
	transform: none;
}

/* ===== TABELLE ===== */

.table-wrapper {
	overflow: hidden;
}

.table {
	width: 100%;
	background: var(--surface);
	border-collapse: collapse;
}

.table thead {
	background: #faf7f1;
}

.table th,
.table td {
	padding: 15px 16px;
	border-bottom: 1px solid var(--border);
	text-align: left;
	vertical-align: top;
}

.table th {
	color: var(--text);
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.table td {
	color: var(--text-soft);
}

.table tbody tr {
	transition: background 0.18s ease;
}

.table tbody tr:hover {
	background: #fffaf2;
}

.actions {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

/* ===== SHELL ADMIN ===== */

.admin-shell {
	display: grid;
	grid-template-columns: 270px 1fr;
	min-height: 100vh;
	background: var(--bg);
}

.admin-sidebar {
	background: linear-gradient(180deg, #fcfbf8 0%, #f4efe7 100%);
	padding: 28px 20px;
	color: #171717;
	border-right: 1px solid #e5ddd1;
	box-shadow: 4px 0 18px rgba(0, 0, 0, 0.04);
	position: sticky;
	top: 0;
	height: 100vh;
}

.admin-sidebar h2 {
	margin: 0 0 24px 0;
	font-size: 22px;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: #171717;
	padding-bottom: 16px;
	border-bottom: 1px solid #e7e2d9;
}

.admin-sidebar a {
	display: flex;
	align-items: center;
	padding: 12px 14px;
	margin-bottom: 6px;
	color: #3f3f46;
	border-radius: 12px;
	font-weight: 600;
	transition: all 0.2s ease;
}

.admin-sidebar a:hover {
	background: #fff1df;
	color: #b85f00;
	transform: translateX(3px);
}

.admin-sidebar a.active {
	background: linear-gradient(135deg, #e58a17 0%, #cc6f00 100%);
	color: #ffffff;
	box-shadow: 0 10px 24px rgba(204, 111, 0, 0.22);
}

.admin-sidebar a.active {
	position: relative;
}

.admin-sidebar a.active::before {
	content: "";
	position: absolute;
	left: -8px;
	top: 10px;
	bottom: 10px;
	width: 4px;
	border-radius: 999px;
	background: #e58a17;
}

.admin-content-area {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-width: 0;
}

.admin-main {
	flex: 1;
	margin: 24px;
	padding: 28px;
	min-width: 0;
}

/* ===== FOOTER ADMIN ===== */

.admin-footer {
	padding: 0 24px 20px 24px;
}

.admin-footer::before {
	content: "";
	display: block;
	height: 1px;
	background: linear-gradient(90deg, transparent, #ddd4c5, transparent);
	margin-bottom: 14px;
	opacity: 0.8;
}

.admin-footer-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 14px 18px;
	//border-radius: 14px;
	//background: linear-gradient(135deg, #171717 0%, #232323 100%);
	color: rgba(96, 96, 96, 0.86);
	font-size: 13px;
	line-height: 1.2;
	//box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ===== CARD STATISTICHE ===== */

.stat-card {
	padding: 22px;
}

.stat-card .label {
	display: block;
	margin-bottom: 8px;
	color: var(--text-muted);
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.stat-card .value {
	font-size: 32px;
	line-height: 1;
	font-weight: 700;
	color: var(--text);
}

/* ===== FORM ===== */

.form-grid {
	display: grid;
	gap: 14px;
}

.form-row {
	display: block;
}

.form-grid label {
	display: block;
	margin-bottom: 6px;
	color: var(--text);
	font-size: 14px;
	font-weight: 700;
}

.form-grid input[type="text"],
.form-grid input[type="email"],
.form-grid input[type="password"],
.form-grid input[type="number"],
.form-grid input[type="file"],
.form-grid select {
	width: 100%;
	height: 48px;
	padding: 0 14px;
	border: 1px solid var(--border-strong);
	border-radius: 12px;
	background-color: #ffffff;
	color: var(--text);
	font-size: 14px;
	outline: none;
	transition: var(--transition);
	display: block;
	line-height: 48px;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}

.form-grid textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--border-strong);
	border-radius: 12px;
	background-color: #ffffff;
	color: var(--text);
	font-size: 14px;
	outline: none;
	transition: var(--transition);
	display: block;
	min-height: 140px;
	resize: vertical;
	line-height: 1.6;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}

.form-grid input[type="text"]:focus,
.form-grid input[type="email"]:focus,
.form-grid input[type="password"]:focus,
.form-grid input[type="number"]:focus,
.form-grid input[type="file"]:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.auth-card input:focus {
	border-color: #efb15c;
	box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.14);
}

.form-grid select {
	height: 48px !important;
	line-height: 48px !important;
	padding-right: 40px;
	background-image: url("data:image/svg+xml,%3Csvg fill='%23706758' height='20' viewBox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7l4.5 5 4.5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 16px;
	cursor: pointer;
}

.form-actions {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
	margin-top: 12px;
	padding-top: 10px;
}

.field-error {
	color: var(--error-text);
	font-size: 13px;
	font-weight: 600;
}

.helper-text {
	color: var(--text-muted);
	font-size: 13px;
}

.checkbox-label {
	display: flex;
	gap: 10px;
	align-items: center;
	margin: 8px 0;
	color: var(--text-soft);
	font-weight: 600;
}

/* ===== PAGINA LAVORI ===== */

.project-form-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 24px;
	align-items: start;
}

.project-form-main,
.project-form-side {
	min-width: 0;
}

.side-card {
	padding: 20px;
	position: sticky;
	top: 24px;
}

.side-card h2 {
	margin-top: 0;
	margin-bottom: 16px;
	font-size: 18px;
	color: var(--text);
}

.preview-image {
	margin-top: 10px;
	border: 1px solid var(--border);
	box-shadow: var(--shadow-sm);
}

.preview-image-large {
	width: 100%;
	max-width: 100%;
	border-radius: 14px;
	border: 1px solid var(--border);
	box-shadow: var(--shadow-sm);
	display: block;
}

.image-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 240px;
	padding: 20px;
	text-align: center;
	color: var(--text-muted);
	background: var(--surface-soft);
	border: 1px dashed var(--border-strong);
	border-radius: 14px;
}

.page-section {
	margin-top: 28px;
}

/* ===== GALLERY ===== */

.gallery-grid {
	align-items: start;
}

.gallery-card {
	padding: 10px;
	border-radius: 16px;
	box-shadow: var(--shadow-sm);
}

.gallery-card img {
	border-radius: 12px;
}

.gallery-table td {
	vertical-align: middle;
}

.gallery-table-image {
	width: 90px;
	height: 70px;
	object-fit: cover;
	border-radius: 10px;
	border: 1px solid var(--border);
	display: block;
}

.drag-handle {
	cursor: grab;
	font-size: 18px;
	text-align: center;
	color: #7b6e5a;
	user-select: none;
}

tr.dragging {
	opacity: 0.52;
}

tr.drag-over {
	border-top: 2px solid var(--primary);
}

/* ===== UPLOAD ===== */

.file-input-hidden {
	position: absolute;
	left: -9999px;
	opacity: 0;
	pointer-events: none;
}

.upload-dropzone {
	position: relative;
	padding: 26px 20px;
	border: 2px dashed var(--border-strong);
	border-radius: 16px;
	background: linear-gradient(180deg, #fffdfa 0%, #faf7f1 100%);
	text-align: center;
	cursor: pointer;
	transition: var(--transition);
}

.upload-dropzone:hover {
	border-color: #ebb25d;
	background: #fff8ef;
}

.upload-dropzone.is-dragover {
	border-color: var(--primary);
	background: #fff3e2;
	box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.10);
}

.upload-dropzone-title {
	margin-bottom: 6px;
	color: var(--text);
	font-size: 15px;
	font-weight: 700;
}

.upload-dropzone-text {
	color: var(--text-soft);
	font-size: 14px;
	margin-bottom: 6px;
}

.upload-dropzone-note {
	color: var(--text-muted);
	font-size: 12px;
}

.upload-file-list {
	margin-top: 12px;
	display: grid;
	gap: 8px;
}

.upload-file-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 12px;
	background: #fbf8f2;
	border: 1px solid var(--border);
	border-radius: 12px;
	color: var(--text-soft);
	font-size: 13px;
}

.upload-file-name {
	font-weight: 600;
	color: var(--text);
	word-break: break-word;
}

.upload-file-size {
	color: var(--text-muted);
	white-space: nowrap;
}

/* ===== LOGIN ===== */

.auth-body {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 20px;
	background:
		radial-gradient(circle at 20% 20%, rgba(217, 119, 6, 0.10), transparent 40%),
		radial-gradient(circle at 80% 80%, rgba(0, 0, 0, 0.06), transparent 40%),
		linear-gradient(180deg, #f7f3ed 0%, #efe9df 100%);
}

.auth-body::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(120deg, rgba(233, 184, 90, 0.08), transparent 40%);
	pointer-events: none;
}

.auth-card {
	position: relative;
	width: min(420px, 92%);
	padding: 36px 32px;
	border-radius: 22px;
	background: #ffffff;
	border: 1px solid rgba(231, 226, 217, 0.9);
	box-shadow:
		0 30px 60px rgba(0, 0, 0, 0.12),
		0 10px 20px rgba(0, 0, 0, 0.06);
	animation: authFadeIn 0.4s ease;
}

.auth-card h1,
.auth-card h2 {
	margin: 0 0 10px 0;
	text-align: center;
	font-size: 24px;
	font-weight: 700;
	color: var(--text);
	letter-spacing: -0.02em;
}

.auth-card p {
	text-align: center;
	color: var(--text-muted);
	font-size: 14px;
	margin-bottom: 26px;
}

.auth-card form {
	display: grid;
	gap: 14px;
}

.auth-card label {
	font-size: 13px;
	font-weight: 700;
	color: var(--text);
}

.auth-card input[type="email"],
.auth-card input[type="password"] {
	width: 100%;
	height: 48px;
	padding: 0 14px;
	border: 1px solid var(--border-strong);
	border-radius: 12px;
	background: #ffffff;
	font-size: 14px;
	color: var(--text);
	transition: var(--transition);
}

.auth-card input:hover {
	border-color: #d8c9b3;
}

.auth-card button {
	margin-top: 6px;
	height: 48px;
	border-radius: 12px;
	font-weight: 700;
	font-size: 14px;
}

.auth-card .alert {
	margin-bottom: 16px;
	font-size: 14px;
}

@keyframes authFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

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

/* ===== RESPONSIVE ===== */

@media (max-width: 1100px) {
	.admin-shell {
		grid-template-columns: 220px 1fr;
	}

	.admin-main {
		margin: 18px;
		padding: 22px;
	}

	.admin-footer {
		padding: 0 18px 18px 18px;
	}
}

@media (max-width: 980px) {
	.project-form-layout {
		grid-template-columns: 1fr;
	}

	.side-card {
		position: relative;
		top: 0;
	}
}

@media (max-width: 900px) {
	.admin-shell {
		grid-template-columns: 1fr;
	}

	.admin-sidebar {
		position: relative;
		height: auto;
		padding-bottom: 16px;
	}

	.admin-main {
		margin: 12px;
		padding: 18px;
	}

	.with-action,
	.site-header .nav,
	.section-title {
		flex-direction: column;
		align-items: flex-start;
	}

	.cards-grid,
	.stats-grid,
	.gallery-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.page-content {
		padding: 22px 0 40px;
	}

	.hero,
	.page-header,
	.detail-page,
	.admin-main,
	.auth-card {
		padding: 20px;
	}

	.site-header .nav,
	.site-footer .container {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.site-header nav a {
		margin-left: 0;
		margin-right: 14px;
	}

	.table th,
	.table td {
		padding: 12px;
	}

	.button,
	button {
		width: 100%;
	}

	.form-actions {
		flex-direction: column;
		align-items: stretch;
	}
}