/* ===========================================================
   BAKK — Baza komorników sądowych
   Paleta: ciemny grafit + pomarańczowy akcent z logo BAKK
   =========================================================== */
:root {
    --c-bg: #fafbfc;
    --c-surface: #ffffff;
    --c-surface-alt: #f7f8fa;
    --c-border: #e1e4e8;
    --c-border-strong: #c9ced3;
    --c-text: #1f2328;
    --c-text-soft: #57606a;
    --c-muted: #8b949e;

    --c-primary: #2a2a2a;
    --c-primary-hov: #404040;

    --c-accent: #F39C12;
    --c-accent-dark: #E67E22;
    --c-accent-light: #F9B233;
    --c-accent-bg: #fff7e6;

    --c-link: #1366d6;

    --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.06);
    --shadow-md: 0 4px 12px rgba(31, 35, 40, 0.08), 0 1px 3px rgba(31, 35, 40, 0.05);
    --shadow-lg: 0 12px 32px rgba(31, 35, 40, 0.12), 0 2px 6px rgba(31, 35, 40, 0.06);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

.hidden { display: none !important; }
.dim { color: var(--c-muted); font-size: 13px; }

/* ============ WIDOK WYSZUKIWANIA ============ */
.view--search {
    max-width: 720px;
    margin: 0 auto;
    padding: 56px 24px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.search-header {
    text-align: center;
    margin-bottom: 28px;
}

.brand-block { margin-bottom: 28px; }
.brand-logo {
    height: 64px;
    margin-bottom: 18px;
}
.brand-title {
    font-size: 26px;
    font-weight: 500;
    margin: 0 0 6px;
    letter-spacing: -.01em;
    color: var(--c-primary);
}
.brand-tag {
    margin: 0;
    color: var(--c-text-soft);
    font-size: 14px;
}

/* Search input — Google-style pill */
.search-form { margin: 0; }
.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-pill);
    padding: 4px 6px 4px 18px;
    box-shadow: var(--shadow-sm);
    transition: all .18s ease;
}
.search-input-wrap:hover {
    border-color: var(--c-accent-light);
    box-shadow: var(--shadow-md);
}
.search-input-wrap:focus-within {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.18), var(--shadow-md);
}
.search-icon {
    color: var(--c-muted);
    flex-shrink: 0;
    margin-right: 10px;
}
#search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    padding: 12px 0;
    color: var(--c-text);
    font-family: inherit;
}
#search-input::placeholder { color: var(--c-muted); }
.search-clear {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--c-muted);
    font-size: 22px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
}
.search-clear:hover { background: var(--c-surface-alt); color: var(--c-text); }

.result-meta {
    margin-top: 14px;
    font-size: 13px;
    color: var(--c-muted);
    min-height: 18px;
}

/* Results */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.result-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    cursor: pointer;
    transition: all .15s ease;
    box-shadow: var(--shadow-sm);
}
.result-card:hover {
    border-color: var(--c-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.result-card__name {
    font-size: 18px;
    font-weight: 600;
    color: var(--c-primary);
    margin: 0 0 4px;
}
.result-card__name mark {
    background: var(--c-accent-bg);
    color: var(--c-text);
    padding: 0 2px;
    border-radius: 3px;
}
.result-card__sub {
    color: var(--c-text-soft);
    font-size: 14px;
    margin: 2px 0;
}
.result-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--c-muted);
}
.result-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
.result-card__meta span svg { color: var(--c-accent-dark); flex-shrink: 0; }

.empty-state {
    text-align: center;
    color: var(--c-text-soft);
    padding: 40px 0;
}
.empty-state p { margin: 4px 0; }

/* Footer search view */
.search-footer {
    margin-top: auto;
    padding-top: 28px;
    border-top: 1px solid var(--c-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.footer-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-quiet {
    background: none;
    border: none;
    color: var(--c-text-soft);
    font-family: inherit;
    font-size: 12.5px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    text-decoration: none;
}
.btn-quiet:hover { color: var(--c-accent-dark); background: var(--c-surface-alt); }
.btn-quiet:disabled { opacity: .5; cursor: default; }
.dot { color: var(--c-muted); font-size: 12px; }

/* ============ WIDOK SZCZEGÓŁOWY ============ */
.view--detail {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--c-border);
}
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--c-text-soft);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}
.back-btn:hover { background: var(--c-surface-alt); color: var(--c-primary); }
.detail-brand { height: 24px; opacity: .55; }

/* Hero komornika */
.detail-hero {
    background: linear-gradient(135deg, #2a2a2a 0%, #3d3d3d 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.detail-hero::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(243,156,18,0.25), transparent 70%);
    pointer-events: none;
}
.detail-hero__name {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 6px;
    letter-spacing: -.02em;
}
.detail-hero__nr {
    display: inline-block;
    background: var(--c-accent);
    color: #1f1f1f;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    margin-bottom: 12px;
}
.detail-hero__kancelaria {
    color: rgba(255,255,255,.85);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
    max-width: 700px;
}
.detail-hero__sad {
    color: rgba(255,255,255,.6);
    font-size: 13px;
}

/* Grid kart */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
}

.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}
.card--full { grid-column: 1 / -1; }

.card__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 700;
    color: var(--c-accent-dark);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--c-accent-bg);
}
.card__title svg { color: var(--c-accent); }

.kv-list {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 14px;
    font-size: 14px;
}
.kv-list dt {
    color: var(--c-muted);
    font-weight: 500;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding-top: 2px;
}
.kv-list dd { margin: 0; color: var(--c-text); }

.fact-block { margin: 0 0 12px; }
.fact-block:last-child { margin-bottom: 0; }
.fact-block .fact-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--c-muted);
    margin-bottom: 4px;
    font-weight: 600;
}
.fact-block .fact-value {
    font-size: 15px;
    color: var(--c-text);
    word-break: break-word;
}

.account-list, .contact-list { list-style: none; padding: 0; margin: 0; }
.account-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--c-border);
}
.account-list li:last-child { border-bottom: none; }
.account-list li:first-child { padding-top: 0; }
.account-bank {
    font-size: 12px;
    color: var(--c-muted);
    margin-bottom: 4px;
    font-weight: 500;
}
.account-number {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 15px;
    letter-spacing: .02em;
    color: var(--c-text);
    font-weight: 500;
}

.contact-list li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.contact-list li svg {
    flex-shrink: 0;
    color: var(--c-muted);
}
.contact-list a {
    color: var(--c-text);
    border-bottom: 1px dotted var(--c-border-strong);
}
.contact-list a:hover { color: var(--c-accent-dark); text-decoration: none; border-color: var(--c-accent); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--c-surface-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--c-text-soft);
}
.tag--accent {
    background: var(--c-accent-bg);
    color: var(--c-accent-dark);
    border-color: #f5d59c;
    font-weight: 500;
}
.tag--with-kod { cursor: help; padding-right: 6px; }
.tag--clickable {
    text-decoration: none;
    cursor: pointer;
    transition: all .15s ease;
}
.tag--clickable:hover {
    background: var(--c-accent);
    color: #fff;
    border-color: var(--c-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}
.tag--clickable:hover .tag-kod {
    background: rgba(255,255,255,.25);
    color: #fff;
}
.tag--clickable:hover .tag-kod-more { color: rgba(255,255,255,.85); }
.tag-kod {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: rgba(0,0,0,.05);
    border-radius: 3px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--c-text-soft);
    font-weight: 500;
}
.tag--accent .tag-kod { background: rgba(230,126,34,.15); color: var(--c-accent-dark); }
.tag-kod-more {
    display: inline-block;
    margin-left: 2px;
    font-size: 10px;
    color: var(--c-muted);
    font-weight: 600;
}

.rewir-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--c-text);
    background: var(--c-surface-alt);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--c-accent);
    margin-bottom: 14px;
}

/* Embed mapy Google w karcie rewir */
.rewir-map-wrap {
    margin-bottom: 18px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--c-surface-alt);
}
.rewir-map-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: var(--c-surface-alt);
    border-bottom: 1px solid var(--c-border);
    font-size: 12px;
}
.rewir-map-head .dim { display: inline-flex; align-items: center; gap: 6px; }
.map-open-link {
    color: var(--c-link);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}
.map-open-link:hover { color: var(--c-accent-dark); }
.rewir-map {
    display: block;
    width: 100%;
    height: 420px;
    border: 0;
    background: #f0f3f7;
    position: relative;
    z-index: 0;
}
.rewir-map-head .map-legend {
    flex: 1;
    text-align: center;
    font-family: ui-monospace, monospace;
    font-size: 11px;
}
.leaflet-tooltip {
    background: #fff;
    color: var(--c-text);
    border: 1px solid var(--c-border-strong);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 12px;
}

.electronic-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--c-surface-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin: 4px 6px 4px 0;
    font-size: 13px;
}
.electronic-pill__type {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: var(--c-primary);
    color: #fff;
    padding: 2px 7px;
    border-radius: 3px;
}
.electronic-pill__value {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--c-text);
}

.no-data { color: var(--c-muted); font-style: italic; font-size: 13px; }

/* Loading */
.loading-bar {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--c-accent) 50%, transparent);
    background-size: 200% 100%;
    animation: loadShift 1.2s linear infinite;
    margin-top: 12px;
    border-radius: 2px;
}
@keyframes loadShift {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

@media (max-width: 600px) {
    .view--search { padding: 32px 16px; }
    .view--detail { padding: 16px; }
    .detail-hero { padding: 22px 20px; }
    .detail-hero__name { font-size: 24px; }
    .detail-grid { grid-template-columns: 1fr; }
    .kv-list { grid-template-columns: 1fr; gap: 2px 0; }
    .kv-list dt { padding-top: 8px; }
}
