/* psc_bom_editor.css — legacy PO Wizard Step 4 (component BOM editor) styling.
 *
 * Extracted VERBATIM from the <style> block of
 *   apps/purchasing/templates/purchasing/po_step4_materials.html
 * so the card renders identically inside a PSC popup. Only the page-level
 * step navigation (.step-nav / .btn-prev / .btn-next) is intentionally left
 * out — a PSC card has no wizard step bar. */

/* Item cards */
.item-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; margin-bottom: 1rem; overflow: hidden; }
.item-header { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1rem; background: #1a1a2e; color: #fff; cursor: pointer; user-select: none; }
.item-header:hover { background: #2a2a3e; }
.item-header h3 { margin: 0; font-size: 0.9rem; font-weight: 600; }
.item-header .item-badges { display: flex; gap: 0.4rem; align-items: center; }
.item-header .badge { padding: 0.15rem 0.5rem; border-radius: 10px; font-size: 0.72rem; }
.badge-styles { background: rgba(255,255,255,0.2); }
.badge-saved { background: #4caf50; color: #fff; }
.badge-unsaved { background: #ff9800; color: #fff; }
.item-body { padding: 0; display: none; }
.item-body.open { display: block; }

/* Material tabs (per item) */
.mc-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 0; overflow-x: auto; background: #fafafa; }
.mc-tab { background: none; border: none; padding: 0.5rem 0.8rem; font-size: 0.8rem; cursor: pointer; color: #666; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 500; transition: color 0.15s, border-color 0.15s; }
.mc-tab:hover { color: #333; }
.mc-tab.active { font-weight: 700; }
.mc-tab .mc-tab-badge { font-size: 0.6rem; background: #eee; color: #666; padding: 1px 5px; border-radius: 8px; margin-left: 3px; }
.mc-tab[data-key="fabrics"].active { color: #b71c1c; border-bottom-color: #b71c1c; }
.mc-tab[data-key="fabrics"].active .mc-tab-badge { background: #ffcdd2; color: #b71c1c; }
.mc-tab[data-key="trims"].active { color: #4a148c; border-bottom-color: #4a148c; }
.mc-tab[data-key="trims"].active .mc-tab-badge { background: #e1bee7; color: #4a148c; }
.mc-tab[data-key="packaging"].active { color: #e65100; border-bottom-color: #e65100; }
.mc-tab[data-key="packaging"].active .mc-tab-badge { background: #ffe0b2; color: #e65100; }
.mc-tab[data-key="accessories"].active { color: #00695c; border-bottom-color: #00695c; }
.mc-tab[data-key="accessories"].active .mc-tab-badge { background: #b2dfdb; color: #00695c; }

/* Panels */
.mc-panel { padding: 0.6rem 0.8rem; display: none; }
.mc-panel.active { display: block; }
.mc-empty-state { padding: 2rem; text-align: center; color: #999; font-size: 0.85rem; font-style: italic; background: #fafafa; border-radius: 6px; border: 1px dashed #ddd; margin: 0.5rem 0; }

/* Component cards */
.mc-comp-card { border: 1px solid #e0e0e0; border-radius: 6px; margin-bottom: 0.6rem; overflow: hidden; }
.mc-comp-header { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.7rem; background: #f5f5f5; border-bottom: 1px solid #e0e0e0; font-size: 0.8rem; font-weight: 600; color: #333; }
.mc-comp-header .mc-comp-icon { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mc-comp-body { padding: 0.5rem 0.7rem; }

/* Fabric selector row */
.mc-fab-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid #f0f0f0; font-size: 0.78rem; }
.mc-fab-row:last-child { border-bottom: none; }
.mc-fab-cat { font-weight: 600; color: #b71c1c; min-width: 80px; font-size: 0.72rem; text-transform: uppercase; }
.mc-fab-select { flex: 1; padding: 0.25rem 0.35rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.78rem; background: #fff; }
.mc-fab-cost { font-family: 'Courier New', monospace; font-size: 0.72rem; color: #666; min-width: 70px; text-align: right; }
.mc-fab-primary { cursor: pointer; font-size: 1.1rem; color: #ccc; background: none; border: none; padding: 2px 4px; }
.mc-fab-primary.is-primary { color: #f9a825; }
.mc-fab-supplier { width: 120px; padding: 0.2rem 0.3rem; border: 1px solid #ddd; border-radius: 3px; font-size: 0.72rem; }

/* Checkbox grid (trims, packaging, accessories) */
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.15rem 0.3rem; max-height: 300px; overflow-y: auto; padding: 0.1rem 0; }
.mc-item { display: flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.4rem; border-radius: 3px; font-size: 0.78rem; cursor: pointer; }
.mc-item:hover { background: #f5f5f5; }
.mc-item input[type="checkbox"] { flex-shrink: 0; width: auto; margin: 0; }
.mc-item .mc-name { font-weight: 500; }
.mc-item .mc-cost { margin-left: auto; font-family: 'Courier New', monospace; color: #666; font-size: 0.7rem; flex-shrink: 0; }
.mc-item.mc-bom-item { background: #e8f5e9; border: 1px solid #c8e6c9; }
.mc-bom-badge { font-size: 0.6rem; background: #a5d6a7; color: #1b5e20; padding: 1px 5px; border-radius: 4px; margin-left: 2px; }
.mc-item .mc-supplier-dd { width: 100px; padding: 0.15rem 0.2rem; border: 1px solid #ddd; border-radius: 3px; font-size: 0.68rem; margin-left: auto; }
.mc-item.search-hidden { display: none; }

/* Toolbar (search + action buttons) */
.mc-toolbar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
.mc-search { flex: 1; min-width: 150px; padding: 0.3rem 0.4rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.8rem; width: auto; margin: 0; }
.mc-act-btns { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.mc-act-btn { background: #e8eaf6; border: 1px solid #9fa8da; color: #283593; padding: 0.2rem 0.5rem; border-radius: 3px; cursor: pointer; font-size: 0.75rem; white-space: nowrap; }
.mc-act-btn:hover { background: #c5cae9; }
.mc-act-btn.show-sel-active { background: #fff3e0; border-color: #ffb74d; color: #e65100; font-weight: 600; }

/* Actions footer */
.mc-actions { display: flex; gap: 8px; padding: 0.6rem 0.8rem; border-top: 1px solid #e0e0e0; background: #fafafa; align-items: center; }
.mc-btn-save { padding: 6px 20px; font-size: 0.82rem; border-radius: 4px; cursor: pointer; border: 1px solid #2e7d32; background: #4caf50; color: #fff; font-weight: 600; }
.mc-btn-save:hover { background: #388e3c; }
.mc-btn-copy { padding: 4px 12px; font-size: 0.78rem; border-radius: 3px; cursor: pointer; border: 1px solid #81c784; background: #e8f5e9; color: #2e7d32; font-weight: 500; }
.mc-btn-copy:hover { background: #c8e6c9; }
.mc-btn-reset { padding: 4px 12px; font-size: 0.78rem; border-radius: 3px; cursor: pointer; border: 1px solid #e65100; background: #fff3e0; color: #e65100; font-weight: 500; }
.mc-btn-reset:hover { background: #ffe0b2; }
.mc-save-status { font-size: 0.78rem; color: #999; align-self: center; }
.mc-save-status.saved { color: #2e7d32; font-weight: 600; }

/* Copy-to popover */
.mc-copy-popover { position: fixed; z-index: 9999; background: #fff; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,0.18); width: 270px; font-size: 0.82rem; }
.mc-copy-popover-header { padding: 0.5rem 0.75rem; background: #f5f5f5; border-bottom: 1px solid #e0e0e0; font-weight: 600; display: flex; justify-content: space-between; align-items: center; border-radius: 8px 8px 0 0; }
.mc-copy-popover-header button { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #999; line-height: 1; }
.mc-copy-popover-list { padding: 0.4rem 0.75rem; max-height: 200px; overflow-y: auto; }
.mc-copy-popover-list label { display: flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0; cursor: pointer; }
.mc-copy-popover-footer { padding: 0.4rem 0.75rem; border-top: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; border-radius: 0 0 8px 8px; }
.mc-copy-status { font-size: 0.75rem; }
.mc-copy-status.done { color: #2e7d32; font-weight: 600; }
.mc-copy-status.error { color: #ba2121; }

/* Copy to styles button (inside style pills bar) */
.mc-btn-copy-style { background: none; border: 1px solid #90caf9; color: #1565c0; padding: 0.3rem 0.7rem; font-size: 0.72rem; cursor: pointer; border-radius: 4px; margin-left: auto; align-self: center; white-space: nowrap; font-weight: 600; }
.mc-btn-copy-style:hover { background: #e3f2fd; }

/* Style pills */
.mc-style-pills { display: flex; gap: 0; padding: 0; border-bottom: 2px solid #ddd; background: #f5f5f5; }
.mc-style-pill { background: none; border: none; padding: 0.45rem 0.9rem; font-size: 0.78rem; cursor: pointer; color: #666; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.15s; white-space: nowrap; }
.mc-style-pill:hover { color: #333; background: rgba(0,0,0,0.03); }
.mc-style-pill.active { color: #1565c0; border-bottom-color: #1565c0; font-weight: 700; background: #e3f2fd; }
.mc-style-pill .pill-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; }
.mc-style-pill.active .pill-dot { background: #1565c0; }

/* All Styles template table */
.mc-template-toolbar { padding: 0.5rem 0.8rem; display: flex; gap: 0.5rem; align-items: center; }
.mc-template-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8rem; }
.mc-template-table thead th { background: #f5f5f5; padding: 0.4rem 0.5rem; font-size: 0.72rem; font-weight: 600; color: #666; text-transform: uppercase; border-bottom: 2px solid #ddd; text-align: left; white-space: nowrap; }
.mc-template-table tbody td { padding: 0.3rem 0.4rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.mc-template-table tbody tr:hover td { background: #fafafa; }
.mc-tpl-input { width: 100%; padding: 0.25rem 0.35rem; border: 1px solid #ddd; border-radius: 3px; font-size: 0.78rem; background: #fff; box-sizing: border-box; }
.mc-tpl-input:focus { border-color: #1565c0; outline: none; box-shadow: 0 0 0 2px rgba(21,101,192,0.1); }
.mc-tpl-select { width: 100%; padding: 0.25rem 0.35rem; border: 1px solid #ddd; border-radius: 3px; font-size: 0.78rem; background: #fff; box-sizing: border-box; }
.mc-tpl-select:focus { border-color: #1565c0; outline: none; }
.mc-tpl-del { background: none; border: none; color: #ccc; cursor: pointer; font-size: 1rem; padding: 2px 6px; border-radius: 3px; }
.mc-tpl-del:hover { color: #ba2121; background: #ffebee; }

/* Treatment selector row (inside fabric panel) */
.mc-treat-row { display: flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0 0.3rem 90px; font-size: 0.72rem; }
.mc-treat-label { color: #e65100; font-weight: 600; font-size: 0.68rem; text-transform: uppercase; min-width: 70px; }
.mc-treat-select { padding: 0.2rem 0.3rem; border: 1px solid #ddd; border-radius: 3px; font-size: 0.72rem; background: #fff; min-width: 120px; }
.mc-treat-add { background: #fff3e0; border: 1px solid #ffb74d; color: #e65100; padding: 0.15rem 0.4rem; border-radius: 3px; cursor: pointer; font-size: 0.68rem; font-weight: 600; white-space: nowrap; }
.mc-treat-add:hover { background: #ffe0b2; }
.mc-treat-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.mc-treat-tag { display: inline-flex; align-items: center; gap: 0.2rem; background: #fff3e0; color: #e65100; padding: 0.1rem 0.4rem; border-radius: 10px; font-size: 0.68rem; font-weight: 500; border: 1px solid #ffcc80; }
.mc-treat-remove { background: none; border: none; color: #e65100; cursor: pointer; font-size: 0.8rem; padding: 0 2px; line-height: 1; font-weight: 700; }
.mc-treat-remove:hover { color: #bf360c; }
.mc-treat-copy { background: none; border: 1px solid #90caf9; color: #1565c0; cursor: pointer; font-size: 0.6rem; padding: 0 4px; line-height: 1.2; font-weight: 600; border-radius: 3px; margin-left: 2px; white-space: nowrap; }
.mc-treat-copy:hover { background: #e3f2fd; }
.mc-treat-copy.copied { background: #e8f5e9; border-color: #81c784; color: #2e7d32; }
