/* =========================================================
   Mapa Realizacji — styles
   Element 1: SVG mapa Polski
   Element 2: Podstrona województwa (Google Maps + lista)
   Element 3: Filtr województw na /realizacje/
   ========================================================= */

/* ─────────────────────────────────────────────
   Sekcja liczników
───────────────────────────────────────────── */

.map-liczniki-section {
    padding: 0 0 2.5rem;
}

.map-liczniki-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem 4rem;
}

.map-licznik {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
}

.map-licznik__icon {
    flex-shrink: 0;
    align-self: flex-start;
}

.map-licznik__icon img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.map-licznik__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.map-licznik__number {
    display: flex;
    align-items: baseline;
    gap: 2px;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.map-licznik__value {
    font-size: 3rem;
    font-weight: 700;
    color: #111;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.map-licznik__prefix {
    font-size: 2rem;
    font-weight: 700;
    color: #111;
    line-height: 1;
}

.map-licznik__label {
    font-size: 1rem;
    font-weight: 700;
    color: #111;
}

.map-licznik__label sup {
    font-size: 0.65em;
}

/* ─────────────────────────────────────────────
   Shared / page wrapper
───────────────────────────────────────────── */
.mapa-realizacji-page {
    background: #fff;
}

/* Tło strony mapa realizacji z gradientem od góry */
.cobouw-map-polska #main {
    background-image:
        linear-gradient(to bottom, #ffffff 0%, rgba(255,255,255,0) 50%),
        url(/wp-content/themes/cobouw/assets/img/mapa-background.jpg);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* ─────────────────────────────────────────────
   ELEMENT 1 — SVG mapa Polski
───────────────────────────────────────────── */
.svg-mapa-section {
    padding: 60px 0;
}

.svg-mapa-section .section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.svg-mapa-section .section-subtitle {
    color: #666;
    margin-bottom: 2.5rem;
}

.svg-mapa-wrapper {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.svg-mapa-wrapper svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Województwa */
.mapsvg-region:focus {
    outline: none;
}

.mapsvg-region {
    fill: #ff4200;
    stroke: #fff;
    stroke-width: 3px;
    paint-order: stroke fill;
    transition: fill 0.2s ease;
    cursor: pointer;
}

.mapsvg-region:hover,
.mapsvg-region.is-hovered {
    fill: #e03a00;
}

.mapsvg-region.has-realizations {
    fill: #ff4200;
}

.mapsvg-region.has-realizations:hover {
    fill: #e03a00;
}

.mapsvg-region.no-realizations {
    fill: #c8d4e0;
    cursor: default;
}

/* Tooltip */
#map-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    background: #1a1a1a;
    color: #fff;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

#map-tooltip.is-visible {
    opacity: 1;
}

#map-tooltip strong {
    color: #f57c00;
}

/* Lista województw (mobile fallback) */
.woj-list-mobile {
    display: none;
    margin-top: 2rem;
}

.woj-list-mobile .list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
    color: inherit;
}

.woj-list-mobile .list-group-item:hover {
    border-left-color: #f57c00;
    background: #fff8f2;
}

.woj-list-mobile .badge-count {
    background: #f57c00;
    color: #fff;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    .woj-list-mobile {
        display: none;
    }
    .svg-mapa-section {
        padding: 40px 0;
    }
}

/* ─────────────────────────────────────────────
   ELEMENT 2 — Strona województwa
───────────────────────────────────────────── */
.woj-header {
    padding: 48px 0 32px;
    border-bottom: 1px solid #eee;
    margin-bottom: 0;
}

.woj-header__breadcrumb {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.75rem;
}

.woj-header__breadcrumb a {
    color: #f57c00;
    text-decoration: none;
}

.woj-header__breadcrumb a:hover {
    text-decoration: underline;
}

.woj-header__title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.woj-header__count {
    color: #666;
    font-size: 1rem;
}

.woj-header__count strong {
    color: #f57c00;
}

/* Google Maps container */
.woj-map-section {
    padding: 0;
}

#woj-google-map {
    width: 100%;
    height: 480px;
    background: #eef1f4;
}


@media (max-width: 768px) {
    #woj-google-map {
        height: 320px;
    }
}

/* Custom InfoWindow / popup */
.map-popup {
    display: flex;
    flex-direction: column;
    width: 240px;
    font-family: inherit;
}

.map-popup__image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 4px 4px 0 0;
    background: #eee;
    margin: -12px -12px 0;
    width: calc(100% + 24px);
}

.map-popup__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-popup__content {
    padding-top: 10px;
}

.map-popup__title {
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0 0 5px;
    line-height: 1.35;
    color: #111;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.map-popup__meta {
    font-size: 0.76rem;
    color: #888;
    margin: 0 0 10px;
    line-height: 1.4;
}

.map-popup__link {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ff4200;
    text-decoration: none;
}

.map-popup__link:hover {
    text-decoration: underline;
}

/* ── Google Maps InfoWindow ── */

/* Kontener — overflow visible żeby przycisk mógł wyjść poza narożnik */
.gm-style .gm-style-iw-c {
    border-radius: 8px !important;
    padding: 12px !important;
    overflow: visible !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18) !important;
}

/* Obszar treści — bez dodatkowego paddingu */
.gm-style .gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
}

/* Wiersz nagłówka z przyciskiem — wyjmujemy z flow i wyciągamy poza narożnik */
.gm-style .gm-style-iw-c .gm-style-iw-chr {
    position: absolute !important;
    top: -11px !important;
    right: -11px !important;
    height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Pusty div tytułu — ukryty */
.gm-style .gm-style-iw-c .gm-style-iw-ch {
    display: none !important;
}

/* Przycisk X — mały okrąg */
.gm-style .gm-style-iw-c .gm-style-iw-chr button.gm-ui-hover-effect {
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
    transition: background 0.15s !important;
}

.gm-style .gm-style-iw-c .gm-style-iw-chr button.gm-ui-hover-effect:hover {
    background: #f2f2f2 !important;
}

/* Ikona X (span z mask-image) — czarna */
.gm-style .gm-style-iw-c .gm-style-iw-chr button.gm-ui-hover-effect span {
    width: 14px !important;
    height: 14px !important;
    margin: 0 !important;
    background-color: #111 !important;
}

/* Lista realizacji pod mapą */
.woj-list-section {
    padding: 48px 0;
}

.woj-list-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.woj-list-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.woj-realizacje-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 576px) {
    .woj-realizacje-grid {
        grid-template-columns: 1fr;
    }
}

/* Karta w widoku województwa (kompaktowa) */
.woj-realizacje-grid .realizacja-card__media {
    aspect-ratio: 4/3;
}

/* Paginacja AJAX */
.woj-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.woj-pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.woj-pagination .page-btn:hover,
.woj-pagination .page-btn.is-active {
    background: #f57c00;
    border-color: #f57c00;
    color: #fff;
}

.woj-pagination .page-btn.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Loading overlay */
.woj-list-loading {
    display: none;
    text-align: center;
    padding: 3rem;
    color: #888;
}

.woj-list-loading.is-active {
    display: block;
}

/* ─────────────────────────────────────────────
   ELEMENT 3 — Nagłówek + centrum wyszukiwania na /realizacje/
───────────────────────────────────────────── */

/* Breadcrumbs */
.realizacje-breadcrumbs {
    font-size: 0.8rem;
    color: #bbb;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.realizacje-breadcrumbs a {
    color: #bbb;
    text-decoration: none;
}

.realizacje-breadcrumbs a:hover {
    color: #888;
    text-decoration: underline;
}

/* Nagłówek H1 + przycisk toggle */
.realizacje-archive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.realizacje-archive-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

/* Przycisk toggle wyszukiwarki */
.realizacje-search-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid #dde2e8;
    border-radius: 20px;
    background: #fff;
    color: #555;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.realizacje-search-toggle:hover,
.realizacje-search-toggle.is-active {
    border-color: #ff4200;
    color: #ff4200;
    background: #fff3f0;
}

/* Boks wyszukiwania */
.realizacje-search-box {
    margin-bottom: 1rem;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 15px;
    font-size: 0.85rem;
    background: transparent;
}

.realizacje-search-box__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 14px;
    color: #222;
}

.realizacje-search-box__form {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.realizacje-search-box__left {
    flex: 1 1 260px;
    min-width: 200px;
}

.realizacje-search-box__right {
    flex: 1 1 220px;
    min-width: 180px;
}

/* input-group wewnątrz boksa — zawsze w jednej linii */
.realizacje-search-box .input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

/* Input i select — rozciągają się, nie wypychają sąsiadów */
.realizacje-search-box .input-group .form-control,
.realizacje-search-box .input-group .filter-woj-select {
    flex: 1 1 auto;
    width: 1%;          /* Bootstrap trick — pozwala flex działać poprawnie */
    min-width: 0;
    border: 1px solid #dde2e8;
    padding: 9px 14px;
    font-size: 0.9rem;
    color: #333;
    background: #fff;
    transition: border-color 0.15s;
    box-shadow: none;
}

.realizacje-search-box .input-group .form-control:focus,
.realizacje-search-box .input-group .filter-woj-select:focus {
    outline: none;
    border-color: #ff4200;
    box-shadow: 0 0 0 2px rgba(255,66,0,0.12);
    z-index: 1;
}

/* Input zaokrąglony tylko po lewej */
.realizacje-search-box .realizacje-search-input {
    border-radius: 4px 0 0 4px !important;
    border-right: none;
}

/* Select — zaokrąglony po lewej; gdy reset ukryty, całkowicie zaokrąglony */
.realizacje-search-box .input-group .filter-woj-select {
    border-radius: 4px 0 0 4px !important;
    border-right: 1px solid #dde2e8;
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-color: #fff !important;
    padding-right: 34px;
    cursor: pointer;
}

/* Przycisk szukaj (lupa) */
.realizacje-search-btn {
    flex-shrink: 0;
    border-radius: 0 4px 4px 0 !important;
    border: 1px solid #ff4200;
    background: #ff4200;
    color: #fff;
    padding: 0 16px;
    font-size: 0.9rem;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.15s;
}

.realizacje-search-btn:hover {
    background: #cc3500;
    border-color: #cc3500;
    color: #fff;
}

/* Przycisk reset (×) — inline po prawej stronie selecta, wewnątrz .input-group */
.filter-reset-btn {
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #dde2e8;
    border-left: none;
    border-radius: 0 4px 4px 0 !important;
    color: #888;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 12px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
}

.filter-reset-btn:hover {
    color: #ff4200;
    border-color: #ff4200;
}

.filter-reset-btn.is-hidden {
    display: none;
}

/* Gdy reset ukryty — select ma pełne zaokrąglenie */
.filter-reset-btn.is-hidden ~ * { display: none; } /* pomocnicza — nie używana */
.realizacje-search-box__right .input-group:has(.filter-reset-btn.is-hidden) .filter-woj-select {
    border-radius: 4px !important;
    border-right: 1px solid #dde2e8;
}

/* Results count */
.realizacje-results-count {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
}

.realizacje-results-count strong {
    color: #333;
}

/* AJAX spinner */
.realizacje-list-wrapper {
    position: relative;
    min-height: 200px;
}

.realizacje-ajax-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.realizacje-ajax-loading.is-active {
    opacity: 1;
    pointer-events: all;
}

.realizacje-ajax-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #f57c00;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ─────────────────────────────────────────────
   MarkerClusterer custom colors
───────────────────────────────────────────── */
.cluster-icon {
    background: #f57c00;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(245,124,0,0.5);
}

/* ─────────────────────────────────────────────
   Element 4: Mapa na pojedynczej realizacji
───────────────────────────────────────────── */

.realizacja-map-box {
    background: #f3f3f3;
    border-radius: 20px;
    padding: 20px;
}

.realizacja-map-fullwidth {
    background: #f3f3f3;
    border-radius: 20px;
    padding: 20px;
}

.realizacja-map-box__label {
    font-size: 0.875em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
    margin-bottom: 12px;
}

.realizacja-map-box__map {
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
}

/* Popup na mapie pojedynczej realizacji */
.map-single-popup {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 260px;
    padding: 2px 0;
}

.map-single-popup__img {
    flex: 0 0 90px;
    width: 90px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
}

.map-single-popup__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-single-popup__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-single-popup__title {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: #1c1c1c;
}

.map-single-popup__route {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ff4200;
    text-decoration: none;
    transition: color 0.2s;
}

.map-single-popup__route:hover {
    color: #cc3400;
}
