/*!
 * @file        components.css
 * @description Reusable UI components - buttons, inputs, modals, tooltips
 * @author      Eltryus - Ricardo Marques
 * @copyright   2025-2026 Eltryus - Ricardo Marques
 * @see         {@link https://github.com/RicardoJCMarques/EasyTrace5000}
 * @license     AGPL-3.0-or-later
 */

/*
 * EasyTrace5000 - Advanced PCB Isolation CAM Workspace
 * Copyright (C) 2025-2026 Eltryus
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

/* ============================================================================
   BUTTONS - Unified System
   ============================================================================ */

/* Base button - all buttons inherit from this */
.btn {
    min-width: var(--touch-target-compact);
    min-height: var(--touch-target-compact);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    user-select: none;
    background: transparent;
    color: var(--color-text-primary);
}

.btn:hover:not(:disabled) {
    border-color: var(--color-accent-primary);
    background: var(--color-bg-hover);
}

.btn:active:not(:disabled) {
    background: var(--color-bg-active);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button Variants */
.btn--primary {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: white;
}

.btn--primary:hover:not(:disabled) {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
}

.btn--secondary {
    background: transparent;
    border: 1px solid var(--color-border-secondary);
}

.btn--secondary:hover:not(:disabled) {
    border-color: var(--color-accent-primary);
    background: var(--color-bg-hover);
}

/* Icon-only buttons */
.btn--icon {
    padding: var(--spacing-xs);
    min-width: 2.25rem;
    min-height: 2.25rem;
    background: transparent;
    border: 1px solid transparent;
}

.btn--icon:hover:not(:disabled) {
    border-color: var(--color-border-secondary);
    background: var(--color-bg-hover);
}

/* Toolbar buttons */
.btn--tool {
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: var(--spacing-xs);
    background: transparent;
    border: 1px solid transparent;
}

.btn--tool:hover:not(:disabled) {
    border-color: var(--color-border-secondary);
    background: var(--color-bg-hover);
}

/* Compact size for dense layouts */
.btn--compact {
    min-width: 1.75rem;
    min-height: 1.75rem;
    padding: var(--spacing-xs);
    font-size: var(--font-size-xs);
}

/* Block button */
.btn--block {
    width: 100%;
}

/* Button icon sizing */
.btn svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.btn--compact svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* Menu button with dropdown */
.btn--menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    background: transparent;
    border: 1px solid var(--color-border-secondary);
}

.btn--menu:hover {
    border-color: var(--color-accent-primary);
}

.btn--menu.active {
    background: var(--color-bg-active);
    border-color: var(--color-accent-primary);
}

/* Theme toggle */
.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0;
    background: transparent;
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--radius);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--color-accent-primary);
    color: var(--color-text-primary);
}

.theme-toggle svg {
    position: absolute;
    width: 1.125rem;
    height: 1.125rem;
}

/* Visibility toggle icon */

/* By default (no .is-hidden), the layer is VISIBLE */
/* Show the standard eye icon, hide the slash icon */
.visibility-btn .icon-eye {
    display: block;
}

.visibility-btn .icon-eye-slash {
    display: none;
}

/* When .is-hidden class is on the button, the layer is HIDDEN */
/* Hide the standard eye icon, show the slash icon */
.visibility-btn.is-hidden .icon-eye {
    display: none;
}

.visibility-btn.is-hidden .icon-eye-slash {
    display: block;
}

/* ============================================================================
   INPUTS & FORMS
   ============================================================================ */

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--radius);
    color: var(--color-text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 2px rgba(64, 128, 255, 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--color-bg-tertiary);
    color: var(--color-text-disabled);
    cursor: not-allowed;
    opacity: 0.5;
}

input[readonly] {
    background: var(--color-bg-tertiary);
    color: var(--color-text-disabled);
    cursor: not-allowed;
}

/* Input with unit suffix */
.input-unit {
    display: flex;
    align-items: stretch;
}

.input-unit input {
    border-radius: var(--radius) 0 0 var(--radius);
    border-right: none;
    flex: 1;
}

.input-unit .unit {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Input error state */
input.input-error,
select.input-error {
    border-color: var(--color-error, #dc3545) !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

input.input-error:focus {
    border-color: var(--color-error, #dc3545) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.35);
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: var(--color-accent-primary);
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--radius);
    min-height: var(--touch-target-compact);
}

.checkbox-label:hover,
.radio-label:hover {
    background: var(--color-bg-hover);
}

/* Field Groups */
.field-group {
    margin-bottom: var(--spacing-md);
}

.field-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
}

.field-row {
    display: flex;
    gap: var(--spacing-sm);
}

/* ============================================================================
   TOOLTIPS
   ============================================================================ */

.tooltip {
    position: absolute;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--radius);
    padding: var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--color-text-primary);
    pointer-events: none;
    z-index: var(--z-tooltip);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    opacity: 0;
    max-width: 18.75rem;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.tooltip-title {
    font-weight: 600;
    color: var(--color-accent-primary);
    margin-bottom: var(--spacing-xs);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--color-border-primary);
}

.tooltip-text {
    line-height: var(--line-height-base);
    white-space: normal;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-lg);
}

.tooltip-label {
    color: var(--color-text-secondary);
}

.tooltip-value {
    color: var(--color-text-primary);
    font-weight: 500;
}

/* Tooltip trigger icon */
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.875rem;
    height: 0.875rem;
    margin-left: var(--spacing-xs);
    border: 1px solid var(--color-text-secondary);
    border-radius: 50%;
    font-size: 0.5625rem;
    font-weight: 600;
    cursor: help;
    opacity: 0.6;
    user-select: none;
}

.tooltip-trigger:hover,
.tooltip-trigger:focus {
    opacity: 1;
    border-color: var(--color-accent-primary);
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.modal.active {
    display: flex;
}

.header-text-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: 400;
}

.modal-content {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: min(700px, 95vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-text-primary);
}

.modal-close {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    line-height: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.modal-close:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.modal-close svg {
    flex-shrink: 0;
    pointer-events: none;
}

.modal-body {
    flex: 1 1 auto;
    padding: var(--spacing-lg);
    overflow-y: auto;
}

/* Remove extra bottom padding when followed by footer */
.modal-body:has(+ .modal-footer) {
    padding-bottom: var(--spacing-lg);
}

.modal-footer {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    padding: var(--spacing-lg);
    border-top: 1px solid var(--color-border-primary);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ============================================================================
   WELCOME MODAL (Pipeline Selection)
   ============================================================================ */

.pipeline-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-lg);
}

.pipeline-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

/* Base Card Style */
.pipeline-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    text-decoration: none;
    color: var(--color-text-primary);
    cursor: pointer;
    box-sizing: border-box;
}

/* CNC Variant */
.pipeline-card--active {
    border: 2px solid var(--color-border-secondary);
    background: var(--color-bg-tertiary);
}

.pipeline-card--active .pipeline-icon {
    color: var(--color-pipeline-cnc);
}

.pipeline-card--active:hover {
    border-color: var(--color-pipeline-cnc);
}

/* Laser Variant */
.pipeline-card--dev {
    border: 2px solid var(--color-border-secondary);
    background: var(--color-bg-secondary);
}

.pipeline-card--dev .pipeline-icon {
    color: var(--color-text-disabled);
}

.pipeline-card--dev h3 {
    color: var(--color-text-secondary);
}

.pipeline-card--dev .pipeline-desc {
    color: var(--color-text-disabled);
}

.pipeline-card--dev:hover {
    border-style: dashed;
    border-color: var(--color-pipeline-laser);
}

.pipeline-card--dev:hover .pipeline-icon {
    color: var(--color-pipeline-laser);
}

/* Common Element Styling */
.pipeline-icon {
    margin-bottom: var(--spacing-md);
}

.pipeline-card h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xs);
}

.pipeline-badge {
    display: inline-block;
    padding: 2px var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.pipeline-badge--stable {
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.pipeline-badge--dev {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.pipeline-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height-base);
    margin-bottom: var(--spacing-lg);
    flex: 1;
}

/* Action Button Styling */
.pipeline-action {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* CNC Action Button */
.pipeline-card--active .pipeline-action {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-secondary);
}

.pipeline-card--active:hover .pipeline-action {
    background: var(--color-pipeline-cnc);
    border-color: var(--color-pipeline-cnc);
    color: #fff;
}

/* Laser Action Button */
.pipeline-card--dev .pipeline-action {
    background: transparent;
    color: var(--color-text-disabled);
    border: 1px solid transparent;
}

.pipeline-card--dev:hover .pipeline-action {
    color: var(--color-pipeline-laser);
    border-color: var(--color-pipeline-laser);
}

.welcome-intro {
    text-align: center;
    max-width: 38rem;
    margin: 0 auto var(--spacing-lg);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-primary);
}

.welcome-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: var(--color-text-hint);
}

.welcome-footer-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.welcome-footer-links a:hover {
    color: var(--color-accent-primary);
    text-decoration: underline;
}

/* Ensure the separators inside the links look correct */
.welcome-footer-links .separator {
    background: var(--color-border-secondary);
    height: 1em; /* Adjust height to match text */
}

/* ============================================================================
   SPONSOR SYSTEM
   ============================================================================ */

.sponsors-section {
    border-top: 1px solid var(--color-border-primary);
    padding-top: var(--spacing-lg);
    text-align: center;
}

.sponsors-section h4 {
    font-size: var(--font-size-xs);
    color: var(--color-text-hint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-md);
}

.sponsor-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

/* Base Slot Style */
.sponsor-slot {
    height: 6.875rem;
    background: var(--color-bg-primary);
    border: 1.5px dashed var(--color-border-secondary);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: var(--font-size-xs);
    color: var(--color-text-disabled);
    cursor: pointer;
}

.sponsor-slot .slot-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sponsor-slot:hover {
    border-style: solid;
    border-color: var(--color-interaction-sponsorship);
    color: var(--color-interaction-sponsorship);
    background: var(--color-bg-secondary);
}

.sponsor-slot--filled {
    opacity: 1;
    background: var(--color-bg-secondary);
    border-color: var(--color-border-secondary);
}

.sponsor-slot--filled:hover {
    border-color: var(--color-accent-primary);
}

.sponsor-slot--filled img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.sponsor-cta {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    text-decoration: none;
    margin-top: var(--spacing-sm);
    display: inline-block;
}

.sponsor-cta:hover {
    color: var(--color-interaction-sponsorship);
    text-decoration: underline;
}

/* ============================================================================
   SUPPORT MODAL
   ============================================================================ */

.support-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.support-intro {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin: 0 auto;
    max-width: 31.25rem;
    line-height: var(--line-height-relaxed);
}

.support-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
}

.support-card {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Headers */
.support-card h3 {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.support-card--sponsorship h3 {
    color: var(--color-interaction-sponsorship);
}

.support-card--kofi h3 {
    color: var(--color-interaction-kofi);
}

.support-card p {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: var(--line-height-relaxed);
    flex: 1;
}

/* Email Copy Button */
.support-email-container {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.support-email-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-hint);
}

.support-email-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.support-email-btn:hover {
    min-width: 13.75rem;
    border-color: var(--color-interaction-sponsorship);
    color: var(--color-text-primary);
}

.support-email-btn.copied {
    border-color: var(--color-success);
    color: var(--color-success);
    background: rgba(34, 197, 94, 0.1);
}

.support-email-btn svg {
    color: var(--color-interaction-sponsorship);
}

/* Ko-fi Button */
.btn--kofi {
    width: 100%;
    margin-top: auto;
    background: var(--color-interaction-kofi);
    border: 1px solid var(--color-interaction-kofi);
    color: #000;
    font-weight: 600;
    justify-content: center;
}

.btn--kofi:hover {
    filter: brightness(1.1);
    background: var(--color-interaction-kofi);
}

/* ============================================================================
   QUICKSTART MODAL
   ============================================================================ */

/* Alignment */
.header-text-group h2 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* The Anchor Span */
.pipeline-icon-anchor {
    display: flex;
    align-items: center;
    height: 1em;
}

/* Icon Default State (Hidden) */
.pipeline-icon-anchor svg {
    display: none;
    width: 1.375rem;
    height: 1.375rem;
}

/* CNC State (Triggered by parent class) */
.mode-cnc .icon-cnc {
    display: block;
    color: var(--color-pipeline-cnc);
}

/* Laser State */
.mode-laser .icon-laser {
    display: block;
    color: var(--color-pipeline-laser);
}

.quickstart-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Clean Row */
.quickstart-example-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0;
    border: none;
    background: transparent;
    margin-bottom: var(--spacing-xs);
}

.quickstart-example-row label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
}

.quickstart-example-row select {
    flex: 1;
}

/* Promoted Load Button */
#load-example-btn {
    background: var(--color-accent-primary);
    color: white;
    border-color: var(--color-accent-primary);
    min-width: 6.25rem;
}

#load-example-btn:hover {
    background: var(--color-accent-hover);
}

/* Upload Section */
.quickstart-upload-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.quickstart-upload-section > p {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0;
}

.quickstart-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.quickstart-drop-zone {
    background: var(--color-bg-tertiary);
    border: 2px dashed var(--color-border-secondary);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    text-align: center;
    cursor: pointer;
    min-height: 6.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.quickstart-drop-zone:hover {
    background: var(--color-bg-hover);
}

.quickstart-drop-zone.dragging {
    border-style: solid;
    background: var(--color-bg-active);
}

.quickstart-drop-zone.has-file {
    border-color: var(--color-success);
    border-style: solid;
    background: rgba(34, 197, 94, 0.05);
}

.quickstart-drop-zone svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--color-text-secondary);
}

/* Operation-specific colors */
.quickstart-drop-zone[data-op-type="isolation"] {
    border-color: var(--color-operation-isolation);
}

.quickstart-drop-zone[data-op-type="isolation"]:hover {
    border-color: var(--color-operation-isolation);
    background: rgba(255, 136, 68, 0.08);
}

.quickstart-drop-zone[data-op-type="isolation"] svg,
.quickstart-drop-zone[data-op-type="isolation"] .zone-label {
    color: var(--color-operation-isolation);
}

.quickstart-drop-zone[data-op-type="drill"] {
    border-color: var(--color-operation-drill);
}

.quickstart-drop-zone[data-op-type="drill"]:hover {
    border-color: var(--color-operation-drill);
    background: rgba(68, 136, 255, 0.08);
}

.quickstart-drop-zone[data-op-type="drill"] svg,
.quickstart-drop-zone[data-op-type="drill"] .zone-label {
    color: var(--color-operation-drill);
}

.quickstart-drop-zone[data-op-type="clearing"] {
    border-color: var(--color-operation-clearing);
}

.quickstart-drop-zone[data-op-type="clearing"]:hover {
    border-color: var(--color-operation-clearing);
    background: rgba(68, 255, 136, 0.08);
}

.quickstart-drop-zone[data-op-type="clearing"] svg,
.quickstart-drop-zone[data-op-type="clearing"] .zone-label {
    color: var(--color-operation-clearing);
}

.quickstart-drop-zone[data-op-type="cutout"] {
    border-color: var(--color-operation-cutout);
}

.quickstart-drop-zone[data-op-type="cutout"]:hover {
    border-color: var(--color-operation-cutout);
    background: rgba(255, 0, 255, 0.08);
}

.quickstart-drop-zone[data-op-type="cutout"] svg,
.quickstart-drop-zone[data-op-type="cutout"] .zone-label {
    color: var(--color-operation-cutout);
}

#process-quickstart-files-btn {
    margin-top: var(--spacing-sm);
    height: 2.75rem;
    font-size: var(--font-size-base);
    font-weight: 600;
}

/* Quickstart footer - three column layout */
.quickstart-footer {
    display: flex;
    align-items: center;
    padding: var(--spacing-lg);
    border-top: 1px solid var(--color-border-primary);
}

.quickstart-footer #quickstart-back-btn {
    flex: 0 0 auto;
}

.quickstart-footer .checkbox-label {
    flex: 1;
    justify-content: center;
}

.quickstart-footer #start-empty-btn {
    flex: 0 0 auto;
}

#start-empty-btn {
    background: transparent;
    border: 1px solid var(--color-border-secondary);
    color: var(--color-text-secondary);
    font-weight: 400;
    min-width: 6.25rem;
}

#start-empty-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
    border-color: var(--color-text-primary);
}

#support-modal .modal-footer {
    justify-content: flex-start;
}

/* ============================================================================
   HELP MODAL
   ============================================================================ */

.modal--help .modal-body {
    max-height: 80vh;
}

.help-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.help-section h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--color-border-primary);
}

/* Workflow Steps */
.workflow-steps {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.workflow-step {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--color-accent-primary);
    color: white;
    border-radius: 50%;
    font-size: var(--font-size-xs);
    font-weight: 600;
    flex-shrink: 0;
}

.step-content strong {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.step-content p {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin: 0;
}

/* Shortcut Groups */
.shortcut-group {
    margin-bottom: var(--spacing-md);
}

.shortcut-group:last-child {
    margin-bottom: 0;
}

.shortcut-group h4 {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

.shortcut-keys {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.shortcut-keys kbd {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-secondary);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    box-shadow: 0 1px 0 var(--color-border-primary);
    min-width: 1.5rem;
    text-align: center;
}

.shortcut-desc {
    color: var(--color-text-secondary);
}

/* Tips List */
.help-tips {
    margin: 0;
    padding-left: var(--spacing-lg);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.help-tips li {
    margin-bottom: var(--spacing-xs);
}

.help-tips li:last-child {
    margin-bottom: 0;
}

/* Help Modal Footer */
.modal--help .modal-footer {
    justify-content: space-between;
}


/* ============================================================================
   OPERATIONS & G-CODE MODAL
   ============================================================================ */

.modal--gcode .modal-body {
    display: flex;
    gap: var(--spacing-xl);
    padding: var(--spacing-lg);
    min-height: 25rem;
}

.gcode-options {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    overflow-y: auto;
    padding-right: var(--spacing-md);
}

.gcode-options h3 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: var(--spacing-md);
}

.gcode-options h3:first-child {
    margin-top: 0;
}

.gcode-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gcode-preview h3 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.preview-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius);
}

#gcode-preview-text {
    flex: 1;
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    resize: none;
}

.operation-order {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    background: var(--color-bg-primary);
    border-radius: var(--radius);
    padding: var(--spacing-sm);
}

.help-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-hint);
    margin-bottom: var(--spacing-sm);
}

/* ============================================================================
   DROPDOWNS
   ============================================================================ */

.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: var(--spacing-xs);
    min-width: 12.5rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: var(--z-dropdown);
}

.dropdown-content.show {
    display: block;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    width: 100%;
    text-align: left;
    cursor: pointer;
    min-height: var(--touch-target-compact);
}

.menu-item:hover:not(:disabled) {
    background: var(--color-bg-hover);
}

.menu-item:disabled {
    color: var(--color-text-disabled);
    cursor: not-allowed;
    opacity: 0.5;
}

.menu-divider {
    height: 1px;
    background: var(--color-border-primary);
    margin: var(--spacing-xs) 0;
}

/* ============================================================================
   BADGES & INDICATORS
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--spacing-xs);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.badge--success {
    background: var(--color-success);
    color: white;
}

.badge--warning {
    background: var(--color-warning);
    color: white;
}

.badge--error {
    background: var(--color-error);
    color: white;
}

.badge--info {
    background: var(--color-info);
    color: white;
}

/* Warning icon */
.warning-icon {
    margin-left: var(--spacing-xs);
    font-size: 0.75rem;
    cursor: help;
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Unsaved indicator */
.unsaved-indicator {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--color-warning);
    display: inline-block;
    margin-left: var(--spacing-xs);
}

/* ============================================================================
   PROGRESS BARS
   ============================================================================ */

.progress {
    display: block;
    height: 4px;
    background: var(--color-bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    display: block;
    height: 100%;
    background: var(--color-accent-primary);
}

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--color-border-secondary);
    border-top: 3px solid var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================================
   STATS & INFO DISPLAY
   ============================================================================ */

.stats-info {
    background: var(--color-bg-primary);
    border-radius: var(--radius);
    padding: var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--color-text-secondary);
}

.stats-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-xs);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-primary);
}

/* ============================================================================
   STATUS LOG
   ============================================================================ */

.status-log-history .log-entry {
    padding: 2px 0;
    white-space: pre-wrap;
    user-select: text;
}

.status-log-history .log-entry.success {
    color: var(--color-success);
}

.status-log-history .log-entry.warning {
    color: var(--color-warning);
}

.status-log-history .log-entry.error {
    color: var(--color-error);
}

.status-log-history .log-entry.info {
    color: var(--color-info);
}

.status-log-history .log-entry.debug {
    color: var(--color-text-hint);
    opacity: 0.7;
}

/* ============================================================================
   SEPARATORS
   ============================================================================ */

.separator {
    width: 1px;
    height: 1.5rem;
    background: var(--color-border-primary);
    margin: 0 var(--spacing-sm);
}

.separator--horizontal {
    width: 100%;
    height: 1px;
    margin: var(--spacing-md) 0;
}

/* ============================================================================
   KEYBOARD NAVIGATION FOCUS STATES
   ============================================================================ */

/* Property field row */
.property-field:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: -2px;
    background: var(--color-bg-hover);
    border-radius: var(--radius);
}

/* Suppress focus ring on mouse click */
.property-field:focus:not(:focus-visible) {
    outline: none;
}

/* Sortable item grabbed state */
.file-node-content.is-grabbed {
    background: var(--color-bg-active);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 2px dashed var(--color-accent-primary);
    transform: scale(1.02);
    z-index: 10;
    position: relative;
}

/* Canvas */
#preview-canvas:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: -2px;
}

#preview-canvas:focus:not(:focus-visible) {
    outline: none;
}

/* Tree items */
.file-node-content:focus-visible,
.geometry-node-content:focus-visible,
.category-header:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: -2px;
}

.file-node-content:focus:not(:focus-visible),
.geometry-node-content:focus:not(:focus-visible),
.category-header:focus:not(:focus-visible) {
    outline: none;
}

/* Checkbox focus states */

input[type="checkbox"]:focus:not(:focus-visible) {
    outline: none;
}

.checkbox-label:has(input:focus-visible) {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
    border-radius: var(--radius);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 600px) {
    .pipeline-selection,
    .quickstart-upload-grid {
        grid-template-columns: 1fr;
    }

    .support-options {
        grid-template-columns: 1fr;
    }

    .sponsor-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal--gcode .modal-body {
        flex-direction: column;
    }

    .gcode-options {
        flex: none;
        max-height: 40vh;
        padding-right: 0;
        padding-bottom: var(--spacing-md);
        border-bottom: 1px solid var(--color-border-primary);
    }

    .quickstart-example-row {
        flex-wrap: wrap;
    }

    .quickstart-example-row label {
        width: 100%;
        margin-bottom: var(--spacing-xs);
    }

    .quickstart-footer {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .quickstart-footer .checkbox-label {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: var(--spacing-sm);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--spacing-md);
    }

    .sponsor-grid {
        grid-template-columns: 1fr;
    }

    .sponsor-slot {
        height: 5rem;
    }
}