/**
 * GEP Poland - Mapa Realizacji
 * Style dla wyszukiwarki z mapą
 * Kolory: #0F172A (GEP navy blue), #1a1a1a (dark)
 * @version 1.0.0
 */

/* ==================== UKRYWANIE FILTROWANYCH ==================== */
.dzwigi-item-hidden {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ==================== WRAPPER ==================== */
.dzwigi-mapa-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==================== GÓRNY PANEL (tylko dla pełnej mapy) ==================== */
.dzwigi-panel {
    background: #0F172A; /* GEP navy */
    padding: 20px 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.dzwigi-panel__filters {
    display: flex;
    align-items: center; /* Wszystkie elementy na tej samej wysokości */
    gap: 15px;
    flex-wrap: wrap;
}

.dzwigi-panel__actions {
    display: flex;
    align-items: center; /* Wszystkie elementy na tej samej wysokości */
    gap: 20px;
}

/* ==================== FILTRY ==================== */
.dzwigi-filter {
    display: flex;
    flex-direction: row; /* Label i input obok siebie */
    align-items: center; /* Wyrównane do środka */
    gap: 10px;
}

.dzwigi-filter__label {
    font-size: 11px;
    font-weight: 600;
    color: #fff; /* Biały na navy */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0; /* Usunięte marginesy */
    white-space: nowrap; /* Nie łamie się */
}

.dzwigi-select,
.dzwigi-search-input {
    background: #fff !important; /* Białe tło */
    color: #0F172A !important; /* Navy text */
    border: 2px solid #fff !important;
    border-radius: 6px !important;
    padding: 10px 15px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: text !important;
    appearance: none;
    min-width: 250px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.dzwigi-search-input::placeholder {
    color: #999 !important;
}

.dzwigi-select:hover,
.dzwigi-search-input:hover {
    border-color: #FF8C42 !important; /* Żółty hover */
}

.dzwigi-select:focus,
.dzwigi-search-input:focus {
    outline: none !important;
    border-color: #FF8C42 !important;
    box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.2) !important;
}

/* ==================== PRZYCISKI ==================== */
.dzwigi-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.dzwigi-btn--reset {
    background: #FF8C42; /* Żółty */
    color: #0F172A; /* Navy text */
    border: 2px solid #FF8C42;
}

.dzwigi-btn--reset:hover {
    background: #ffd966;
    border-color: #ffd966;
    transform: translateY(-2px);
}

.dzwigi-btn--primary {
    background: #0F172A;
    color: #fff;
    padding: 12px 30px;
    font-size: 16px;
}

.dzwigi-btn--primary:hover {
    background: #2d3166;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(31, 34, 77, 0.3);
}

/* ==================== TOGGLE WIDOKU ==================== */
.dzwigi-toggle {
    display: flex;
    background: #2a2a2a;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.dzwigi-toggle__btn {
    padding: 10px 20px;
    background: transparent;
    color: #999;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.dzwigi-toggle__btn:hover {
    background: #333;
    color: #fff;
}

.dzwigi-toggle__btn--active {
    background: #0F172A;
    color: #fff;
}

/* ==================== LICZNIK ==================== */
.dzwigi-counter {
    background: #fff; /* Białe tło */
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #0F172A; /* Navy text */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.dzwigi-counter__number {
    color: #FF8C42; /* Żółty akcent */
    font-size: 18px;
    margin-left: 5px;
}
}

/* ==================== WIDOKI ==================== */
.dzwigi-view {
    display: none;
}

.dzwigi-view--active {
    display: block;
}

.dzwigi-view--lista {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    min-height: 300px;
}

.dzwigi-view--mapa {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ==================== LOADING ==================== */
.dzwigi-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dzwigi-view--mapa:not(.loading) .dzwigi-map-loading {
    display: none;
}

.dzwigi-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #0F172A;
    border-radius: 50%;
    animation: dzwigi-spin 1s linear infinite;
}

@keyframes dzwigi-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dzwigi-map-loading p {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* ==================== MARKERY ==================== */
.dzwigi-marker-container {
    position: relative;
    cursor: pointer;
}

.dzwigi-marker-pin {
    position: relative;
    z-index: 1;
}

.dzwigi-marker-label {
    position: absolute;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    min-width: 200px;
    max-width: 250px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: none;
}

.dzwigi-marker-container:hover .dzwigi-marker-label {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: all;
}

.dzwigi-marker-label__img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}

.dzwigi-marker-label__name {
    font-size: 14px;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 8px;
    line-height: 1.3;
}

.dzwigi-marker-label__miasto,
.dzwigi-marker-label__typ {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    line-height: 1.4;
}

.dzwigi-marker-label__btn {
    display: block;
    width: 100%;
    padding: 8px;
    background: #0F172A;
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.2s;
}

.dzwigi-marker-label__btn:hover {
    background: #2d3166;
    transform: translateY(-2px);
}

/* ==================== PROSTY MARKER (widget miasto) ==================== */
.dzwigi-marker-simple {
    width: 30px;
    height: 40px;
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: transform 0.2s;
}

.dzwigi-marker-simple:hover {
    transform: scale(1.1);
}

/* ==================== POPUP MAPBOX ==================== */
.mapboxgl-popup-content {
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.dzwigi-popup h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.dzwigi-popup p {
    font-size: 13px;
    color: #666;
    margin: 5px 0;
    line-height: 1.5;
}

.dzwigi-popup__link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 15px;
    background: #0F172A;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.dzwigi-popup__link:hover {
    background: #2d3166;
}

/* ==================== WIDGET MIASTO ==================== */
.dzwigi-miasto-header {
    text-align: center;
    margin-bottom: 25px;
}

.dzwigi-miasto-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 8px 0;
}

.dzwigi-miasto-header p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.dzwigi-miasto-footer {
    text-align: center;
    margin-top: 25px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .dzwigi-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 15px;
    }

    .dzwigi-panel__filters {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    /* Wyszukiwarka na samej górze */
    .dzwigi-filter {
        flex-direction: column;
        align-items: stretch;
        order: -1; /* Wyszukiwarka jako pierwsza */
    }

    .dzwigi-filter__label {
        margin-bottom: 5px;
    }

    /* Przyciski Reset i Licznik w jednej linii */
    .dzwigi-panel__actions {
        flex-direction: row;
        width: 100%;
        gap: 10px;
        justify-content: space-between;
    }

    .dzwigi-select,
    .dzwigi-search-input {
        width: 100%;
        min-width: auto;
    }

    .dzwigi-btn--reset {
        flex: 1;
        white-space: nowrap;
    }

    .dzwigi-counter {
        flex: 1;
        text-align: center;
        min-width: 120px;
    }

    /* Szerokość mapy na mobile */
    .dzwigi-mapa-container {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        height: 500px;
    }

    .dzwigi-marker-label {
        min-width: 180px;
        max-width: 200px;
    }

    .dzwigi-marker-label__img {
        height: 100px;
    }
}

/* ==================== MAPBOX OVERRIDES ==================== */

/* Popup - STAŁA wielkość (nie skaluje się z mapą) */
.mapboxgl-popup.dzwigi-popup-fixed .mapboxgl-popup-content {
    padding: 8px !important;
    width: 180px !important;
    max-width: 180px !important;
    font-size: 12px !important;
    box-sizing: border-box !important;
}

.mapboxgl-popup.dzwigi-popup-fixed .mapboxgl-popup-close-button {
    font-size: 16px;
    padding: 0;
    width: 20px;
    height: 20px;
    line-height: 20px;
    top: 2px;
    right: 2px;
    color: #999;
}

.mapboxgl-ctrl-bottom-right,
.mapboxgl-ctrl-bottom-left {
    bottom: 10px;
}

.mapboxgl-ctrl-group {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mapboxgl-ctrl-group button {
    width: 36px;
    height: 36px;
}

.mapboxgl-ctrl-group button:hover {
    background-color: #f5f5f5;
}

/* ==================== ERROR MESSAGE ==================== */
.dzwigi-error {
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

.dzwigi-error strong {
    font-weight: 700;
}

/* ==================== LISTING PLACEHOLDER ==================== */
.dzwigi-listing-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.dzwigi-listing-placeholder p {
    margin: 0;
    font-size: 14px;
}
