:root {
    --bg: #0f2747;
    --bg-accent: #16345d;
    --panel: #ffffff;
    --panel-soft: #f7f9fc;
    --border: #d6e0eb;
    --text: #1d2a36;
    --muted: #5a6b7d;
    --primary: #0b5cab;
    --primary-dark: #084781;
    --primary-light: #e9f1fb;
    --badge: #edf4fd;
    --shadow: 0 10px 30px rgba(8, 33, 63, 0.12);
    --shadow-soft: 0 6px 18px rgba(8, 33, 63, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    /*background: linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);*/
    background: var(--bg);
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 16px 40px;
}

.page-header {
    margin-bottom: 24px;
    padding: 28px 30px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(4px);
}

.page-header h1 {
    margin: 0 0 10px;
    font-size: 2.1rem;
    line-height: 1.2;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.lead {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.02rem;
    max-width: 860px;
}

.search-panel,
.results-header,
.result-card,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-soft);
}

.search-panel {
    margin-bottom: 24px;
    background:
        linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
    border-color: #d8e3ef;
    box-shadow: var(--shadow);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field-wide {
    grid-column: span 4;
}

label {
    margin-bottom: 6px;
    font-weight: 700;
    color: #213548;
    font-size: 0.96rem;
}

input[type="text"],
select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #bccbdd;
    border-radius: 10px;
    font-size: 1rem;
    background: #ffffff;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[type="text"]:focus,
select:focus,
.pagination-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(11, 92, 171, 0.14);
    background: #fff;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 11px 18px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(180deg, #0f67c0 0%, #0b5cab 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(11, 92, 171, 0.24);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #0d5aa6 0%, #084781 100%);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    border-color: #b8c9da;
    background: #f8fbfe;
}

.results-header {
    margin-bottom: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.results-header h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    color: #18314c;
}

.results-header p {
    margin: 0;
    color: var(--muted);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.result-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: linear-gradient(180deg, #0b5cab 0%, #084781 100%);
}

.result-card:hover {
    /*transform: translateY(-2px);*/
    box-shadow: 0 14px 30px rgba(8, 33, 63, 0.14);
    border-color: #c6d7e8;
}

.result-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.result-card-top h3 {
    margin: 0;
    font-size: 1.22rem;
    line-height: 1.3;
    color: #18314c;
    padding-right: 10px;
}

.badge {
    display: inline-block;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--badge);
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 700;
    border: 1px solid #cfe0f5;
}

.result-meta p {
    margin: 6px 0;
    color: #314557;
}

.result-meta span,
.opis > span {
    font-weight: 700;
    color: #1d3144;
}

.opis {
    margin-top: 10px;
}

.opis p {
    margin: 6px 0 0;
    color: #2e4355;
}

.empty-state {
    text-align: center;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    text-decoration: none;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: fit-content;
    box-shadow: var(--shadow-soft);
}

.pagination-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 1.5rem;
    line-height: 1;
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--border);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.pagination-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.pagination-btn-disabled {
    color: #98a4b3;
    background: #f1f4f7;
    border-color: #dde5ec;
    cursor: default;
    transform: none;
}

.pagination-input {
    width: 84px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #bcc8d4;
    border-radius: 10px;
    font-size: 1rem;
    text-align: center;
    background: #fff;
}

.pagination-total {
    color: var(--muted);
    font-size: 1rem;
    white-space: nowrap;
}

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

@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-field-wide {
        grid-column: span 2;
    }

    .page-header {
        padding: 24px 22px;
    }

    .page-header h1 {
        font-size: 1.85rem;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 18px 12px 32px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field-wide {
        grid-column: span 1;
    }

    .result-card-top {
        flex-direction: column;
    }

    .page-header {
        border-radius: 18px;
    }

    .page-header h1 {
        font-size: 1.55rem;
    }

    .pagination-compact {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .pagination-form {
        justify-content: center;
    }
}

/* CSS do wydruku dopasowany do obecnego układu */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    :root {
        --bg: #ffffff;
        --panel: #ffffff;
        --border: #999999;
        --text: #000000;
        --muted: #333333;
        --primary: #000000;
        --primary-dark: #000000;
        --badge: #ffffff;
    }

    html,
    body {
        margin: 0;
        padding: 0;
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt;
        line-height: 1.35;
        font-family: Arial, Helvetica, sans-serif;
    }

    * {
        box-shadow: none !important;
        text-shadow: none !important;
        background-image: none !important;
    }

    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .container {
        max-width: none;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .search-panel,
    .pagination,
    .pagination-compact,
    .form-actions,
    .btn,
    .visually-hidden {
        display: none !important;
    }

    .page-header {
        margin: 0 0 10mm 0;
        padding: 0 0 4mm 0;
        border-bottom: 1px solid #000;
        border-radius: 0;
        background: transparent !important;
        box-shadow: none !important;
    }

    .page-header h1 {
        margin: 0 0 3mm 0;
        font-size: 18pt;
        line-height: 1.2;
        color: #000 !important;
    }

    .lead {
        margin: 0;
        color: #333 !important;
        font-size: 10.5pt;
    }

    .results-header {
        margin: 0 0 6mm 0;
        padding: 0;
        border: 0;
        background: transparent !important;
        border-radius: 0;
    }

    .results-header h2 {
        margin: 0 0 2mm 0;
        font-size: 13pt;
        color: #000;
    }

    .results-header p {
        margin: 0;
        font-size: 10.5pt;
        color: #333;
    }

    .results-list {
        display: block;
        gap: 0;
    }

    .result-card {
        display: block;
        margin: 0 0 6mm 0;
        padding: 0 0 4mm 0;
        background: transparent !important;
        border: 0;
        border-bottom: 1px solid #b5b5b5;
        border-radius: 0;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .result-card::before {
        display: none !important;
    }

    .result-card:last-child {
        margin-bottom: 0;
        border-bottom: 0;
    }

    .result-card-top {
        display: block;
        margin: 0 0 3mm 0;
    }

    .result-card-top h3 {
        margin: 0 0 2mm 0;
        font-size: 12.5pt;
        line-height: 1.25;
        color: #000;
    }

    .badge {
        display: none !important;
    }

    .result-meta {
        font-size: 10pt;
    }

    .result-meta p {
        margin: 0 0 1.5mm 0;
        color: #000;
    }

    .result-meta span,
    .opis > span {
        font-weight: 700;
        color: #000;
    }

    .opis {
        margin-top: 2mm;
    }

    .opis p {
        margin: 1mm 0 0 0;
        color: #000;
        white-space: pre-line;
    }

    a,
    a:visited {
        color: #000 !important;
        text-decoration: none !important;
    }

    input,
    select,
    textarea,
    button {
        display: none !important;
    }

    .empty-state {
        padding: 0;
        border: 0;
        background: transparent !important;
        text-align: left;
        font-size: 11pt;
    }
}
