/**
 * Styles for Intermittent Weld Calculator.
 *
 * @package CalculatSvark
 */

/* abbr tooltip without dotted underline */
.csw-intermittent-weld-card abbr {
	text-decoration: none;
	border-bottom: 1px dotted #5e6d82;
	cursor: help;
}

.csw-tab-icon,
.csw-level-icon {
	font-style: normal;
	margin-right: 4px;
}

.csw-intermittent-weld-card {
	max-width: 760px;
	margin: 0 auto;
	padding: 24px;
	background: #ffffff;
	border-radius: 12px;
	border: 1px solid #e2e8f0;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #17345c;
	box-sizing: border-box;
}

@media (max-width: 640px) {
	.csw-intermittent-weld-card {
		padding: 16px;
		border-radius: 8px;
	}
}

/* Print Header (Hidden on web, visible on print) */
.csw-print-header {
	display: none;
}

/* Level Toggle (Simple vs Engineering) */
.csw-level-toggle {
	display: inline-flex;
	background: #f1f5f9;
	padding: 4px;
	border-radius: 8px;
	margin-bottom: 20px;
	gap: 4px;
	width: 100%;
	box-sizing: border-box;
}

.csw-level-btn {
	flex: 1;
	padding: 10px 14px;
	border: none;
	background: transparent;
	color: #475569;
	font-size: 14px;
	font-weight: 600;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
}

@media (max-width: 480px) {
	.csw-level-btn {
		font-size: 12px;
		padding: 8px 8px;
	}
}

.csw-level-btn:hover {
	color: #109a8c;
}

.csw-level-btn--active {
	background: #ffffff;
	color: #109a8c;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Mode Tabs */
.csw-tabs {
	display: flex;
	gap: 8px;
	border-bottom: 2px solid #e2e8f0;
	margin-bottom: 24px;
}

@media (max-width: 640px) {
	.csw-tabs {
		overflow-x: auto;
		white-space: nowrap;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 4px;
		gap: 4px;
	}
}

.csw-tab {
	padding: 10px 16px;
	border: none;
	background: none;
	color: #5e6d82;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border-bottom: 3px solid transparent;
	margin-bottom: -2px;
	transition: all 0.2s ease;
	flex-shrink: 0;
	white-space: nowrap;
}

@media (max-width: 640px) {
	.csw-tab {
		font-size: 12px;
		padding: 8px 10px;
	}
}

.csw-tab:hover {
	color: #109a8c;
}

.csw-tab--active {
	color: #109a8c;
	border-bottom-color: #109a8c;
}

/* Form Structure */
.csw-form {
	margin-bottom: 24px;
}

.csw-form-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}

@media (max-width: 640px) {
	.csw-form-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}
}

.csw-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.csw-field label {
	font-size: 13px;
	font-weight: 600;
	color: #17345c;
}

.csw-required {
	color: #ef4444;
}

.csw-input-group {
	display: flex;
	align-items: center;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	background: #ffffff;
	overflow: hidden;
	transition: border-color 0.2s ease;
}

.csw-input-group:focus-within {
	border-color: #109a8c;
	box-shadow: 0 0 0 2px rgba(16, 154, 140, 0.15);
}

/* Invalid input group state (BUG-07) */
.csw-input-group--invalid {
	border-color: #ef4444 !important;
	box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12) !important;
}

.csw-input {
	flex: 1;
	padding: 8px 12px;
	border: none;
	outline: none;
	font-size: 14px;
	color: #17345c;
	min-width: 0;
}

.csw-unit {
	padding: 8px 12px;
	background: #f8fafc;
	color: #64748b;
	font-size: 13px;
	border-left: 1px solid #cbd5e1;
	flex-shrink: 0;
}

.csw-select {
	padding: 8px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font-size: 14px;
	color: #17345c;
	background: #ffffff;
	outline: none;
	transition: border-color 0.2s ease;
	width: 100%;
	box-sizing: border-box;
}

.csw-select:focus {
	border-color: #109a8c;
}

.csw-hint {
	font-size: 11px;
	color: #64748b;
}

/* Radio Group */
.csw-radio-group {
	display: flex;
	gap: 16px;
	padding: 6px 0;
	flex-wrap: wrap;
}

.csw-radio-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	cursor: pointer;
}

.csw-radio-label input[type="radio"] {
	accent-color: #109a8c;
}

/* Collapsible Details */
.csw-details {
	margin-top: 16px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background: #f8fafc;
	overflow: hidden;
}

.csw-details-summary {
	padding: 12px 16px;
	font-size: 13px;
	font-weight: 600;
	color: #109a8c;
	cursor: pointer;
	user-select: none;
}

.csw-details-summary:hover {
	background: #f1f5f9;
}

.csw-details-content {
	padding: 16px;
	border-top: 1px solid #e2e8f0;
	background: #ffffff;
}

/* Notice Box */
.csw-notice {
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 13px;
	margin-bottom: 16px;
}

.csw-notice-info {
	background: #f0fdfa;
	border: 1px solid #99f6e4;
	color: #0f766e;
}

/* Submit Wrap */
.csw-submit-wrap {
	margin-top: 20px;
}

.csw-button {
	padding: 10px 20px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	border: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}

.csw-button-primary {
	background: #109a8c;
	color: #ffffff;
}

.csw-button-primary:hover {
	background: #0d8377;
}

.csw-button-secondary {
	background: #f1f5f9;
	color: #475569;
	border: 1px solid #cbd5e1;
}

.csw-button-secondary:hover {
	background: #e2e8f0;
	color: #17345c;
}

/* Results Area */
.csw-results {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 2px solid #f1f5f9;
}

/* Cards Grid */
.csw-cards-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin-bottom: 20px;
}

@media (max-width: 640px) {
	.csw-cards-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}
}

.csw-card {
	padding: 16px;
	border-radius: 8px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
}

.csw-card-highlight {
	background: #f0fdfa;
	border-color: #99f6e4;
}

.csw-card-success,
.csw-card-savings {
	background: #f0fdf4;
	border-color: #bbf7d0;
}

.csw-card-label {
	font-size: 12px;
	font-weight: 600;
	color: #64748b;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.csw-card-value {
	font-size: 24px;
	font-weight: 700;
	color: #17345c;
	margin: 4px 0;
}

.csw-card-unit {
	font-size: 14px;
	font-weight: 500;
	color: #64748b;
}

.csw-card-sub {
	font-size: 12px;
	color: #64748b;
}

/* Progress Bar */
.csw-progress-bar-wrap {
	height: 6px;
	background: #e2e8f0;
	border-radius: 3px;
	overflow: hidden;
	margin-top: 8px;
}

.csw-progress-bar {
	height: 100%;
	background: #109a8c;
	border-radius: 3px;
	transition: width 0.3s ease;
}

/* SP 16 Status Box */
.csw-status-box {
	padding: 14px 18px;
	border-radius: 8px;
	margin-bottom: 20px;
}

.csw-status-success {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
}

.csw-status-warning {
	background: #fefce8;
	border: 1px solid #fef08a;
	color: #854d0e;
}

.csw-status-critical {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.csw-status-text {
	font-size: 14px;
	font-weight: 600;
}

.csw-status-disclaimer {
	font-size: 11px;
	margin-top: 4px;
	opacity: 0.85;
}

/* Visual Comparison Bar */
.csw-compare-box {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 16px;
	margin-bottom: 20px;
}

.csw-compare-title {
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 10px;
	color: #17345c;
}

.csw-compare-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
}

.csw-compare-label {
	width: 100px;
	font-size: 12px;
	color: #475569;
	font-weight: 500;
	flex-shrink: 0;
}

.csw-bar-container {
	flex: 1;
	height: 22px;
	background: #e2e8f0;
	border-radius: 4px;
	overflow: hidden;
}

.csw-bar-solid {
	height: 100%;
	background: #64748b;
	color: #ffffff;
	font-size: 11px;
	display: flex;
	align-items: center;
	padding-left: 8px;
	font-weight: 600;
	white-space: nowrap;
}

.csw-bar-intermittent {
	height: 100%;
	background: #109a8c;
	color: #ffffff;
	font-size: 11px;
	/* BUG-05: display:flex breaks text-overflow — use block + line-height instead */
	display: block;
	line-height: 22px;
	padding: 0 8px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: width 0.3s ease;
	box-sizing: border-box;
}

/* SVG Container */
.csw-svg-container {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 16px;
	margin-bottom: 20px;
}

.csw-svg-title {
	font-size: 13px;
	font-weight: 600;
	color: #17345c;
	margin-bottom: 12px;
}

.csw-svg-viewport {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 4px;
}

.csw-svg-viewport svg {
	width: 100%;
	height: auto;
	display: block;
}

@media (max-width: 640px) {
	.csw-svg-viewport svg {
		min-width: 540px;
	}
}

/* Main Export Buttons */
.csw-export-actions {
	display: flex;
	gap: 12px;
	margin-bottom: 20px;
}

@media (max-width: 640px) {
	.csw-export-actions {
		flex-direction: column;
		gap: 8px;
	}

	.csw-export-actions .csw-button {
		width: 100%;
		white-space: nowrap;
	}
}

/* Designation Grid */
.csw-designation-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin-bottom: 20px;
}

@media (max-width: 640px) {
	.csw-designation-grid {
		grid-template-columns: 1fr;
	}
}

.csw-designation-card {
	padding: 16px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
}

.csw-designation-card h4 {
	margin: 0 0 8px 0;
	font-size: 13px;
	color: #17345c;
}

.csw-designation-code {
	font-family: monospace;
	font-size: 16px;
	font-weight: 700;
	color: #109a8c;
	background: #ffffff;
	padding: 8px 12px;
	border-radius: 4px;
	border: 1px solid #cbd5e1;
	margin-bottom: 8px;
}

.csw-designation-breakdown {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 12px;
	color: #5e6d82;
	margin-bottom: 8px;
}

.csw-desig-row {
	display: flex;
	gap: 6px;
	align-items: baseline;
}

.csw-desig-key {
	color: #94a3b8;
	min-width: 120px;
	flex-shrink: 0;
}

.csw-desig-note {
	font-size: 11px;
	color: #94a3b8;
	font-style: italic;
	border-top: 1px solid #e2e8f0;
	padding-top: 6px;
	margin-top: 4px;
}

/* Coordinates Table Section */
.csw-coords-section {
	margin-top: 20px;
}

.csw-coords-print-title {
	font-size: 14px;
	font-weight: 600;
	color: #17345c;
	margin: 0 0 12px 0;
}

.csw-coords-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.csw-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	margin-bottom: 16px;
}

.csw-table th,
.csw-table td {
	padding: 8px 12px;
	text-align: left;
	border-bottom: 1px solid #e2e8f0;
	white-space: nowrap;
}

.csw-table th {
	background: #f1f5f9;
	font-weight: 600;
	color: #475569;
}

.csw-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
}

.csw-badge-weld {
	background: #dcfce7;
	color: #15803d;
}

.csw-badge-off {
	background: #f1f5f9;
	color: #94a3b8;
}

/* Utility Hidden */
.csw-hidden {
	display: none !important;
}

/* Print Stylesheet for clean marking cards */
@media print {
	body * {
		visibility: hidden !important;
	}

	header, footer, nav, .site-header, .site-footer, .sidebar,
	.csw-level-toggle, .csw-tabs, .csw-form, .csw-export-actions, .csw-button {
		display: none !important;
	}

	.csw-intermittent-weld-card,
	.csw-intermittent-weld-card * {
		visibility: visible !important;
	}

	.csw-intermittent-weld-card {
		position: absolute !important;
		left: 0 !important;
		top: 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		box-shadow: none !important;
		border: none !important;
		padding: 0 !important;
		margin: 0 !important;
		background: #ffffff !important;
	}

	/* Show print header */
	.csw-print-header {
		display: block !important;
		border-bottom: 2px solid #17345c;
		padding-bottom: 8px;
		margin-bottom: 16px;
	}

	.csw-print-title {
		font-size: 16pt !important;
		font-weight: 700 !important;
		color: #17345c !important;
		margin: 0 0 4px 0 !important;
	}

	.csw-print-meta {
		font-size: 9pt !important;
		color: #64748b !important;
	}

	/* Forces printable visibility on coordinates table section */
	.csw-coords-section,
	.csw-coords-wrap {
		display: block !important;
		visibility: visible !important;
		margin-top: 16px !important;
	}

	.csw-table {
		display: table !important;
		width: 100% !important;
		border-collapse: collapse !important;
		table-layout: fixed !important;
		margin-top: 8px !important;
	}

	.csw-table thead {
		display: table-header-group !important;
	}

	.csw-table tbody {
		display: table-row-group !important;
	}

	.csw-table tr {
		display: table-row !important;
		page-break-inside: avoid !important;
	}

	.csw-table th,
	.csw-table td {
		display: table-cell !important;
		padding: 6px 10px !important;
		border: 1px solid #94a3b8 !important;
		font-size: 10pt !important;
		text-align: left !important;
		vertical-align: middle !important;
		background: transparent !important;
	}

	.csw-table th {
		background: #f1f5f9 !important;
		font-weight: 700 !important;
	}

	.csw-svg-container {
		page-break-inside: avoid !important;
		border: 1px solid #cbd5e1 !important;
		margin-bottom: 16px !important;
	}

	.csw-cards-grid {
		display: flex !important;
		gap: 12px !important;
		margin-bottom: 16px !important;
	}

	.csw-card {
		flex: 1 !important;
		border: 1px solid #cbd5e1 !important;
		background: #ffffff !important;
		padding: 10px !important;
	}

	.csw-card-value {
		font-size: 16pt !important;
	}

	.csw-badge {
		border: 1px solid #cbd5e1 !important;
	}
}
