/**
 * DIY Daily - Simulator v2 styles [CATALOG].
 *
 * IC Catalog modal + grouped Examples dropdown styling, in the v1
 * dark-chrome language: #232D36 panels, cream canvas, #D9661F orange
 * accents, Space Grotesk / Inter / JetBrains Mono, 10px radii.
 * Loaded after simulator.css; scoped so it cannot disturb v1 rules.
 */

/* ================= Grouped Examples dropdown ================= */

.dd-sim-app #sim-examples {
	max-width: 220px;
}

.dd-sim-app #sim-examples optgroup {
	font-family: 'Space Grotesk', 'Inter', sans-serif;
	font-style: normal;
	font-weight: 600;
	color: var(--sim-accent, #d9661f);
	background: #232d36;
}

.dd-sim-app #sim-examples optgroup option {
	font-family: 'Inter', system-ui, sans-serif;
	font-weight: 400;
	color: var(--sim-text, #e8e2d8);
	background: #2b3742;
}

/* ================= IC Catalog: toolbar button ================= */

.dd-sim-app #sim-ic-catalog-btn {
	border-color: var(--sim-accent, #d9661f);
}

.dd-sim-app #sim-ic-catalog-btn:hover {
	background: rgba(217, 102, 31, 0.16);
	border-color: var(--sim-accent-hover, #f07a2e);
}

/* ================= IC Catalog: modal shell ================= */

.sim-v2-modal {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(12, 17, 21, 0.65);
	z-index: 110;
	font-family: 'Inter', system-ui, sans-serif;
	color: #e8e2d8;
}

.sim-v2-modal[hidden] {
	display: none;
}

.sim-v2-catalog-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 880px;
	max-height: 85vh;
	background: #2b3742;
	border: 1px solid #3a4753;
	border-radius: 10px;
	padding: 18px 20px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.sim-v2-catalog-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.sim-v2-catalog-head .sim-modal-title {
	margin: 0;
	font-family: 'Space Grotesk', 'Inter', sans-serif;
	font-size: 18px;
	color: #e8e2d8;
}

.sim-v2-icon-btn {
	padding: 4px 10px;
	font-size: 14px;
	line-height: 1;
}

/* ================= IC Catalog: controls ================= */

.sim-v2-catalog-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}

.sim-v2-search {
	flex: 1 1 220px;
	min-width: 160px;
	padding: 7px 10px;
	font: inherit;
	font-size: 13px;
	color: #e8e2d8;
	background: #1f2830;
	border: 1px solid #3a4753;
	border-radius: 8px;
}

.sim-v2-search::placeholder {
	color: #6b7a88;
}

.sim-v2-search:focus-visible,
.sim-v2-category:focus-visible,
.sim-v2-chip:focus-visible,
.sim-v2-place:focus-visible {
	outline: 2px solid #d9661f;
	outline-offset: 2px;
}

.sim-v2-category {
	flex: 0 1 auto;
	max-width: 200px;
}

.sim-v2-chips {
	display: inline-flex;
	gap: 6px;
}

.sim-v2-chip {
	padding: 6px 12px;
	font: inherit;
	font-size: 12px;
	font-weight: 500;
	color: #9aa7b2;
	background: #1f2830;
	border: 1px solid #3a4753;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sim-v2-chip:hover {
	background: #33414e;
	color: #e8e2d8;
}

.sim-v2-chip[aria-pressed="true"] {
	color: #ffffff;
	background: #d9661f;
	border-color: #d9661f;
}

.sim-v2-count {
	margin: 0 0 8px;
	font-size: 12px;
	color: #9aa7b2;
	font-variant-numeric: tabular-nums;
}

/* ================= IC Catalog: results table ================= */

.sim-v2-table-wrap {
	flex: 1 1 auto;
	min-height: 120px;
	overflow-y: auto;
	border: 1px solid #3a4753;
	border-radius: 8px;
	background: #232d36;
}

.sim-v2-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 12.5px;
}

.sim-v2-table thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	padding: 8px 10px;
	font-family: 'Space Grotesk', 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-align: left;
	color: #9aa7b2;
	background: #232d36;
	border-bottom: 1px solid #3a4753;
}

.sim-v2-table tbody td {
	padding: 7px 10px;
	vertical-align: top;
	border-bottom: 1px solid rgba(58, 71, 83, 0.5);
	color: #e8e2d8;
}

.sim-v2-table tbody tr:hover {
	background: rgba(217, 102, 31, 0.07);
}

.sim-v2-part {
	font-family: 'JetBrains Mono', monospace;
	font-weight: 600;
	color: #f07a2e;
	white-space: nowrap;
}

.sim-v2-desc {
	color: #9aa7b2;
	min-width: 220px;
}

.sim-v2-pins {
	font-family: 'JetBrains Mono', monospace;
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.sim-v2-empty {
	padding: 24px 10px;
	text-align: center;
	color: #6b7a88;
}

.sim-v2-place {
	padding: 4px 10px;
	font-size: 12px;
	white-space: nowrap;
}

.sim-v2-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ================= Badges ================= */

.sim-v2-badge {
	display: inline-block;
	padding: 2px 8px;
	font-size: 10.5px;
	font-weight: 600;
	line-height: 1.5;
	border: 1px solid;
	border-radius: 999px;
	white-space: nowrap;
	background: rgba(0, 0, 0, 0.25);
}

.sim-v2-badge-prog {
	color: #f0a35e;
	border-color: #d9661f;
}

.sim-v2-badge-fixed {
	color: #9aa7b2;
	border-color: #4a5a68;
}

/* Category color coding (kept in the warm, low-saturation v1 palette). */
.cat-logic-74xx              { color: #f07a2e; border-color: #d9661f; }
.cat-cmos-40xx               { color: #3fbfa8; border-color: #0e7c6b; }
.cat-timers                  { color: #e3c26b; border-color: #b08d2f; }
.cat-op-amps-comparators     { color: #7db4d1; border-color: #3d7ea6; }
.cat-voltage-regulators      { color: #8fce7d; border-color: #4a8f3c; }
.cat-motor-load-drivers      { color: #e08a6d; border-color: #b3552e; }
.cat-adc-dac                 { color: #b3a6d9; border-color: #7a6fa0; }
.cat-sensors-ic              { color: #a4c9a9; border-color: #6b8f71; }
.cat-memory-rtc              { color: #8fb3c7; border-color: #5b7a8c; }
.cat-audio                   { color: #cf9eb9; border-color: #96627e; }
.cat-programmable-ics        { color: #f5c86e; border-color: #d9901f; }
.cat-interface-ics           { color: #79c7c9; border-color: #4f8a8b; }
.cat-discrete-transistors    { color: #c9a893; border-color: #8c6d5b; }
.cat-power-transistors       { color: #d98d6e; border-color: #a0522d; }

/* ================= Toast ================= */

.sim-v2-toast {
	position: fixed;
	left: 50%;
	bottom: 56px;
	transform: translateX(-50%) translateY(12px);
	max-width: min(480px, 90vw);
	padding: 9px 16px;
	font-size: 13px;
	color: #e8e2d8;
	background: #2b3742;
	border: 1px solid #d9661f;
	border-radius: 10px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 130;
	pointer-events: none;
}

.sim-v2-toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ================= Responsive ================= */

@media (max-width: 1024px) {
	.sim-v2-catalog-card {
		max-width: 100%;
		max-height: 90vh;
	}

	.sim-v2-desc {
		min-width: 160px;
	}
}

@media (max-width: 640px) {
	.sim-v2-modal {
		padding: 10px;
	}

	.sim-v2-catalog-card {
		padding: 14px;
		max-height: 94vh;
	}

	.sim-v2-catalog-controls {
		flex-direction: column;
		align-items: stretch;
	}

	.sim-v2-category {
		max-width: none;
	}

	.sim-v2-chips {
		justify-content: center;
	}

	/* Keep the table usable on small screens: hide the description column. */
	.sim-v2-table thead th:nth-child(3),
	.sim-v2-table tbody td:nth-child(3) {
		display: none;
	}

	.sim-v2-table {
		font-size: 12px;
	}
}
