/**
 * CSS Styles for Metal Weight Calculator Module (A4) - Ultra-Compact Engineering UI
 * Zero padding waste, integrated inline material bar, responsive specification table.
 */

.csw-metal-weight-wrapper {
	max-width: 1080px !important;
	width: 100%;
	margin: 0 auto;
	padding: 0.25rem;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
	color: #1e293b;
	line-height: 1.35;
}

/* Integrated Top Control Bar (Mode Tabs + Material Selector) */
.csw-top-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	flex-wrap: wrap;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 0.4rem 0.6rem;
	margin-bottom: 0.5rem;
}

.csw-mode-tabs {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	flex-wrap: wrap;
}

.csw-tab-group {
	display: inline-flex;
	background: #e2e8f0;
	padding: 2px;
	border-radius: 6px;
}

.csw-tab-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	padding: 0.3rem 0.55rem;
	font-size: 0.78rem;
	font-weight: 600;
	color: #475569;
	background: transparent;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	transition: all 0.15s ease;
	line-height: 1.2;
}

.csw-tab-btn.is-active {
	background: #ffffff;
	color: #0d9488;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.csw-tab-btn:hover:not(.is-active) {
	color: #0f172a;
}

/* Inline Material Selector Bar */
.csw-material-inline {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.csw-inline-field {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.csw-inline-label {
	font-size: 0.78rem;
	font-weight: 700;
	color: #475569;
	white-space: nowrap;
}

.csw-material-inline .csw-select,
.csw-material-inline .csw-input {
	height: 32px;
	padding: 0.25rem 0.5rem;
	font-size: 0.82rem;
	border-radius: 5px;
	background: #ffffff;
}

/* Section Header Badges */
.csw-section-hdr {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.4rem;
}

.csw-section-title {
	font-size: 0.82rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #475569;
}

/* Cards & Layout */
.csw-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 0.6rem 0.75rem;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
	margin-bottom: 0.5rem;
}

.csw-form-grid {
	display: grid;
	gap: 0.5rem;
}

.csw-grid-2 {
	grid-template-columns: repeat(2, 1fr);
}

.csw-grid-3 {
	grid-template-columns: repeat(3, 1fr);
}

.csw-field {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.csw-field__label {
	font-size: 0.75rem;
	font-weight: 600;
	color: #334155;
}

.csw-input,
.csw-select {
	width: 100%;
	padding: 0.35rem 0.55rem;
	font-size: 0.85rem;
	color: #0f172a;
	background: #f8fafc;
	border: 1px solid #cbd5e1;
	border-radius: 5px;
	box-sizing: border-box;
	height: 33px;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.csw-input:focus,
.csw-select:focus {
	outline: none;
	background: #ffffff;
	border-color: #0d9488;
	box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

/* 11 Profiles Compact Grid */
.csw-profiles-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
	gap: 0.38rem;
}

.csw-profile-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.15rem;
	padding: 0.3rem 0.2rem;
	min-height: 42px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.15s ease;
	color: #475569;
}

.csw-profile-tile:hover {
	border-color: #99f6e4;
	background: #f0fdfa;
	color: #0f766e;
}

.csw-profile-tile.is-active {
	background: #0d9488;
	color: #ffffff;
	border-color: #0d9488;
	box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
}

.csw-profile-icon {
	width: 18px;
	height: 18px;
}

.csw-profile-name {
	font-size: 0.7rem;
	font-weight: 600;
	text-align: center;
	line-height: 1.1;
}

/* Workspace 2-Column Layout */
.csw-workspace {
	display: grid;
	grid-template-columns: 1.05fr 0.95fr;
	gap: 0.5rem;
	align-items: start;
}

.csw-workspace__right {
	position: sticky;
	top: 0.5rem;
}

/* CAD SVG Canvas */
.csw-cad-card {
	background: #0f172a;
	color: #f8fafc;
	border-color: #1e293b;
	padding: 0.5rem 0.65rem;
}

.csw-cad-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.35rem;
}

.csw-cad-title {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: #94a3b8;
}

.csw-cad-badge {
	font-size: 0.62rem;
	font-weight: 700;
	color: #38bdf8;
	background: rgba(56, 189, 248, 0.15);
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
}

.csw-svg-canvas {
	width: 100%;
	height: 130px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #1e293b;
	border-radius: 5px;
	border: 1px solid #334155;
	overflow: hidden;
}

.csw-svg-canvas svg {
	width: 100%;
	height: 100%;
	max-height: 120px;
}

/* Lock Notice */
.csw-gost-lock-notice {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.3rem 0.5rem;
	background: #f1f5f9;
	border: 1px dashed #cbd5e1;
	border-radius: 5px;
	font-size: 0.75rem;
	color: #475569;
	margin-bottom: 0.4rem;
}

/* Hero Weight Banner */
.csw-hero-weight-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 0.65rem;
	background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
	color: #ffffff;
	border-radius: 6px;
	margin-bottom: 0.5rem;
	box-shadow: 0 2px 5px rgba(13, 148, 136, 0.2);
}

.csw-hero-label {
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	opacity: 0.9;
	text-transform: uppercase;
}

.csw-hero-val {
	font-size: 1.3rem;
	font-weight: 900;
	letter-spacing: -0.02em;
	margin-top: 0.05rem;
}

/* Results Display */
.csw-results-grid {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.csw-res-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.3rem 0.5rem;
	background: #f8fafc;
	border-radius: 5px;
	font-size: 0.8rem;
}

.csw-res-bars-item {
	align-items: flex-start;
}

.csw-res-bars-val {
	font-weight: 600;
	color: #0f172a;
	text-align: right;
	line-height: 1.25;
	font-size: 0.78rem;
}

.csw-res-item.csw-res-primary {
	background: #f0fdfa;
	border: 1px solid #99f6e4;
}

.csw-res-item.csw-res-primary .csw-res-val {
	font-size: 0.92rem;
	font-weight: 800;
	color: #0d9488;
}

.csw-res-item.csw-res-cost {
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
}

.csw-res-item.csw-res-cost .csw-res-val {
	font-size: 0.95rem;
	font-weight: 800;
	color: #047857;
}

.csw-res-label {
	color: #64748b;
	font-weight: 500;
}

.csw-res-val {
	font-weight: 700;
	color: #0f172a;
}

/* Informational Reference Card */
.csw-info-card {
	padding: 0.5rem 0.65rem;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
}

.csw-info-title {
	font-size: 0.75rem;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 0.25rem 0;
}

.csw-info-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0.2rem 0.5rem;
	font-size: 0.72rem;
	color: #475569;
}

.csw-info-cell {
	display: flex;
	justify-content: space-between;
	padding: 0.1rem 0;
	border-bottom: 1px dashed #e2e8f0;
}

.csw-info-cell strong {
	color: #0f172a;
}

/* Compact Specification Table */
.csw-spec-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.4rem;
	flex-wrap: wrap;
}

.csw-spec-actions {
	display: flex;
	gap: 0.3rem;
}

.csw-table-responsive {
	width: 100%;
	overflow-x: auto;
}

.csw-spec-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.78rem;
	text-align: left;
	table-layout: auto;
}

.csw-spec-table th {
	background: #f1f5f9;
	color: #334155;
	font-weight: 700;
	padding: 0.35rem 0.45rem;
	border-bottom: 2px solid #e2e8f0;
	white-space: nowrap;
}

.csw-spec-table td {
	padding: 0.35rem 0.45rem;
	border-bottom: 1px solid #e2e8f0;
	color: #1e293b;
	vertical-align: middle;
}

.csw-spec-meta {
	font-size: 0.72rem;
	color: #64748b;
	margin-top: 1px;
}

.csw-spec-table tr:hover td {
	background: #f8fafc;
}

.csw-empty-row td {
	text-align: center;
	color: #94a3b8;
	padding: 1rem 0.5rem;
}

.csw-summary-row td {
	background: #f8fafc;
	border-top: 2px solid #cbd5e1;
	font-size: 0.8rem;
	color: #0f172a;
}

/* Buttons */
.csw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.25rem;
	padding: 0.35rem 0.65rem;
	font-size: 0.78rem;
	font-weight: 700;
	border-radius: 5px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: all 0.15s ease;
}

.csw-btn-block {
	width: 100%;
}

.csw-btn-sm {
	padding: 0.2rem 0.45rem;
	font-size: 0.72rem;
}

.csw-btn-primary {
	background: #0d9488;
	color: #ffffff;
}

.csw-btn-primary:hover {
	background: #0f766e;
	box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
}

.csw-btn-secondary {
	background: #f1f5f9;
	color: #334155;
	border-color: #cbd5e1;
}

.csw-btn-secondary:hover {
	background: #e2e8f0;
	color: #0f172a;
}

.csw-btn-danger {
	background: #fef2f2;
	color: #dc2626;
	border-color: #fecaca;
}

.csw-btn-danger:hover {
	background: #fee2e2;
}

.csw-mt-2 { margin-top: 0.35rem; }
.csw-mt-3 { margin-top: 0.5rem; }

/* Mobile Responsive Optimization (< 768px) */
@media (max-width: 768px) {
	.csw-top-bar {
		flex-direction: column;
		align-items: stretch;
		gap: 0.4rem;
	}

	.csw-mode-tabs {
		justify-content: space-between;
	}

	.csw-tab-group {
		flex: 1;
		justify-content: space-between;
	}

	.csw-tab-btn {
		flex: 1;
		justify-content: center;
	}

	.csw-material-inline {
		flex-direction: column;
		align-items: stretch;
		gap: 0.35rem;
	}

	.csw-inline-field {
		justify-content: space-between;
	}

	.csw-material-inline .csw-select,
	.csw-material-inline .csw-input {
		flex: 1;
	}

	.csw-profiles-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 0.25rem;
	}

	.csw-workspace {
		grid-template-columns: 1fr !important;
	}

	.csw-workspace__right {
		position: static;
	}

	.csw-grid-3 {
		grid-template-columns: repeat(3, 1fr);
	}

	.csw-grid-2 {
		grid-template-columns: repeat(2, 1fr);
	}
}
