/* ------------------------------------------------------
   OVERRIDE: LEAFLET DEFAULT POPUP STİLLERİNİ GEÇERSİZ KIL
------------------------------------------------------ */

/* Harita Wrapper - Full Width */
#ihtiyac-harita-wrapper {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

#ihtiyac-harita-wrapper #map,
#map {
    width: 100%;
    height: 500px;
    position: relative;
}

/* Leaflet popup container tamamen sıfırla */
.leaflet-popup-content-wrapper {
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    line-height: normal !important;
}

/* Popup altındaki üçgen ucu */
.leaflet-popup-tip {
    background: #c8483a !important;
    box-shadow: none !important;
    width: 18px !important;
    height: 18px !important;
}

/* Popup kapatma butonu override */
.leaflet-container a.leaflet-popup-close-button {
    background: #c8483a !important;
    color: #fff !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    font-size: 18px !important;
    margin: -10px -10px 0 0 !important;
    padding: 0 !important;
    line-height: 28px !important;
    text-align: center !important;
}

/* ------------------------------------------------------
   CUSTOM POPUP CARD (GRADIENT TASARIM)
------------------------------------------------------ */

.popup-card {
    width: 260px;
    padding: 18px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(180deg, #df5f4e 0%, #c8483a 100%);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    font-family: Poppins;
}

.popup-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
    color: #fff;
}

.popup-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #FFFFFF;
}

.popup-location {
    font-size: .9rem;
    opacity: .9;
    margin-bottom: 12px;
}

.popup-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
    font-size: .85rem;
}

.popup-btn {
    display: block;
    padding: 10px;
    text-align: center;
    background: #ffffff22;
    border-radius: 8px;
    border: 1px solid #ffffff55;
    color: #fff !important;
    font-weight: 600;
    text-decoration: none;
}

/* ------------------------------------------------------
   FİLTRELEME PANELİ
------------------------------------------------------ */

/* Filtre Toggle Butonu */
.filter-toggle-btn {
    position: absolute;
    top: 10px;
    left: 55px;
    z-index: 1000;
    width: 320px;
    background: #F8F8F9;
    color: #000;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    /*box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);*/
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.filter-toggle-btn:hover {
    background: #233E7D;
    color: #fff;
}

.filter-toggle-btn i {
    font-size: 16px;
}

/* Filtreleme Paneli */
.filter-panel {
    position: absolute;
    top: 10px;
    left: 55px;
    z-index: 1001;
    width: 320px;
    max-height: 90vh;
    background: #F8F8F9;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: none;
}

.filter-panel.active {
    display: block;
}

/* Filtre Header */
.filter-header {
    background: #F8F8F9;
    color: #233E7D;
    /* Lacivert - temaya uygun */
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.filter-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #233E7D;
    /* Lacivert - temaya uygun */
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #233E7D;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Filtre Body */
.filter-body {
    padding: 20px;
    max-height: calc(90vh - 64px);
    overflow-y: auto;
}

/* Filtre Grubu */
.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group label i {
    color: #17a2b8;
    font-size: 16px;
}

.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #f8f9fa;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #17a2b8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1);
}

/* Filtre Butonları */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.filter-apply-btn,
.filter-reset-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.filter-apply-btn {
    background: #233E7D;
    color: #fff;
}

.filter-apply-btn:hover {
    background: #1a2f5f;
}

.filter-reset-btn {
    background: #f1f3f5;
    color: #666;
}

.filter-reset-btn:hover {
    background: #e9ecef;
}

/* Aktif Filtreler */
.active-filters {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #17a2b8;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    margin: 4px;
}

.filter-tag i {
    cursor: pointer;
    font-size: 14px;
}

.filter-tag i:hover {
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .filter-panel {
        width: calc(100vw - 20px);
        max-width: 320px;
    }

    .filter-toggle-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ------------------------------------------------------
   KATMAN KONTROLÜ (LAYER CONTROL)
------------------------------------------------------ */

.layer-control {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.layer-control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    margin: 0;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 15px;
    font-weight: 500;
}

.layer-control-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.layer-control-item.active {
    background: #fff;
    border-color: transparent;
}

.layer-control-item .layer-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #fff;
    flex-shrink: 0;
}

.layer-control-item.layer-ihtiyaclar .layer-icon {
    background: #df5f4e;
}

.layer-control-item.layer-destekler .layer-icon {
    background: #67CE85;
}

.layer-control-item .layer-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    flex: 1;
    white-space: nowrap;
}

.layer-control-item .layer-count {
    display: none;
}

/* Inactive state */
.layer-control-item:not(.active) {
    opacity: 0.5;
    background: #f5f5f5;
}

.layer-control-item:not(.active) .layer-label {
    color: #999;
}

.layer-control-item:not(.active) .layer-icon {
    opacity: 0.5;
}

/* ------------------------------------------------------
   TURUNCU POPUP (DESTEKLER İÇİN)
------------------------------------------------------ */

.popup-card-destek {
    background: linear-gradient(180deg, #67CE85 0%, #4fb56e 100%) !important;
}

.popup-card-destek .popup-btn {
    background: #ffffff22;
    border: 1px solid #ffffff55;
}

.popup-card-destek .popup-btn:hover {
    background: #ffffff33;
}

/* Destek popup için tip (üçgen) */
.leaflet-popup-content-wrapper:has(.popup-card-destek)~.leaflet-popup-tip {
    background: #4fb56e !important;
}

/* Destek popup için kapatma butonu (yeşil) */
.leaflet-popup-content-wrapper:has(.popup-card-destek)~.leaflet-container a.leaflet-popup-close-button,
.leaflet-popup:has(.popup-card-destek) .leaflet-popup-close-button {
    background: #43955b !important;
}

@media (max-width: 768px) {
    .layer-control {
        bottom: 15px;
        gap: 8px;
        max-width: calc(100% - 20px);
    }

    .layer-control-item {
        padding: 10px 16px;
        font-size: 14px;
    }

    .layer-control-item .layer-label {
        font-size: 14px;
    }

    .layer-control-item .layer-icon {
        width: 10px;
        height: 10px;
    }
}

/* ------------------------------------------------------
   STK MARKER VE POPUP STİLLERİ
------------------------------------------------------ */

/* STK Custom Marker */
.stk-marker {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 30px;
    height: 42px;
    position: relative;
    background: #233E7D;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(35, 62, 125, 0.4);
    transition: all 0.3s ease;
}

.marker-pin:hover {
    transform: rotate(-45deg) scale(1.1);
    box-shadow: 0 5px 15px rgba(35, 62, 125, 0.6);
}

.marker-pin i {
    color: #fff;
    font-size: 14px;
    transform: rotate(45deg);
}

/* STK Popup Wrapper */
.stk-popup-wrapper .leaflet-popup-content-wrapper {
    background: #fff !important;
    border-radius: 12px !important;
    padding: 0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
}

.stk-popup-wrapper .leaflet-popup-tip {
    background: #fff !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1) !important;
}

.stk-popup-wrapper .leaflet-popup-close-button {
    background: #233E7D !important;
    color: #fff !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    font-size: 18px !important;
    margin: -10px -10px 0 0 !important;
    padding: 0 !important;
    line-height: 28px !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
}

.stk-popup-wrapper .leaflet-popup-close-button:hover {
    background: #1a2f5f !important;
    transform: scale(1.1);
}

/* STK Popup Content */
.stk-popup {
    padding: 20px;
    min-width: 250px;
    max-width: 300px;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.stk-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 700;
    color: #233E7D;
    line-height: 1.3;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 12px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.stk-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.stk-field:hover {
    background: #e9ecef;
}

.stk-field:last-child {
    margin-bottom: 0;
}

.stk-field i {
    color: #233E7D;
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.stk-field span {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.stk-field strong {
    color: #233E7D;
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

/* Loading & Not Found States */
.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.loader-1 {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #233E7D;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.not-found {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: #fff;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.not-found span {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #666;
}

.not-found i {
    color: #dc3545;
    font-size: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .stk-popup {
        padding: 16px;
        min-width: 220px;
    }

    .stk-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .stk-field {
        padding: 8px;
        gap: 10px;
    }

    .stk-field span {
        font-size: 13px;
    }

    .marker-pin {
        width: 26px;
        height: 36px;
    }

    .marker-pin i {
        font-size: 12px;
    }
}

/* ------------------------------------------------------
   ACF HARİTA ARAMA KUTUSU (STK Form)
------------------------------------------------------ */

#acf-map-search-wrapper {
    margin-bottom: 10px;
    position: relative;
}

#acf-map-search-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

#acf-map-search-input {
    flex: 1;
    padding: 11px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #333;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

#acf-map-search-input::placeholder {
    color: #a0aec0;
}

#acf-map-search-input:focus {
    border-color: #233E7D;
    box-shadow: 0 0 0 3px rgba(35, 62, 125, 0.1);
}

#acf-map-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 20px;
    background: #233E7D;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

#acf-map-search-btn:hover {
    background: #1a2f5f;
    transform: translateY(-1px);
}

#acf-map-search-btn:active {
    transform: translateY(0);
}

#acf-map-search-btn:disabled {
    background: #7a8fb5;
    cursor: not-allowed;
    transform: none;
}

#acf-map-search-btn svg {
    flex-shrink: 0;
}

#acf-map-search-btn svg.spin {
    animation: spin 0.8s linear infinite;
}

#acf-map-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}

.acf-search-result-item {
    padding: 11px 16px;
    font-size: 13.5px;
    color: #333;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.4;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.acf-search-result-item:last-child {
    border-bottom: none;
}

.acf-search-result-item:hover {
    background: #f0f4ff;
    color: #233E7D;
}

.acf-search-no-result {
    padding: 14px 16px;
    font-size: 13.5px;
    color: #888;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    text-align: center;
}

@media (max-width: 768px) {
    #acf-map-search-input {
        font-size: 13px;
        padding: 10px 12px;
    }

    #acf-map-search-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}