/*
    The wizard's components. No colours of their own: every rule reads a --convert-* custom property
    with a literal fallback, which the app maps onto its light/dark palette (css/app.css).
*/

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.icon {
    width: 1rem;
    height: 1rem;
    vertical-align: -0.15em;
    flex-shrink: 0;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 6px;
    background: var(--convert-surface, #fff);
    color: var(--convert-text, #333);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
}

.button:hover:not(:disabled) {
    border-color: var(--convert-primary, #2b579a);
}

.button:disabled {
    opacity: 0.5;
    cursor: default;
}

.button.primary {
    background: var(--convert-primary, #2b579a);
    border-color: var(--convert-primary, #2b579a);
    color: #fff;
}

/* Wizard layout: the preview on the left, the rail of choices on the right. */
.wizard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22rem;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 900px) {
    .wizard {
        grid-template-columns: minmax(0, 1fr);
    }
}

.stepper {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    color: var(--convert-muted, #6c757d);
}

.stepper li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stepper li + li::before {
    content: "→";
    margin-right: 0.1rem;
}

.stepper li.active {
    color: var(--convert-text, #333);
    font-weight: 600;
}

.panel {
    background: var(--convert-surface, #fff);
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 8px;
    padding: 1rem;
}

.panel h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.source-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.source-bar .file-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.source-bar .spacer {
    flex: 1;
}

.tabs {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.2rem;
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 6px;
}

.tabs button {
    padding: 0.25rem 0.8rem;
    border: none;
    border-radius: 4px;
    background: none;
    color: var(--convert-text, #333);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.tabs button.active {
    background: var(--convert-primary, #2b579a);
    color: #fff;
}

/* Empty state. */
.drop-zone {
    padding: 2.5rem 1.5rem;
    border: 2px dashed var(--convert-border, #dee2e6);
    border-radius: 10px;
    background: var(--convert-surface, #fff);
    text-align: center;
}

body.dragging .drop-zone {
    border-color: var(--convert-primary, #2b579a);
}

.drop-zone h2 {
    margin: 0.5rem 0;
}

.drop-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--convert-primary, #2b579a);
}

.drop-actions,
.samples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.samples p {
    flex-basis: 100%;
    margin: 0;
    color: var(--convert-muted, #6c757d);
    font-size: 0.9rem;
}

/* A group of samples: one button opening a menu under it. */
.sample-menu {
    position: relative;
}

.sample-menu-chevron {
    opacity: 0.7;
}

.sample-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10;
}

.sample-menu-items {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    z-index: 11;
    min-width: 100%;
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    text-align: left;
    background: var(--convert-surface, #fff);
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 15%);
}

/* A long menu (Mermaid's, a sample per diagram type) is two columns, top to bottom, so it stays short. */
.sample-menu-items:has(> li:nth-child(13)) {
    column-count: 2;
    column-gap: 0.25rem;
}

.sample-menu-items > li {
    break-inside: avoid;
}

.sample-menu-item {
    display: block;
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: 0;
    border-radius: 0.375rem;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.sample-menu-item:hover,
.sample-menu-item:focus-visible {
    background: color-mix(in srgb, currentColor 10%, transparent);
    outline: none;
}

.paste-panel {
    margin: 1rem auto 0;
    max-width: 40rem;
    text-align: left;
}

.paste-panel textarea,
.text-editor textarea {
    width: 100%;
    min-height: 12rem;
    padding: 0.6rem;
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 6px;
    background: var(--convert-background, #f8f9fa);
    color: var(--convert-text, #333);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.85rem;
    resize: vertical;
}

.text-editor textarea {
    min-height: 24rem;
}

.editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.paste-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

/* Target chips. */
.target-group h4 {
    margin: 0.75rem 0 0.4rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--convert-muted, #6c757d);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 999px;
    background: var(--convert-background, #f8f9fa);
    color: var(--convert-text, #333);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.chip.selected {
    background: var(--convert-primary, #2b579a);
    border-color: var(--convert-primary, #2b579a);
    color: #fff;
}

/* Tool picker and options. */
.tool-picker {
    margin: 1rem 0 0;
    padding: 0;
    border: none;
}

.tool-picker legend,
.options-heading {
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.tool-choice {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.5rem;
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 6px;
    margin-bottom: 0.4rem;
}

.tool-choice.selected {
    border-color: var(--convert-primary, #2b579a);
}

.tool-choice label {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.tool-name {
    font-weight: 600;
}

.tool-summary,
.option-hint,
.preview-note,
.expect {
    color: var(--convert-muted, #6c757d);
    font-size: 0.8rem;
}

.expect {
    margin: 0.75rem 0 0;
}

.options-grid {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.option {
    display: grid;
    gap: 0.2rem;
}

.option label {
    font-size: 0.85rem;
}

.option select,
.option input[type="number"],
.option input[type="text"] {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 4px;
    background: var(--convert-background, #f8f9fa);
    color: var(--convert-text, #333);
    font: inherit;
    font-size: 0.85rem;
}

.option-flag {
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 0.4rem;
}

.option-flag .option-hint {
    grid-column: 1 / -1;
}

.option-radios {
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1rem;
}

.option-radios legend {
    padding: 0;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}

.option-radios label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.option-radios .option-hint {
    flex-basis: 100%;
}

.option input[type="color"] {
    width: 3rem;
    height: 1.8rem;
    padding: 0;
    border: 1px solid var(--convert-border, #dee2e6);
    background: none;
}

.advanced-options summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--convert-primary, #2b579a);
}

.convert-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.notes {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
    font-size: 0.8rem;
    color: var(--convert-muted, #6c757d);
}

/* Previews. */
.preview-host {
    min-height: 6rem;
}

/* A render kept while the edited text does not render (an error stands above it). */
.stale-preview {
    opacity: 0.4;
}

.text-preview {
    margin: 0;
    max-height: 70vh;
    overflow: auto;
    padding: 0.75rem;
    border-radius: 6px;
    background: var(--convert-background, #f8f9fa);
    font-size: 0.8rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.table-preview {
    max-height: 70vh;
    overflow: auto;
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 6px;
}

.table-preview table {
    border-collapse: collapse;
    font-size: 0.8rem;
    width: max-content;
    min-width: 100%;
}

.table-preview th,
.table-preview td {
    padding: 0.3rem 0.6rem;
    border-bottom: 1px solid var(--convert-border, #dee2e6);
    text-align: left;
    white-space: nowrap;
    max-width: 24rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-preview th {
    position: sticky;
    top: 0;
    background: var(--convert-background, #f8f9fa);
}

.image-preview {
    display: flex;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 6px;
    background: repeating-conic-gradient(#0001 0% 25%, transparent 0% 50%) 50% / 16px 16px;
}

.image-preview img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.frame-preview,
.pdf-preview {
    width: 100%;
    height: 70vh;
    border: 1px solid var(--convert-border, #dee2e6);
    border-radius: 6px;
    background: #fff;
}

.no-preview {
    padding: 2rem;
    text-align: center;
}

.no-preview .icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--convert-muted, #6c757d);
}

.zip-preview ul {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.85rem;
}

.zip-size {
    color: var(--convert-muted, #6c757d);
}

.parts-preview .part {
    margin: 0 0 1rem;
}

.parts-preview figcaption {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--convert-muted, #6c757d);
    text-align: center;
}

/* Progress and errors. */
.progress {
    margin: 1rem 0;
}

.progress-track {
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: var(--convert-border, #dee2e6);
}

.progress-bar {
    width: 35%;
    height: 100%;
    background: var(--convert-primary, #2b579a);
    animation: convert-progress 1.2s ease-in-out infinite;
}

@keyframes convert-progress {
    from { transform: translateX(-100%); }
    to { transform: translateX(300%); }
}

.progress-label {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    color: var(--convert-muted, #6c757d);
}

.error {
    display: flex;
    gap: 0.6rem;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid #e0a3a3;
    border-radius: 6px;
    background: #fdecec;
    color: #842029;
    text-align: left;
}

.error .icon {
    margin-top: 0.15rem;
}

.error p {
    margin: 0;
    overflow-wrap: anywhere;
}

.error-report {
    margin-top: 0.4rem !important;
    font-size: 0.85rem;
}

.loading-tools {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    background: var(--convert-surface, #fff);
    border: 1px solid var(--convert-border, #dee2e6);
    box-shadow: 0 2px 8px #0002;
    font-size: 0.8rem;
}
