pcb-retrace/docs/tool-style.css

342 lines
13 KiB
CSS

/*
* Copyright (c) 2025-2026 Taras Greben
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial-pcb-retrace
* See LICENSE file for details.
*/
/* tool-style.css - Shared styles for Component Editors */
@import url('common.css');
:root {
--accent: #2563eb;
--text: #333;
--bg: #f4f4f9;
--card: #ffffff;
--border: #ccc;
--focus-ring: rgba(37, 99, 235, 0.2);
--resistor-body: #82cae0;
--resistor-shadow: #5ea8bd;
}
/* --- CORE LAYOUT --- */
html { font-size: 16px; box-sizing: border-box; height: 100%; overflow: hidden; }
*, *:before, *:after { box-sizing: inherit; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--bg);
color: var(--text);
margin: 0; padding: 0;
height: 100%; width: 100%;
display: flex; justify-content: center; align-items: center;
}
.container {
background: var(--card); padding: 1.5rem; border-radius: 1rem;
box-shadow: 0 0.5rem 2rem rgba(0,0,0,0.05);
width: 95%; max-width: 1000px; height: 95%; max-height: 95%;
margin: 1rem; display: flex; flex-direction: column;
overflow-y: auto; scrollbar-width: thin; gap: 0.5rem;
position: relative;
}
h1 { margin: 0; font-size: 1.5rem; text-align: center; flex-shrink: 0; }
/* --- TOP SECTION --- */
.top-section {
display: flex; gap: 1rem; width: 100%;
align-items: stretch; justify-content: center;
flex-shrink: 0;
}
/* Spyglass */
.col-spyglass {
flex: 0 0 auto;
display: none;
flex-direction: row;
gap: 0.5rem;
}
.col-spyglass.active { display: flex; }
.spyglass-wrapper {
width: 200px; height: 200px;
border-radius: 0.5rem; border: 1px solid var(--border);
padding: 0.5rem; position: relative; background: rgba(0,0,0,0.02);
flex-shrink: 0;
}
.spyglass-canvas {
width: 100%; height: 100%; object-fit: contain;
cursor: crosshair; display: block; background: #fff; border-radius: 0.25rem;
}
.spyglass-hint { display: none; }
.zoom-badge {
position: absolute; bottom: 0.5rem; right: 0.5rem;
background: rgba(0,0,0,0.6); color: white;
font-size: 0.7rem; padding: 2px 6px;
border-radius: 4px; pointer-events: none;
}
/* Thumbnails */
#view-selector {
display: flex; flex-direction: column; gap: 4px;
width: 72px; height: 200px;
overflow-y: auto; overflow-x: hidden;
padding-bottom: 0; margin-top: 0;
border-left: 1px solid var(--border); padding-left: 4px;
}
.view-thumb { width: 60px; height: 60px; border: 2px solid #ccc; border-radius: 4px; cursor: pointer; overflow: hidden; position: relative; flex-shrink: 0; }
.view-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus-ring); }
.view-thumb canvas { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.view-thumb span { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.6); color: white; font-size: 8px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-thumb .promote-btn {
display: flex; align-items: center; justify-content: center;
position: absolute; top: 0; right: 0;
background: #f59e0b; color: white; border: none;
width: 18px; height: 18px; font-size: 12px; line-height: 1;
cursor: pointer; z-index: 10;
}
/* Controls */
.col-controls {
flex: 1; display: flex; flex-direction: column;
justify-content: center; gap: 1rem;
max-width: 600px; margin: 0 auto; width: 100%;
}
.top-section:has(.col-spyglass.active) .col-controls { margin: 0; }
/* INPUTS */
.reverse-input-group { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.input-row { display: flex; gap: 0.5rem; width: 100%; }
.inp-nominal { padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 0.5rem; font-size: 1rem; flex: 1; min-width: 0; }
.btn-action { padding: 0.6rem 1rem; background: var(--accent); color: white; border: none; border-radius: 0.5rem; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.input-wrapper { position: relative; width: 100%; }
.input-wrapper input { padding-right: 2.5rem !important; }
.unit { position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 0.9rem; pointer-events: none; }
label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; opacity: 0.8; }
input {
width: 100%; padding: 0.8rem;
border: 1px solid var(--border);
border-radius: 0.5rem;
font-size: 1.1rem; font-weight: 600;
transition: all 0.2s;
background: #fff; color: inherit; box-sizing: border-box;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 0.5rem; width: 100%; }
.btn-mode { padding: 0.6rem; border: 1px solid #e0e0e0; background: #fff; cursor: pointer; border-radius: 0.5rem; font-weight: 600; font-size: 0.9rem; color: #555; text-align: center; white-space: nowrap; }
.btn-mode.active { background: var(--accent); color: white; border-color: var(--accent); }
/* --- COMPONENT GRAPHIC --- */
.resistor-wrapper-outer {
position: relative; width: 100%; height: 9rem; flex-shrink: 0;
display: flex; justify-content: center; align-items: center; z-index: 0; margin: 0;
}
.resistor-wrapper-outer::before {
content: ''; position: absolute; top: 50%; left: 0; width: 100%; height: 0.6rem;
transform: translateY(-50%); background: #9da5b4;
background-image: linear-gradient(to bottom, #d0d6e0, #8a92a0, #d0d6e0); z-index: -1;
}
.resistor-dumbbell-shape {
display: inline-flex; align-items: center; justify-content: center; position: relative; z-index: 10;
transform: scale(0.9); transform-origin: center;
}
.resistor-dumbbell-shape::before, .resistor-dumbbell-shape::after {
content: ''; display: block; width: 3.5rem; height: 8rem;
background-color: var(--resistor-body); border-radius: 1.5rem; flex-shrink: 0;
background-image: linear-gradient(to right, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 20%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.1) 100%), linear-gradient(to bottom, rgba(255,255,255,0.5) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.3) 100%);
box-shadow: inset -2px 0 5px rgba(0,0,0,0.1), 0 0.8rem 1.2rem rgba(0,0,0,0.15); border: 1px solid var(--resistor-shadow);
}
.resistor-dumbbell-shape::before { border-top-right-radius: 0.6rem; border-bottom-right-radius: 0.6rem; margin-right: -0.4rem; }
.resistor-dumbbell-shape::after { border-top-left-radius: 0.6rem; border-bottom-left-radius: 0.6rem; margin-left: -0.4rem; }
.bands-container {
display: inline-flex; align-items: stretch; justify-content: center; height: 6rem;
background-color: var(--resistor-body);
box-shadow: inset 0 0.8rem 0.8rem -0.2rem rgba(0,0,0,0.15), inset 0 -0.8rem 0.8rem -0.2rem rgba(0,0,0,0.2);
padding: 0 0.5rem; gap: 0.5rem; z-index: 5;
}
/* --- COLOR CLASSES (Shared) --- */
.c-bk { background-color: #000; color: #fff !important; }
.c-bn { background-color: #5d4037; color: #fff !important; }
.c-rd { background-color: #d32f2f; color: #fff !important; }
.c-og { background-color: #f57c00; color: #000 !important; }
.c-ye { background-color: #ffeb3b; color: #000 !important; }
.c-gn { background-color: #2e7d32; color: #fff !important; }
.c-bu { background-color: #1565c0; color: #fff !important; }
.c-vt { background-color: #7b1fa2; color: #fff !important; }
.c-gy { background-color: #9e9e9e; color: #000 !important; }
.c-wh { background-color: #fff; border: 1px solid #ddd; color: #000 !important; }
/* Metallic (Horizontal Gradient for Dropdowns) */
.c-gd { background: linear-gradient(to right, #fbf0b5 0%, #c49a00 20%, #fbf0b5 40%, #b68f00 60%, #fbf0b5 80%); color: #000 !important; }
.c-sv { background: linear-gradient(to right, #fff 0%, #9e9e9e 20%, #fff 40%, #808080 60%, #e8e8e8 80%); color: #000 !important; }
/* Metallic Overrides (Vertical/Top Gradient for Component Bands) */
.custom-select__trigger.c-gd { background-image: linear-gradient(to top, #fbf0b5 0%, #c49a00 20%, #fbf0b5 40%, #b68f00 60%, #fbf0b5 80%) !important; }
.custom-select__trigger.c-sv { background-image: linear-gradient(to top, #ffffff 0%, #9e9e9e 20%, #ffffff 40%, #808080 60%, #e8e8e8 80%) !important; }
/* Color Text Contrast Helper */
.c-ye span, .c-wh span, .c-gd span, .c-sv span, .c-og span, .c-gy span { color: #222 !important; text-shadow: 0 1px 1px rgba(255,255,255,0.5); }
/* --- DROPDOWN --- */
.custom-select-wrapper { position: relative; width: 2.8rem; height: 100%; }
.custom-select__trigger {
position: relative; display: flex; align-items: center; justify-content: center; height: 100%;
cursor: pointer; transition: transform 0.1s;
background-image: linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 40%, rgba(0,0,0,0.2) 100%);
box-shadow: inset 1px 0 2px rgba(0,0,0,0.2), inset -1px 0 2px rgba(0,0,0,0.2);
}
.custom-select__trigger:active { transform: scale(0.95); }
.custom-select__trigger span {
writing-mode: vertical-lr; text-orientation: mixed; transform: rotate(180deg); color: #fff;
font-weight: 700; font-size: 0.9rem; text-shadow: 0 1px 2px rgba(0,0,0,0.5); white-space: nowrap; pointer-events: none;
}
#global-dropdown {
position: fixed; top: 0; left: 0; width: 12rem; background: #fff;
border: 1px solid #ccc; border-radius: 0.5rem;
box-shadow: 0 10px 40px rgba(0,0,0,0.4);
z-index: 99999; display: none; flex-direction: column;
max-height: 90vh; overflow-y: auto;
}
.custom-option { padding: 0.8rem 1rem; font-size: 1rem; font-weight: 600; cursor: pointer; text-align: center; border-bottom: 1px solid rgba(0,0,0,0.05); }
.custom-option:hover { filter: brightness(0.95); }
#global-dropdown.condensed .custom-option { padding: 0.5rem 0.5rem; font-size: 0.9rem; }
#global-dropdown.super-condensed .custom-option { padding: 0.25rem 0.2rem; font-size: 0.85rem; }
/* --- RESULTS --- */
.result-box { width: 100%; display: flex; flex-direction: column; gap: 0.5rem; flex-shrink: 0; padding-bottom: 0.5rem; }
.result-row { display: flex; align-items: center; padding: 0.8rem; background: #fff; border: 1px solid #eee; border-radius: 0.8rem; box-shadow: 0 2px 5px rgba(0,0,0,0.03); gap: 1rem; }
.best-match { background: #f8fbff; border: 1px solid #cce5ff; border-left: 0.4rem solid var(--accent); }
.val-group { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.val-text { font-size: 1.4rem; font-weight: 800; color: #222; }
.meta-text { color: #666; font-size: 0.9rem; font-weight: 500;}
.match-badge { background: #e0f2fe; color: var(--accent); padding: 0.4rem 1rem; border-radius: 2rem; font-size: 0.8rem; font-weight: 700; white-space: nowrap;}
.badge-success { background: #dcfce7; color: #166534; padding: 0.4rem 1rem; border-radius: 2rem; font-size: 0.8rem; font-weight: 700; white-space: nowrap;}
.direction-icon { width: 2.2rem; height: 2.2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #eee; color: #666; }
.direction-icon svg { width: 1rem; height: 1rem; fill: currentColor; }
.best-match .direction-icon { background: var(--accent); color: #fff; }
.direction-icon.reverse { background: #f59e0b; color: #fff; }
.btn-select { background: #059669; color: white; border: none; padding: 0.5rem 1rem; border-radius: 0.4rem; cursor: pointer; font-weight: 700; white-space: nowrap; margin-left: auto; }
.btn-select:hover { background: #047857; }
@media (max-width: 600px) {
/* 1. Global Setup */
html, body {
height: 100%;
overflow: hidden;
margin: 0; padding: 0;
}
/* 2. Container: Fill the parent iframe completely */
.container {
margin: 0;
width: 100%;
height: 100%;
border-radius: 0; /* Parent handles radius */
box-shadow: none; /* Parent handles shadow */
border: none;
padding: 0.25rem;
gap: 0.25rem;
overflow-y: auto;
}
/* 3. Header: Hidden inside tool */
h1 { display: none; }
/* 4. Top Section */
.top-section {
flex-direction: column;
align-items: center;
gap: 0.25rem;
flex-shrink: 0;
}
.col-controls {
width: 100%;
gap: 0.25rem;
}
/* 5. Inputs & Buttons */
input {
padding: 0 0.4rem;
font-size: 0.9rem;
height: 2rem;
}
.unit { font-size: 0.7rem; right: 0.25rem; }
.btn-action, .btn-select {
padding: 0 0.5rem;
font-size: 0.8rem;
height: 2rem;
line-height: 1;
white-space: nowrap;
}
/* BAND BUTTONS: Single Line Forced */
.controls-grid {
display: flex !important;
flex-direction: row;
width: 100%;
gap: 0.2rem;
}
.btn-mode {
flex: 1;
padding: 0 !important;
font-size: 0.75rem;
height: 2rem;
line-height: 2rem;
white-space: nowrap;
overflow: hidden;
}
.input-grid { gap: 0.25rem; }
.form-group { gap: 0; margin-bottom: 0; }
label { font-size: 0.7rem; margin: 0; line-height: 1.2; }
/* 6. Graphic */
.resistor-wrapper-outer {
height: 5rem;
min-height: 5rem;
margin: 0.125rem 0;
overflow: visible;
display: flex;
align-items: center;
justify-content: center;
}
.resistor-dumbbell-shape {
transform: scale(0.65);
transform-origin: center center;
width: 100%;
display: inline-flex;
}
.bands-container { gap: 0.125rem; }
/* 7. Results */
.result-row {
padding: 0.25rem 0.5rem;
gap: 0.5rem;
min-height: 2.5rem;
}
.val-text { font-size: 1.1rem; }
.meta-text { font-size: 0.75rem; }
/* 8. Dropdown Fix */
.col-controls .custom-select-wrapper {
height: 2rem;
}
.bands-container .custom-select-wrapper {
height: 100%;
}
.custom-select__trigger span { font-size: 0.75rem; }
}