:root {
	--primary: #34495e;
	--accent: #3498db;
	--accent-hover: #2980b9;
	--danger: #e74c3c;
	--success: #27ae60;
	--bg: #f8f9fa;
	--card-bg: #ffffff;
	--text: #2c3e50;
	--border: #e2e8f0;
	--radius: 12px;
	--shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body {
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	background: var(--bg);
	color: var(--text);
	margin: 0;
	padding: 0;
	padding-bottom: 120px;
}

.container {
	max-width: 1000px;
	margin: 0 auto;
	padding: 20px;
}

/* --- Header --- */
header {
	text-align: center;
	padding-top: 20px;
}
header h1 {
	font-weight: 800;
	letter-spacing: -1px;
	margin: 0;
	color: var(--primary);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 15px;
}
.logo {
	max-height: 45px;
}

/* --- Cards --- */
.card {
	background: var(--card-bg);
	border-radius: var(--radius);
	padding: 30px;
	margin-bottom: 25px;
	box-shadow: var(--shadow);
	border: 1px solid white;
}

.step-header {
	display: flex;
	align-items: center;
	margin-bottom: 25px;
	border-bottom: 1px solid #f1f5f9;
	padding-bottom: 15px;
}
.step-number {
	background: var(--primary);
	color: #fff;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	margin-right: 15px;
}
.step-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--primary);
}

/* --- Inputs --- */
.input-group {
	margin-bottom: 20px;
}
.input-label {
	display: block;
	font-size: 0.85rem;
	font-weight: 700;
	color: #64748b;
	margin-bottom: 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

select,
input[type="number"],
input[type="text"] {
	width: 100%;
	padding: 12px 15px;
	font-size: 1rem;
	border: 2px solid var(--border);
	border-radius: 8px;
	background-color: #fff;
	box-sizing: border-box;
	font-family: inherit;
}
select:focus,
input:focus {
	outline: none;
	border-color: var(--accent);
}

/* --- Tiles (DN) --- */
.tile-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}
.tile-option {
	flex: 1 1 auto;
	background: #fff;
	border: 2px solid var(--border);
	border-radius: 8px;
	padding: 12px 20px;
	text-align: center;
	cursor: pointer;
	font-weight: 600;
	min-width: 60px;
	user-select: none;
	transition: 0.2s;
}
.tile-option:hover {
	border-color: #cbd5e1;
	background: #f1f5f9;
}
.tile-option.selected {
	border-color: var(--accent);
	background: var(--accent);
	color: white;
	box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

/* --- Type Cards --- */
.type-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 15px;
}
.type-card {
	border: 2px solid var(--border);
	border-radius: 8px;
	padding: 15px;
	cursor: pointer;
	text-align: center;
	background: #fff;
	transition: 0.2s;
}
.type-card:hover {
	border-color: var(--accent);
	transform: translateY(-2px);
}
.type-card.selected {
	border-color: var(--accent);
	background: #ebf8ff;
	box-shadow: 0 0 0 1px var(--accent);
}
.type-name {
	font-weight: 800;
	font-size: 1.2rem;
	display: block;
	margin-bottom: 5px;
}
.type-img-preview {
	height: 40px;
	object-fit: contain;
	opacity: 0.7;
}
.type-card.selected .type-img-preview {
	opacity: 1;
}

/* --- Visual Area --- */
.visual-container {
	position: relative;
	background: #f1f5f9;
	border-radius: 8px;
	padding: 40px 20px;
	margin: 20px 0;
	display: flex;
	justify-content: center;
	align-items: center;
	overflow: hidden;
}
.hose-connector {
	flex: 1;
	height: 40px;
	background: url("/images/constructor-detail02.png") center repeat-x;
	background-size: contain;
	min-width: 50px;
	margin: 0 10px;
	opacity: 0.8;
}
.fit-img {
	width: 120px;
	height: 120px;
	object-fit: contain;
	transition: transform 0.3s;
	mix-blend-mode: multiply;
	filter: contrast(1.05);
}

/* --- Fittings Layout --- */
.fittings-split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
}
@media (max-width: 768px) {
	.fittings-split {
		grid-template-columns: 1fr;
	}
}

.side-block {
	background: #f8fafc;
	padding: 20px;
	border-radius: 8px;
	border: 1px solid var(--border);
}
.side-title {
	text-align: center;
	font-weight: 700;
	color: var(--primary);
	margin-bottom: 15px;
	text-transform: uppercase;
	font-size: 0.9rem;
}

/* Angle Buttons */
.angle-options {
	display: flex;
	gap: 5px;
}
.angle-btn {
	flex: 1;
	border: 2px solid var(--border);
	background: #fff;
	border-radius: 6px;
	padding: 8px 0;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
}
.angle-btn.selected {
	border-color: var(--accent);
	background: #ebf8ff;
	color: var(--accent);
}
.angle-icon {
	width: 24px;
	height: 24px;
	stroke: currentColor;
	stroke-width: 2;
	fill: none;
}

/* --- Sticky Footer --- */
.sticky-action-bar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: #fff;
	box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
	padding: 20px;
	z-index: 100;
	border-top: 1px solid #eee;
}
.action-content {
	max-width: 1000px;
	width: 100%;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
}

.nomenclature-box {
	flex: 1;
}
.nomenclature-label {
	font-size: 0.8rem;
	color: #999;
	text-transform: uppercase;
	font-weight: 700;
	margin-bottom: 4px;
}
.nomenclature-text {
	font-size: 1.4rem;
	font-weight: 800;
	color: #2c3e50;
	background: #f1f5f9;
	padding: 8px 15px;
	border-radius: 6px;
	border-left: 5px solid var(--accent);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.price-box {
	text-align: right;
	min-width: 150px;
}
.price-total {
	font-size: 2rem;
	font-weight: 900;
	color: var(--text);
	line-height: 1;
}
.price-label {
	font-size: 0.85rem;
	color: #999;
	font-weight: 500;
}

.header-admin-link {
	text-align: center;
	margin-bottom: 30px;
}
.admin-link {
	color: #cbd5e1;
	text-decoration: none;
	font-size: 0.8rem;
}
.admin-link:hover {
	color: var(--accent);
}

/* --- Toggle Switch --- */
.toggle-switch {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 20px 0;
	cursor: pointer;
}
.toggle-switch input {
	display: none;
}
.switch-track {
	width: 44px;
	height: 24px;
	background: #cbd5e1;
	border-radius: 20px;
	position: relative;
	transition: 0.3s;
}
.switch-knob {
	width: 18px;
	height: 18px;
	background: white;
	border-radius: 50%;
	position: absolute;
	top: 3px;
	left: 3px;
	transition: 0.3s;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
input:checked + .switch-track {
	background: var(--accent);
}
input:checked + .switch-track .switch-knob {
	transform: translateX(20px);
}

/* --- ADMIN --- */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: none;
	z-index: 2000;
	align-items: center;
	justify-content: center;
	backdrop-filter: blur(4px);
}
.modal-overlay.active {
	display: flex;
}
.modal-window {
	background: #fff;
	width: 95%;
	max-width: 1100px;
	height: 90vh;
	border-radius: 12px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.modal-header {
	padding: 15px 20px;
	background: var(--primary);
	color: white;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.modal-body {
	padding: 20px;
	overflow-y: auto;
	background: #f8f9fa;
	flex: 1;
}

.admin-tabs {
	display: flex;
	gap: 10px;
	background: white;
	padding: 10px 20px;
	border-bottom: 1px solid #ddd;
}
.admin-tab {
	padding: 10px 20px;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 600;
	color: #555;
	background: #eee;
	border: none;
	transition: 0.2s;
}
.admin-tab.active {
	background: var(--primary);
	color: white;
}
.tab-content {
	display: none;
	padding-top: 20px;
}
.tab-content.active {
	display: block;
	animation: fadeIn 0.3s;
}
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.admin-section {
	background: white;
	padding: 25px;
	border-radius: 8px;
	border: 1px solid #eee;
	margin-bottom: 20px;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}
.admin-h4 {
	margin-top: 0;
	color: var(--primary);
	border-bottom: 2px solid var(--accent);
	display: inline-block;
	padding-bottom: 5px;
	margin-bottom: 20px;
}

.admin-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
}
.admin-table th,
.admin-table td {
	border: 1px solid #eee;
	padding: 10px;
	text-align: center;
}
.admin-table th {
	background: #34495e;
	color: white;
}
.admin-input-s {
	width: 70px;
	padding: 5px;
	text-align: center;
	border: 1px solid #ccc;
	border-radius: 4px;
}

.tag-container {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 5px;
	margin-bottom: 10px;
}
.tag {
	background: #e0e0e0;
	padding: 4px 10px;
	border-radius: 15px;
	font-size: 0.85em;
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
}
.tag-del {
	color: #c0392b;
	cursor: pointer;
	font-weight: bold;
}
.tag-del:hover {
	color: red;
}

.fit-admin-card {
	border: 1px solid #e0e0e0;
	background: #fff;
	padding: 15px;
	margin-bottom: 15px;
	border-radius: 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	position: relative;
}
.fit-admin-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: #f8f9fa;
	padding: 10px;
	border-radius: 6px;
}

.btn-green {
	background: var(--success);
	color: white;
	border: none;
	padding: 8px 15px;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 600;
}
.btn-red {
	background: var(--danger);
	color: white;
	border: none;
	padding: 5px 10px;
	border-radius: 4px;
	cursor: pointer;
}
.btn-primary {
	background: var(--primary);
	color: white;
	border: none;
	padding: 10px 20px;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 600;
}

/* --- Стили для Матрицы Фитингов в Админке --- */
.matrix-container {
	overflow-x: auto;
	border: 1px solid #eee;
	border-radius: 4px;
	margin-bottom: 10px;
	background: #fff;
}
.fit-matrix-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
	min-width: 600px; /* Чтобы не сжималась слишком сильно */
}
.fit-matrix-table th {
	background: #f1f2f6;
	padding: 8px;
	border: 1px solid #ddd;
	color: #555;
	font-weight: 600;
}
.fit-matrix-table td {
	padding: 5px;
	border: 1px solid #eee;
	text-align: center;
}
.fit-matrix-table input {
	width: 60px;
	padding: 4px;
	text-align: center;
	border: 1px solid #ccc;
	border-radius: 3px;
	font-size: 0.9em;
}
.fit-matrix-table input:focus {
	border-color: var(--accent);
	outline: none;
	background: #ebf8ff;
}
/* Фиксируем первый столбец (название резьбы) при прокрутке */
.fit-matrix-table th:first-child,
.fit-matrix-table td:first-child {
	position: sticky;
	left: 0;
	background: #fff;
	z-index: 2;
	border-right: 2px solid #ddd;
	min-width: 100px;
	text-align: left;
	padding-left: 10px;
}
.fit-matrix-table th:first-child {
	background: #f1f2f6;
	z-index: 3;
}

/* --- Стили для сворачиваемых блоков (Аккордеон) --- */
.fit-admin-header {
	cursor: pointer;
	transition: background 0.2s;
}
.fit-admin-header:hover {
	background: #eef2f5 !important;
}

/* Скрытый контент */
.fit-card-body {
	display: none; /* По умолчанию скрыто */
	padding-top: 15px;
	border-top: 1px solid #eee;
	margin-top: 10px;
}

/* Класс для открытия */
.fit-admin-card.open .fit-card-body {
	display: block;
	animation: slideDown 0.2s ease-out;
}

/* Стрелочка */
.arrow-icon {
	display: inline-block;
	margin-right: 10px;
	transition: transform 0.2s;
	font-size: 0.8em;
	color: #777;
}

/* Поворот стрелочки при открытии */
.fit-admin-card.open .arrow-icon {
	transform: rotate(90deg);
	color: var(--accent);
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-5px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Кнопка редактирования (карандаш) */
.tag-edit {
	cursor: pointer;
	margin-left: 8px;
	margin-right: 4px;
	color: #3498db; /* Синий */
	font-size: 1.1em;
	transition: 0.2s;
}
.tag-edit:hover {
	color: #2980b9;
	transform: scale(1.1);
}

/* --- Новые стили для вкладок (Табы углов) --- */

/* Контейнер для вкладок */
.angle-tabs-wrapper {
	display: flex;
	background: #eef2f6; /* Серый фон подложки */
	padding: 4px;
	border-radius: 8px;
	margin-bottom: 20px;
	gap: 4px; /* Отступ между кнопками */
}

/* Сама вкладка */
.angle-tab {
	flex: 1;
	text-align: center;
	padding: 10px 15px;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.95rem;
	color: #64748b;
	border-radius: 6px;
	transition: all 0.2s ease;
	border: 1px solid transparent;
	user-select: none;
}

/* Наведение */
.angle-tab:hover {
	background: rgba(255, 255, 255, 0.5);
	color: #34495e;
}

/* Активная вкладка */
.angle-tab.active {
	background: #fff; /* Белый фон для активной */
	color: var(--accent); /* Синий текст (из ваших переменных) */
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08); /* Легкая тень для объема */
	border-color: #dfe6e9;
}

/* Контент внутри вкладки */
.angle-content {
	animation: fadeIn 0.3s ease-out;
	background: #fff;
	border: 1px solid #f1f5f9;
	border-radius: 8px;
	padding: 15px;
}

/* Анимация появления */
@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(5px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
