/* UVTools2 feature styles. Shared tokens and components live in core.css. */

#pane-tools .container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  max-width: 1024px;
  width: 100%;
  padding: 40px;
}

#pane-tools .tool-view {
  display: none;
}

#pane-tools .tool-view.active {
  display: block;
}

#pane-tools .tab-description {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- Sections & form controls ---------- */
#pane-tools .section {
  margin-bottom: 25px;
}

#pane-tools label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

#pane-tools input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s;
}

#pane-tools input[type="text"]:focus {
  border-color: var(--accent);
}

/* ---------- Custom file input ---------- */
#pane-tools .file-input-wrapper {
  position: relative;
  width: 100%;
}

#pane-tools input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#pane-tools .file-input-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.15s;
}

#pane-tools .file-input-label:hover {
  border-color: var(--accent);
}

#pane-tools input[type="file"]:focus-visible + .file-input-label {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

#pane-tools .file-input-label.has-file {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, var(--surface));
}

#pane-tools .file-name {
  color: var(--text-secondary);
  font-size: 14px;
}

#pane-tools .file-name.has-file {
  color: var(--text);
  font-weight: 500;
}

/* Small primary chip inside the file picker */
#pane-tools .file-button {
  background: linear-gradient(160deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(37,99,235,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
  white-space: nowrap;
}

/* ---------- Primary action buttons (contained, centered CTA) ---------- */
/* Scaled-up .btn.primary rather than a full-width slab, to match k5viewer's
   compact button vocabulary. */
#pane-tools button:not(.log-toggle):not(.btn) {
  display: block;
  width: fit-content;
  min-width: 240px;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 12px 28px;
  border-radius: var(--radius);
  border: 1px solid #2563eb;
  background: linear-gradient(160deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(37,99,235,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}

#pane-tools button:not(.log-toggle):not(.btn):hover:not(:disabled) {
  background: linear-gradient(160deg, #60a5fa 0%, #3b82f6 100%);
  border-color: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
}

#pane-tools button:not(.log-toggle):not(.btn):active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

#pane-tools button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

[data-theme="dark"] #pane-tools button:not(.log-toggle):not(.btn) {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 2px 8px rgba(59,130,246,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}
[data-theme="dark"] #pane-tools button:not(.log-toggle):not(.btn):hover:not(:disabled) {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  box-shadow: 0 4px 12px rgba(59,130,246,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Focus: no halo — the select's border turns blue on focus (via core.css),
   matching k5viewer. Buttons fall back to the browser's default focus ring. */

/* ---------- Progress bar ---------- */
#pane-tools .progress-container {
  margin-top: 20px;
  display: none;
}

#pane-tools .progress-bar {
  position: relative;
  width: 100%;
  height: 30px;
  background: var(--border);
  border-radius: 15px;
  overflow: hidden;
}

#pane-tools .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
  width: 0%;
  transition: width 0.3s;
}

#pane-tools .progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  pointer-events: none;
}

/* ---------- Download link ---------- */
/* Compact success chip, centered — not a full-width bar */
#pane-tools .download-link {
  display: none;
  width: fit-content;
  max-width: 100%;
  margin: 20px 0 0;
  padding: 10px 18px;
  background: color-mix(in oklab, var(--accent) 8%, var(--surface));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-align: center;
}

#pane-tools .download-link a {
  color: var(--accent-hover);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#pane-tools .download-link a:hover {
  text-decoration: underline;
}

#pane-tools .download-link a .dl-icon {
  flex: 0 0 auto;
}

/* ---------- Log / console ---------- */
#pane-tools .log-container {
  margin-top: 25px;
}

#pane-tools .log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#pane-tools .log-toggle {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
}

#pane-tools .log-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

#pane-tools .log {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  max-height: 300px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  display: none;
}

#pane-tools .log.visible {
  display: block;
}

#pane-tools .log-entry {
  margin-bottom: 4px;
  color: var(--text);
}

#pane-tools .log-entry.error {
  color: var(--error);
  font-weight: 600;
}

#pane-tools .log-entry.success {
  color: var(--success);
  font-weight: 600;
}

#pane-tools .log-entry.info {
  color: var(--accent);
}

/* ---------- Info block ---------- */
#pane-tools .info-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 15px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---------- Logo controls ---------- */
#pane-tools .logo-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 15px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#pane-tools .logo-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

#pane-tools .logo-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  margin-bottom: 0;
}

#pane-tools .logo-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 18px;
  height: 18px;
}

#pane-tools .logo-preview-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

#pane-tools .logo-preview-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

#pane-tools .logo-canvas {
  width: 512px;
  max-width: 100%;
  height: auto;
  /* Physical aspect ratio of the ST7565 LCD on UV-K5/K1 (~22x12 mm panel),
     not the logical 128/64=2.0. Pixels render slightly taller than wide,
     matching what the user actually sees on the radio. */
  aspect-ratio: 22 / 16;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

/* ---------- Accessibility helpers ---------- */
#pane-tools .sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
