/* "Wczytaj z pliku / z programu" (assets/js/km/km-import.js). Prefix km-imp-. */

.km-imp-entry-box {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: 0 0 12px;
    padding: 12px 14px;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-left: 4px solid #2563eb;
    border-radius: 6px;
}
.km-imp-entry-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; line-height: 1.45; color: #1e293b; }
.km-imp-entry-lead { font-size: 14px; color: #1e3a8a; }
.km-imp-entry-alt { font-size: 12px; color: #64748b; }
/* file icon of the import entry / dialog title */
.km-imp-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #1e3a8a;
    color: #fff;
    line-height: 1;
}
.km-imp-title { display: flex; align-items: center; gap: 10px; }
.km-imp-title .km-imp-mark { width: 28px; height: 28px; border-radius: 6px; }
.km-imp-title .km-imp-mark svg { width: 16px; height: 16px; }
.km-imp-open {
    padding: 9px 16px;
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.km-imp-open:hover { background: #1d4ed8; }
.km-imp-open:focus-visible,
.km-imp-btn:focus-visible,
.km-imp-link:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }
.km-imp-entry-hint { color: #334155; }
.km-imp-entry-result {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 6px;
    color: #065f46;
    font-size: 13px;
    line-height: 1.5;
}
.km-imp-cnc { margin-top: 6px; padding: 8px 10px; border-radius: 6px; }
.km-imp-cnc-confirm { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.km-imp-cnc-estimate { background: #eff6ff; border: 1px solid #93c5fd; color: #1e3a8a; }

/* Overlay under <body>: a theme layout rule must not shrink it (same guard as the other overlays). */
.km-imp-overlay {
    position: fixed;
    inset: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.55);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.km-imp-overlay *, .km-imp-overlay *::before, .km-imp-overlay *::after { box-sizing: border-box; }
.km-imp-dialog {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 960px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    color: #1e293b;
    outline: none;
}
.km-imp-title { margin: 0 0 8px; font-size: 18px; }
.km-imp-h4 { margin: 16px 0 6px; font-size: 14px; }
.km-imp-help { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: #334155; }
.km-imp-dim { color: #64748b; font-size: 12px; }
.km-imp-error {
    display: none;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: #fee2e2;
    border: 1px solid #dc2626;
    border-radius: 6px;
    color: #991b1b;
    font-size: 13px;
}
.km-imp-note { margin: 10px 0; padding: 10px 12px; border-radius: 6px; font-size: 13px; line-height: 1.5; }
.km-imp-note ul { margin: 6px 0 0 18px; padding: 0; }
.km-imp-note-warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.km-imp-note-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.km-imp-note-cnc { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; }

.km-imp-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 0 0 12px; }
.km-imp-way { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; font-size: 13px; line-height: 1.5; }
.km-imp-way p { margin: 6px 0 0; color: #334155; }
.km-imp-way-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.km-imp-way-no {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: #1e3a8a; color: #fff; font-size: 11px; font-weight: 700;
}
.km-imp-way-main { border-color: #2563eb; background: #eff6ff; box-shadow: inset 3px 0 0 #2563eb; }
.km-imp-way-sub { padding-top: 6px; border-top: 1px dashed #e2e8f0; font-size: 12px; }

.km-imp-drop {
    padding: 22px 16px;
    text-align: center;
    border: 2px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
}
.km-imp-drop p { margin: 0 0 8px; }
.km-imp-drop-active { border-color: #2563eb; background: #eff6ff; }
.km-imp-drop-hint { font-size: 12px; color: #64748b; }
.km-imp-files, .km-imp-rejected, .km-imp-sources { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.km-imp-files li, .km-imp-sources li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #f1f5f9; }
.km-imp-sources li { display: block; }
.km-imp-file-name { font-weight: 600; word-break: break-all; }
.km-imp-file-size { color: #64748b; }
.km-imp-rejected li { color: #991b1b; padding: 2px 0; }

.km-imp-btn {
    padding: 8px 16px;
    background: #fff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}
.km-imp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.km-imp-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 600; }
.km-imp-link { background: none; border: 0; padding: 0; color: #1d4ed8; text-decoration: underline; cursor: pointer; font-size: 13px; }
.km-imp-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.km-imp-map-note { margin-right: auto; font-size: 12px; color: #92400e; }

.km-imp-bar { height: 12px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.km-imp-bar-fill { height: 100%; background: #2563eb; transition: width 0.2s; }
.km-imp-progress-text { margin: 8px 0 0; font-size: 13px; color: #334155; }

.km-imp-summary { padding: 8px 0; font-size: 15px; }
.km-imp-scroll { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 6px; max-height: 380px; overflow-y: auto; }
.km-imp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.km-imp-table th { position: sticky; top: 0; background: #f1f5f9; text-align: left; padding: 6px 8px; border-bottom: 1px solid #cbd5e1; white-space: nowrap; }
.km-imp-table td { padding: 5px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.km-imp-row-cnc td { background: #fff7ed; }
.km-imp-sample td, .km-imp-sample th { white-space: nowrap; }
.km-imp-table-box { margin: 0 0 14px; }
.km-imp-table-title { margin-bottom: 4px; }
.km-imp-map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 12px; margin-top: 10px; }
/* label text + the red "*" stay on one line (a column flex made the asterisk a separate row), the select takes the next row */
.km-imp-map-label { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 4px; row-gap: 3px; font-size: 12px; color: #334155; }
.km-imp-map-label .km-imp-map-select { flex: 1 0 100%; }
.km-imp-map-select, .km-imp-material-select { width: 100%; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; background: #fff; }
.km-imp-req { color: #dc2626; }
.km-imp-map-actions { margin: 4px 0 8px; }
.km-imp-materials { display: grid; gap: 8px; margin-top: 8px; }
.km-imp-material-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(200px, 2fr); gap: 10px; align-items: center; font-size: 13px; }

.km-imp-badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.km-imp-badge-std { background: #e2e8f0; color: #334155; }
.km-imp-badge-cnc { background: #ea580c; color: #fff; }
.km-imp-badge-ok { background: #dcfce7; color: #166534; }
.km-imp-badge-info { background: #dbeafe; color: #1e40af; }
.km-imp-badge-warn { background: #fef3c7; color: #92400e; }
.km-imp-badge-cad { background: #1e3a8a; color: #fff; }

@media (max-width: 600px) {
    .km-imp-dialog { padding: 14px; }
    .km-imp-material-row { grid-template-columns: 1fr; }
    .km-imp-actions .km-imp-btn { flex: 1 1 auto; }
    .km-imp-entry-box .km-imp-open { flex: 1 1 100%; }
}
