/* ═══════════════════════════════════════════════════════════════════
   EMU Configurator — Styles
   Matching A4T dark-theme conventions (Inter font, blue accents).
   ═══════════════════════════════════════════════════════════════════ */

:root {
    /* Backgrounds */
    --bg-primary:   #13161c;
    --bg-secondary: #181c24;
    --bg-panel:     #232a34;
    --bg-tertiary:  #1c222b;

    /* Accents */
    --accent:       #4a6fa5;
    --accent-hover: #6989b9;
    --accent-light: #7ea3cc;

    /* Text */
    --text-primary:   #f0f3f6;
    --text-secondary: #c4cad2;
    --text-muted:     #a0a8b2;

    /* Borders */
    --border-color: #2d333b;
    --border-light: #444c56;

    /* Status */
    --success: #3fb950;
    --warning: #d29922;
    --error:   #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────── */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent);
}
.logo .subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.header-links {
    display: flex;
    gap: 1rem;
}
.header-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}
.header-links a:hover {
    color: var(--accent);
}

/* ── Main layout ────────────────────────────────────────────────── */

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Config panel (left) ────────────────────────────────────────── */

.config-panel {
    width: 380px;
    min-width: 300px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.config-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}
.config-panel-content::-webkit-scrollbar { width: 8px; }
.config-panel-content::-webkit-scrollbar-track { background: var(--bg-secondary); border-radius: 4px; }
.config-panel-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.config-panel-content::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

.config-panel h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* ── Manifest panel (right) ─────────────────────────────────────── */

.manifest-panel {
    flex: 1;
    background: var(--bg-primary)
                url('../images/EMU_watermark.svg')
                no-repeat top 2rem right -350px / 1600px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.manifest-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    -webkit-overflow-scrolling: touch;
}
.manifest-panel-content::-webkit-scrollbar { width: 8px; }
.manifest-panel-content::-webkit-scrollbar-track { background: var(--bg-secondary); border-radius: 4px; }
.manifest-panel-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.manifest-panel-content::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

.manifest-panel h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    position: relative;
}

/* ── Config sections ────────────────────────────────────────────── */

.config-section {
    margin-bottom: 1.25rem;
}
.config-section h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.section-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
    line-height: 1.4;
    font-style: italic;
}

.option-sub-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-light);
    margin: 0.75rem 0 0.25rem;
    padding-left: 0.25rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.option-wrapper {
    margin-bottom: 0.25rem;
}

/* ── Radio & checkbox options ───────────────────────────────────── */

.option {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.option:hover {
    background: rgba(255, 255, 255, 0.05);
}
.option.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.option input[type="radio"],
.option input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 0.75rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}
.option input[type="checkbox"] {
    border-radius: 4px;
}
.option input[type="radio"]:checked,
.option input[type="checkbox"]:checked {
    border-color: var(--accent);
    background: var(--accent);
}
.option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    width: 6px; height: 6px;
    background: white;
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.option input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 10px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.option-label {
    font-size: 0.875rem;
}
.option-description {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Number input (lane count) ──────────────────────────────────── */

.number-input-row {
    display: flex;
    align-items: center;
    gap: 0;
}
.number-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.number-btn:first-child { border-radius: 6px 0 0 6px; }
.number-btn:last-child  { border-radius: 0 6px 6px 0; }
.number-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}
.number-input {
    width: 48px;
    height: 36px;
    text-align: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-right: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    -moz-appearance: textfield;
}
.number-input::-webkit-inner-spin-button,
.number-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Colour pickers ─────────────────────────────────────────────── */

.color-pickers {
    display: flex;
    gap: 1rem;
}
.color-picker-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.color-picker-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.color-picker-group input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    cursor: pointer;
    padding: 2px;
}
.color-picker-group input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-picker-group input[type="color"]::-webkit-color-swatch { border: none; border-radius: 2px; }

/* ── Buttons (actions) ──────────────────────────────────────────── */

.actions-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-download {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-download:hover { background: var(--accent-hover); }
.btn-download:disabled { opacity: 0.6; cursor: default; }

.btn-copy-url,
.btn-reset {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.btn-copy-url:hover { background: var(--bg-tertiary); border-color: var(--accent); }
.btn-reset:hover    { background: var(--bg-tertiary); }

/* ── Print list ─────────────────────────────────────────────────── */

/* ── Category headers ─────────────────────────────────────────── */
.part-category-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.5rem 0 0.2rem;
    border-bottom: 1px solid var(--border-color);
    margin-top: 0.75rem;
}
.part-category-header:first-child { margin-top: 0; }

/* ── Parts list (flex, capped width) ──────────────────────────── */
.parts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    max-width: 800px;
    background: var(--bg-primary);
    position: relative;
}

.part-file-entry {
    padding: 0.35rem 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    border-radius: 3px;
}
.part-file-entry:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}
.part-file-entry:nth-child(even) {
    background: rgba(255, 255, 255, 0.07);
}

.part-file {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.part-file .part-name-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.part-filename {
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-family: monospace;
    padding-left: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.part-qty {
    width: 5rem;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}
.part-stl-link {
    width: 3.5rem;
    text-align: right;
    flex-shrink: 0;
    font-size: 0.85rem;
}
.part-stl-link a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
.part-stl-link a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}
.print-note {
    width: 100%;
    color: var(--accent-light);
    font-size: 0.7rem;
    font-style: italic;
    padding-left: 1rem;
}

/* Colour dots */
.color-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-main        { background: #666; }
.dot-accent      { background: #e07040; }
.dot-translucent { background: #ddd; border: 1px solid #999; }
.dot-tpu         { background: #5090d0; }

/* ── Print profiles reference ───────────────────────────────────── */

.print-profiles-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    position: relative;
}
.print-profiles-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
}
.print-profile {
    margin-bottom: 0.75rem;
}
.print-profile strong {
    font-size: 0.8rem;
    color: var(--text-primary);
}
.print-profile-settings {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    line-height: 1.5;
}
.print-profile-notes {
    list-style: disc;
    margin: 0.25rem 0 0 1.25rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.print-profile-notes li {
    margin-bottom: 0.15rem;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .main-content { flex-direction: column; }
    .config-panel {
        width: 100%;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .manifest-panel-content {
        padding: 1rem;
    }
}
