/* Converter styles are kept buildless so the production page can run as static files. */

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

img {
    max-width: 100%;
    height: auto;
}

button,
a,
input {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex="-1"]:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

#result-heading:focus {
    outline: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.noscript-message {
    max-width: 760px;
    margin: 24px auto;
    padding: 14px 18px;
    color: #7f1d1d;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    line-height: 1.5;
}

.converter-shell {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.converter-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 20px 24px 0;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 6px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.converter-message strong {
    flex: 0 0 auto;
}

.converter-message-error {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.converter-message-warning {
    color: #854d0e;
    background: #fffbeb;
    border-color: #fde68a;
}

.upload-zone {
    min-height: 320px;
    padding: 52px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px dashed #aeb8c7;
    border-radius: 8px;
    margin: 24px;
    background: #f8fafc;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.upload-zone.is-dragging {
    border-color: #166534;
    background: #f0fdf4;
}

.upload-zone[aria-disabled="true"] {
    opacity: 0.72;
}

.upload-icon {
    width: 52px;
    height: 52px;
    color: #64748b;
}

.upload-zone h3 {
    margin: 18px 0 6px;
    color: #111827;
    font-size: 1.25rem;
    font-weight: 700;
}

.upload-zone > p {
    max-width: 520px;
    margin: 0;
    color: #526072;
    line-height: 1.6;
}

.upload-zone .converter-button {
    margin-top: 22px;
}

.upload-zone .upload-limit {
    margin-top: 12px;
    color: #6b7280;
    font-size: 0.8125rem;
}

.converter-button {
    min-height: 44px;
    max-width: 100%;
    padding: 10px 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.converter-button:disabled {
    color: #8a94a3;
    background: #e5e7eb;
    border-color: #d1d5db;
    cursor: not-allowed;
}

.converter-button-primary:not(:disabled) {
    color: #ffffff;
    background: #166534;
    border-color: #166534;
}

.converter-button-primary:not(:disabled):hover {
    background: #14532d;
    border-color: #14532d;
}

.converter-button-download-all:not(:disabled) {
    color: #ffffff;
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.converter-button-download-all:not(:disabled):hover {
    background: #1e40af;
    border-color: #1e40af;
}

.converter-button-secondary {
    color: #243244;
    background: #ffffff;
    border-color: #b9c2cf;
}

.converter-button-secondary:not(:disabled):hover {
    background: #f3f4f6;
    border-color: #7b8796;
}

.converter-loading {
    min-height: 320px;
    padding: 48px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #475569;
    text-align: center;
}

.converter-loading p {
    max-width: 560px;
    margin: 18px 0 0;
    line-height: 1.6;
}

.converter-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #dbe4ed;
    border-top-color: #166534;
    border-radius: 50%;
    animation: converter-spin 800ms linear infinite;
}

@keyframes converter-spin {
    to {
        transform: rotate(360deg);
    }
}

.converter-results {
    min-width: 0;
}

.result-header {
    padding: 24px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
}

.result-header h2 {
    margin: 0;
    color: #111827;
    font-size: 1.25rem;
    font-weight: 700;
}

.result-file-name {
    max-width: 720px;
    margin: 5px 0 0;
    color: #334155;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.result-summary {
    margin: 4px 0 0;
    color: #64748b;
    line-height: 1.5;
}

.result-layout {
    min-width: 0;
    min-height: 430px;
    display: grid;
    grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
}

.entry-panel {
    min-width: 0;
    padding: 22px;
    border-right: 1px solid #e2e8f0;
    background: #f8fafc;
}

.entry-panel h3,
.preview-copy h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
}

.panel-help {
    margin: 5px 0 16px;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.45;
}

.entry-list {
    max-height: 390px;
    padding: 0 4px 0 0;
    margin: 0;
    display: grid;
    gap: 9px;
    overflow-y: auto;
    list-style: none;
}

.entry-list-item {
    min-width: 0;
}

.entry-option {
    width: 100%;
    min-width: 0;
    min-height: 96px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #273447;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    text-align: left;
    overflow-wrap: anywhere;
}

button.entry-option {
    cursor: pointer;
}

button.entry-option:hover {
    border-color: #64748b;
}

button.entry-option[aria-pressed="true"] {
    background: #eef6ff;
    border-color: #2563eb;
    box-shadow: inset 3px 0 0 #2563eb;
}

.entry-option[data-state="error"] {
    color: #7f1d1d;
    background: #fff7f7;
    border-color: #fecaca;
}

.entry-heading-row {
    min-width: 0;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: space-between;
}

.entry-title {
    color: inherit;
    font-size: 1rem;
    font-weight: 800;
}

.entry-status {
    flex: 0 0 auto;
    max-width: 54%;
    padding: 2px 7px;
    color: #166534;
    background: #dcfce7;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
}

[data-state="error"] .entry-status {
    color: #991b1b;
    background: #fee2e2;
}

.entry-details,
.entry-index,
.entry-error {
    display: block;
    line-height: 1.4;
}

.entry-details {
    color: #536173;
    font-size: 0.8125rem;
}

.entry-index {
    color: #7b8796;
    font-size: 0.75rem;
}

.entry-error {
    margin-top: 3px;
    color: #991b1b;
    font-size: 0.8125rem;
}

.preview-panel {
    min-width: 0;
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.preview-stage {
    width: min(100%, 360px);
    aspect-ratio: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7b8796;
    background: #eef1f5;
    border: 1px solid #d5dbe4;
    border-radius: 6px;
    overflow: hidden;
}

.preview-stage p {
    margin: 0;
    text-align: center;
}

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

.preview-copy {
    width: min(100%, 520px);
    margin-top: 18px;
    text-align: center;
}

.preview-copy p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.converter-actions {
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    align-items: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

@media (max-width: 767px) {
    header nav > div {
        min-height: 64px;
        height: auto !important;
        padding-top: 12px;
        padding-bottom: 12px;
        gap: 10px 16px;
        flex-wrap: wrap;
    }

    header nav .space-x-4 {
        gap: 8px 12px;
        flex-wrap: wrap;
    }

    header nav .space-x-4 > :not([hidden]) ~ :not([hidden]) {
        margin-left: 0 !important;
    }

    .converter-message {
        margin: 16px 16px 0;
        flex-direction: column;
        gap: 3px;
    }

    .upload-zone {
        min-height: 300px;
        margin: 16px;
        padding: 36px 18px;
    }

    .result-header {
        padding: 20px;
        flex-direction: column;
        gap: 16px;
    }

    .result-header .converter-button {
        width: 100%;
    }

    .result-layout {
        min-height: 0;
        grid-template-columns: minmax(0, 1fr);
    }

    .entry-panel {
        padding: 20px;
        border-right: 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .entry-list {
        max-height: 286px;
    }

    .preview-panel {
        min-height: 360px;
        padding: 22px 20px;
    }

    .preview-stage {
        width: min(100%, 280px);
    }

    .converter-actions {
        padding: 16px 20px 20px;
        flex-direction: column;
    }

    .converter-actions .converter-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    header,
    footer,
    .converter-actions {
        display: none;
    }
}
