/* --------------------------------------------------------------------------
   Vizuál nadväzuje na PNPP (AdminLTE, skin-purple): fialová hlavička,
   svetlosivé pozadie, biele boxy s farebným pruhom navrchu.
   -------------------------------------------------------------------------- */
:root {
    --purple: #605ca8;
    --purple-dark: #555299;
    --purple-light: #7b77c4;
    --link-hover: #932ab6;
    --bg: #ecf0f5;
    --text: #333;
    --muted: #8a8f99;
    --border: #d2d6de;
    --green: #00a65a;
    --red: #dd4b39;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--purple); text-decoration: none; }
a:hover { color: var(--link-hover); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 15px; }

/* ---------- hlavička ---------- */
.main-header {
    background: var(--purple);
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

.main-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--purple-dark);
    color: #fff;
    padding: 8px 18px;
    min-height: 56px;
}

.logo-mark { width: 40px; height: 40px; flex: 0 0 40px; }

.logo-text { font-size: 12px; font-weight: 600; letter-spacing: .6px; line-height: 1.25; text-transform: uppercase; }

.main-nav { display: flex; flex: 1; }
.main-nav a {
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: rgba(255, 255, 255, .85);
    font-size: 14px;
    border-bottom: 3px solid transparent;
}
.main-nav a:hover { background: var(--purple-dark); color: #fff; }
.main-nav a.active { background: var(--purple-dark); color: #fff; border-bottom-color: #fff; }

.nav-logout {
    display: flex;
    align-items: center;
    padding: 0 20px;
    color: rgba(255, 255, 255, .75);
    font-size: 13px;
}
.nav-logout:hover { background: var(--purple-dark); color: #fff; }

.nav-role {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .2);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ---------- prihlásenie (prevzaté z PNPP) ---------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: #092756;
    background:
        radial-gradient(ellipse at 0% 100%, rgba(104, 128, 138, .4) 10%, rgba(138, 114, 76, 0) 40%),
        linear-gradient(to bottom, rgba(57, 173, 219, .25) 0%, rgba(42, 60, 87, .4) 100%),
        linear-gradient(135deg, #670d10 0%, #092756 100%);
}

.login { width: 400px; max-width: 100%; text-align: center; }

.login-logo {
    margin: 0 0 18px;
    animation: fadeInDown .7s both .2s;
}
.login-logo img {
    width: 104px;
    height: 104px;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: none; }
}

.login h1 {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, .3);
    letter-spacing: 1px;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.3;
    margin: 0 0 26px;
}

.login-form .form-group { margin-bottom: 10px; }

.login-page input[type="password"] {
    width: 100%;
    padding: 11px;
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(0, 0, 0, .3);
    border-radius: 4px;
    outline: none;
    font-size: 14px;
    color: #fff;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, .3);
    box-shadow: inset 0 -5px 45px rgba(100, 100, 100, .2), 0 1px 1px rgba(255, 255, 255, .2);
    transition: box-shadow .5s ease;
}
.login-page input[type="password"]::placeholder { color: rgba(255, 255, 255, .6); }
.login-page input[type="password"]:focus {
    border-color: rgba(0, 0, 0, .3);
    box-shadow: inset 0 -5px 45px rgba(100, 100, 100, .4), 0 1px 1px rgba(255, 255, 255, .2);
}

.btn-login {
    display: block;
    width: 100%;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 15px;
    color: #fff;
    cursor: pointer;
    border: 1px solid #3762bc;
    border-radius: 5px;
    background-color: #4a77d4;
    background-image: linear-gradient(to bottom, #6eb6de, #4a77d4);
    text-shadow: 1px 1px 1px rgba(0, 0, 0, .4);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .5);
}
.btn-login:hover { background-image: none; background-color: #4a77d4; }

.login-error {
    background: rgba(221, 75, 57, .9);
    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: 4px;
    color: #fff;
    font-size: 13px;
    padding: 9px 12px;
    margin-bottom: 12px;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, .3);
}

/* ---------- obsah ---------- */
.content-wrapper { padding: 20px 0 40px; min-height: calc(100vh - 56px - 50px); }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 300; margin: 0; }
.page-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col { flex: 1 1 420px; min-width: 320px; }

.box {
    background: #fff;
    border-top: 3px solid var(--purple);
    border-radius: 3px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
    margin-bottom: 20px;
}
.box-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.box-header h2 { font-size: 16px; font-weight: 600; margin: 0; }
.box-body { padding: 16px; }
.box-footer { padding: 12px 16px; border-top: 1px solid #f4f4f4; background: #fafafa; }

/* ---------- formuláre ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.form-group label .opt { font-weight: 400; color: var(--muted); }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 2px rgba(96, 92, 168, .15); }
.input-error { border-color: var(--red) !important; }
.help-error { color: var(--red); font-size: 12px; margin-top: 4px; }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }

.qty-row { display: flex; align-items: center; gap: 8px; }
.qty-row input { flex: 1; }
.qty-unit { color: var(--muted); font-weight: 600; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.checkbox-row input { width: auto; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 2px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    background: #f4f4f4;
    color: var(--text);
    border-color: var(--border);
}
.btn:hover { background: #e7e7e7; color: var(--text); }
.btn-primary { background: var(--purple); border-color: var(--purple-dark); color: #fff; }
.btn-primary:hover { background: var(--purple-dark); color: #fff; }
.btn-danger { background: var(--red); border-color: #d33724; color: #fff; }
.btn-danger:hover { background: #d33724; color: #fff; }
.btn-block { width: 100%; justify-content: center; }

.alert-error {
    background: #fdf0ef;
    border: 1px solid #f0c1bb;
    color: #a94442;
    padding: 10px 14px;
    border-radius: 2px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* ---------- predvoľby zo zadania ---------- */
.preset-list { display: flex; flex-direction: column; gap: 6px; }
.preset {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
}
.preset:hover { border-color: var(--purple); background: #f7f7fc; }
.preset .preset-code { font-weight: 700; font-family: "SFMono-Regular", Menlo, Consolas, monospace; color: var(--purple); }
.preset .preset-flow { color: var(--muted); font-size: 12px; }

/* ---------- štítok ---------- */
.label-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }

.label-sheet {
    width: 100mm;
    height: 70mm;
    max-width: 100%;
    background: #fff;
    border: 1px solid #999;
    padding: 4mm;
    display: flex;
    flex-direction: column;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
    margin: 0 auto;
}

.label-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1.5px solid #000;
    padding-bottom: 1.5mm;
}
.label-kind { font-size: 11pt; font-weight: 700; letter-spacing: .5px; }
.label-date { font-size: 8pt; }

.label-main { display: flex; gap: 3mm; flex: 1; padding-top: 2mm; min-height: 0; }
.label-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.label-code { font-size: 16pt; font-weight: 700; line-height: 1.05; letter-spacing: .5px; }
.label-name { font-size: 10pt; font-weight: 700; text-transform: uppercase; line-height: 1.15; margin-top: .5mm; }
.label-type { font-size: 7.5pt; color: #444; }
.label-qty { font-size: 13pt; font-weight: 700; margin-top: 1mm; }

.label-fields { margin-top: auto; font-size: 8pt; }
.label-fields div { display: flex; gap: 1.5mm; line-height: 1.35; }
.label-fields span.k { font-weight: 700; min-width: 20mm; }
.label-fields span.v { flex: 1; }

.label-qr { width: 26mm; flex: 0 0 26mm; text-align: center; }
.label-qr svg { width: 26mm; height: 26mm; display: block; }
.label-qr .qr-caption { font-size: 6pt; color: #444; margin-top: .5mm; word-break: break-all; }

.label-barcode { border-top: 1px solid #000; margin-top: 1.5mm; padding-top: 1mm; text-align: center; }
.label-barcode svg { width: 100%; height: 12mm; display: block; }
.label-barcode .barcode-text {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 9pt;
    letter-spacing: 3px;
    margin-top: .5mm;
}

.payload-preview {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12px;
    background: #f7f7f9;
    border: 1px solid #eee;
    border-radius: 2px;
    padding: 8px 10px;
    word-break: break-all;
    color: #444;
}

/* ---------- načítanie ---------- */
.scan-input {
    width: 100%;
    min-height: 220px;
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
}

.scan-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
    flex: 1 1 150px;
    background: #fff;
    border-left: 4px solid var(--purple);
    border-radius: 2px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
    padding: 10px 14px;
}
.stat .stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat .stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.scan-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.scan-table th, .scan-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; text-align: left; vertical-align: top; }
.scan-table th { background: #fafafa; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.scan-table tbody tr:first-child td { background: #f7f7fc; }
.scan-table .cell-code { font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 700; color: var(--purple); white-space: nowrap; }
.scan-table .cell-detail { color: #555; font-size: 12px; }
.scan-table .cell-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    color: #fff;
    background: var(--muted);
}
.tag-presun { background: var(--purple); }
.tag-expedicia { background: var(--green); }
.tag-polozka { background: #3c8dbc; }
.tag-neznamy { background: var(--red); }

.empty-state { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13px; }

/* ---------- pätička ---------- */
.main-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 15px 0;
    color: var(--muted);
    font-size: 12px;
}

/* ---------- hárok A4 s čiarovými kódmi ---------- */
.sheet-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}
.sheet-toolbar .form-group { min-width: 150px; }

.sheet {
    width: 210mm;
    max-width: 100%;
    min-height: 297mm;
    margin: 0 auto;
    padding: 10mm;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
}

.sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid #000;
    padding-bottom: 2mm;
    margin-bottom: 4mm;
}
.sheet-head .sheet-title { font-size: 11pt; font-weight: 700; letter-spacing: .5px; }
.sheet-head .sheet-note { font-size: 8pt; color: #444; }

.code-grid { display: grid; grid-template-columns: repeat(3, 1fr); }

.code-cell {
    border: 1px dashed #b0b0b0;
    margin: -0.5px 0 0 -0.5px;   /* zdvojené čiary mriežky na seba */
    padding: 3mm 2mm;
    height: 38mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    break-inside: avoid;
    page-break-inside: avoid;
}

.code-cell .c-code { font-size: 12pt; font-weight: 700; letter-spacing: .5px; }
.code-cell .c-name { font-size: 8pt; line-height: 1.2; margin-top: .5mm; }
.code-cell .c-type { font-size: 7pt; color: #555; }

.code-cell .c-codes { display: flex; align-items: center; justify-content: center; gap: 2mm; width: 100%; margin-top: 2mm; }
.code-cell .c-barcode { flex: 1; min-width: 0; }
.code-cell .c-barcode svg { width: 100%; height: 12mm; display: block; }

.code-cell .c-text {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 8pt;
    letter-spacing: 2px;
    margin-top: .5mm;
}
