:root {
    --tpfund-primary: #009ddc;
    --tpfund-primary-strong: #007ab0;
    --tpfund-primary-soft: rgba(0, 157, 220, 0.12);
    --tpfund-text: #1f1f2b;
    --tpfund-muted: #6e6e7a;
    --tpfund-border: #e8e8ef;
    --tpfund-card: #ffffff;
    --tpfund-pill: #f2f3f8;
    --tpfund-shadow: 0 24px 60px rgba(18, 7, 60, 0.15);
    --tpfund-font: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: light;
    }
}

.tpfund-em-wrapper {
    font-family: var(--tpfund-font);
    position: relative;
    padding: 24px;
    background: radial-gradient(circle at 20% 20%, rgba(228, 58, 25, 0.06), transparent 40%),
        radial-gradient(circle at 80% 10%, rgba(68, 86, 235, 0.08), transparent 45%),
        #f9f7f3;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #f1ede6;
    width: 100%;
    background-color: #1c3c35;
}

.tpfund-em-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tpfund-em-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tpfund-em-filters label {
    display: grid;
    gap: 1px;
    font-size: 14px;
    color: white;
}

.tpfund-em-filters select {
    min-width: 180px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--tpfund-border);
    background: #fff;
    font-weight: 600;
    margin-bottom:5px;
}

.tpfund-em-map {
    width: 100%;
    height: 720px;
    border-radius: 12px;
    box-shadow: var(--tpfund-shadow);
    overflow: hidden;
}

.tpfund-em-empty {
    text-align: center;
    margin-top: 16px;
    color: var(--tpfund-muted);
}

/* Map markers */
.tpfund-em-marker {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(228, 58, 25, 0.12);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpfund-em-marker .inner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(228, 58, 25, 0.28);
    position: absolute;
    top: 11px;
    left: 11px;
}

.tpfund-em-marker .dot {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #0c0c1a;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.tpfund-em-marker .dot::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 4px solid currentColor;
    opacity: 0.25;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    padding: 0 !important;
    overflow: visible !important;
    box-shadow: 0 22px 60px rgba(16, 9, 64, 0.25) !important;
    max-width: none !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    color: var(--tpfund-text);
    min-width: 400px !important;
    max-width: none !important;
    width: auto !important;
}

.leaflet-popup {
    max-width: none !important;
}

.tpfund-em-popup-wrap .leaflet-popup-content {
    max-width: none !important;
    width: auto !important;
}

.tpfund-em-popup {
    padding: 16px 18px;
}

.tpfund-em-popup h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.tpfund-em-popup .meta-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0;
    color: var(--tpfund-muted);
    font-weight: 600;
}

.tpfund-em-popup .tag {
    background: var(--tpfund-pill);
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--tpfund-border);
}

.tpfund-em-popup .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.tpfund-em-popup .stat {
    background: #faf9ff;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid #ede7ff;
    font-weight: 600;
    color: #2a1b5a;
}

.tpfund-em-popup a {
    color: var(--tpfund-primary);
    font-weight: 600;
    text-decoration: none;
}

/* Cluster overrides */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background: transparent;
    box-shadow: none;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: rgba(33, 37, 41, 0.06);
    color: #111427;
    border: 2px solid rgba(17, 20, 39, 0.2);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    line-height: 48px;
    font-weight: 700;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.14);
}

@media (max-width: 900px) {
    .tpfund-em-map {
        height: 520px;
    }
    .tpfund-em-filters select {
        min-width: 150px;
    }
}

@media (max-width: 640px) {
    .tpfund-em-wrapper {
        padding: 16px;
    }

    .tpfund-em-toolbar {
        justify-content: center;
    }

    .leaflet-popup-content {
        min-width: 260px;
    }
}

/* Popup styling */
.leaflet-popup-content-wrapper.tpfund-em-popup-wrap,
.leaflet-popup-content-wrapper.tpfund-em-popup-wrap .leaflet-popup-content-wrapper {
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(16, 9, 64, 0.25);
    padding: 0;
}

.leaflet-popup-content.tpfund-em-popup-wrap,
.tpfund-em-popup-wrap .leaflet-popup-content {
    margin: 0;
}

.tpfund-em-popup {
    padding: 16px 18px 14px;
    max-width: 420px;
    color: var(--tpfund-text);
}

.tpfund-em-popup h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.popup-header {
    display: flex;
    gap: 12px;
    align-items: center;
}

.popup-logo {
    flex: 0 0 70px;
    height: 70px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--tpfund-border);
    background: #f7f7fb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-titles {
    flex: 1;
}

.popup-desc {
    margin: 0;
    color: var(--tpfund-muted);
    line-height: 1.5;
    font-size: 14px;
}

.popup-tags,
.popup-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    font-weight: 700;
    font-size: 14px;
    color: #241c3f;
}

.line-text {
    font-weight: 700;
    color: #241c3f;
    white-space: normal !important;
    word-wrap: break-word;
    overflow: visible !important;
    text-overflow: unset !important;
    max-width: none !important;
}


.popup-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.popup-gallery img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: none;
}

.popup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--tpfund-primary);
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 520px) {
    .popup-header {
        align-items: flex-start;
    }
    .popup-logo {
        flex: 0 0 56px;
        height: 56px;
    }
    .tpfund-em-popup {
        max-width: 320px;
    }
}

/* Redesigned popup card */
.tpfund-em-popup-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    color: #1f1f2b;
    box-shadow: 0 22px 60px rgba(17, 9, 56, 0.2);
    min-width: 400px !important;
    max-width: none !important;
    width: auto !important;
    text-align: center;
}

.popup-top {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
}

.popup-text {
    flex: 1;
    text-align: center;
    width: 100%;
}

.tpfund-em-popup-card h3 {
    margin: 0 0 6px;
    font-size: 20px;
    line-height: 1.3;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-wrap: break-word;
    max-width: none !important;
}

.popup-desc {
    margin: 0;
    color: #4b4b55;
    line-height: 1.5;
    font-size: 14px;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-wrap: break-word;
    max-width: none !important;
}

.popup-logo-box {
    width: 110px;
    height: 110px;
    border: 2px solid #c9b7f2;
    border-radius: 12px;
    background: #faf8ff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0 auto;
}

.popup-logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    text-align: center;
}

.popup-icon {
    font-size: 16px;
    line-height: 1;
}

.popup-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    text-align: center;
}

.popup-stats-col {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 12px;
    justify-content: center;
    text-align: center;
}


.stat-line {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 6px 8px;
    font-weight: 600;
    color: #1f1f2b;
    font-size: 14px;
    white-space: normal !important;
    word-wrap: break-word;
    overflow: visible !important;
    text-overflow: unset !important;
    max-width: none !important;
    text-align: center;
}


.popup-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.popup-gallery.scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.popup-gallery img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: none;
}

.popup-gallery.scroll img {
    flex: 0 0 110px;
}

.popup-link {
    color: var(--tpfund-primary);
    font-weight: 700;
    text-decoration: none;
}

.link-row {
    margin-top: 12px;
}



@media (max-width: 540px) {
    .tpfund-em-popup-card {
        max-width: 320px;
    }
    .popup-logo-box {
        flex: 0 0 80px;
        height: 80px;
    }
    .tpfund-em-popup-card h3 {
        font-size: 18px;
    }
}

/* List view cards */
.tpfund-em-view-toggle {
    display: flex;
    gap: 14px;
    align-items: center;
}

.tpfund-em-tab {
    background: transparent;
    border: none;
    padding: 10px 6px;
    font-weight: 700;
    font-size: 15px;
    color: white;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.tpfund-em-tab.is-active {
    color: var(--tpfund-primary);
    border-color: white;
}

.tpfund-em-tab:hover { 
    background-color: #007ab08a;
    color:white;
    
}

.tpfund-em-list {
    margin-top: 18px;
    display: none !important;
    gap: 16px;
}

.tpfund-em-list.is-active {
    display: grid !important;
}

.tpfund-em-list-card {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 18px;
    padding: 16px 18px;
    border: 1px solid var(--tpfund-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(17, 9, 56, 0.06);
}

.tpfund-em-list-card h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.list-desc {
    margin: 0 0 10px;
    color: var(--tpfund-muted);
    line-height: 1.5;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-wrap: break-word;
    max-width: none !important;
}

.list-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 10px;
}

.list-stats .stat-line {
    text-align: left;
    padding: 4px 0;
}

.list-row {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    align-items: center;
    margin: 6px 0;
}

.list-icon {
    font-size: 16px;
}

.list-line {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-weight: 700;
    color: #1f1f2b;
}

.list-link {
    color: var(--tpfund-primary);
    font-weight: 700;
    text-decoration: none;
}

.list-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f7fb;
    border: 1px solid #ece9f7;
    border-radius: 12px;
    overflow: hidden;
}

.list-logo img {
    width: 100%;
    height: 120px;
    object-fit: contain;
}

@media (max-width: 820px) {
    .tpfund-em-list-card {
        grid-template-columns: 1fr;
    }
    .list-logo img {
        height: 100px;
    }
}


.tpfund-em-tab {background-color:#007ab0; }


.tpfund-em-tab.is-active {background-color:#007ab0; color:white; }

/* Feature items with icons */
.feature-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.feature-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
}

/* Turkey label on map */
.turkey-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Hide default Leaflet attribution prefix */
.leaflet-control-attribution {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.8) !important;
    padding: 2px 8px !important;
}

/* Pagination styles */
.tpfund-em-pagination {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px 0;
}

.tpfund-em-pagination.is-visible {
    display: flex;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--tpfund-border);
    border-radius: 8px;
    background: #fff;
    color: var(--tpfund-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--tpfund-primary);
    color: #fff;
    border-color: var(--tpfund-primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-page {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tpfund-border);
    border-radius: 8px;
    background: #fff;
    color: var(--tpfund-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-page:hover:not(.is-active) {
    background: var(--tpfund-pill);
    border-color: var(--tpfund-primary);
}

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

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--tpfund-muted);
    font-weight: 600;
}

@media (max-width: 640px) {
    .tpfund-em-pagination {
        flex-wrap: wrap;
        gap: 10px;
    }

    .pagination-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .pagination-page {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}
