/* Thematic Map Studio - Frontend Map CSS */

.tms-frontend-wrapper {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border: 1px solid #e1e4e8;
}

/* Arama ve Filtre Çubuğu */
.tms-front-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #ffffff;
    border-bottom: 1px solid #eaecef;
    flex-wrap: wrap;
    gap: 10px;
    z-index: 10;
}

.tms-front-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 380px;
}

.tms-front-search-input {
    width: 100%;
    padding: 7px 12px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f9fafb;
    box-sizing: border-box;
}

.tms-front-search-input:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.tms-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    max-height: 260px;
    overflow-y: auto;
    z-index: 2000;
}

.tms-search-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.tms-search-item:hover {
    background: #f0f7ff;
    color: #1d4ed8;
}

.tms-search-item-cat {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Filtre Butonları (Pills) */
.tms-front-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tms-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 14px;
    background: #f3f4f6;
    color: #374151;
    cursor: pointer;
    user-select: none;
    border: 1px solid #e5e7eb;
    transition: all 0.15s;
}

.tms-filter-pill:hover {
    background: #e5e7eb;
}

.tms-filter-pill.active {
    background: #1f2937;
    color: #ffffff;
    border-color: #1f2937;
}

.tms-filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Harita Alanı */
.tms-map-canvas {
    width: 100%;
    background: #f8fafc;
    z-index: 1;
}

/* Harita Alt Barı */
.tms-front-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #f9fafb;
    border-top: 1px solid #eaecef;
    font-size: 12px;
    color: #6b7280;
}

.tms-front-title {
    font-weight: 600;
    color: #374151;
}

/* Özel Popup Tasarımı (MapHub Benzeri Zengin Kart) */
.leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: 10px !important;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.2) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    line-height: 1.5 !important;
    max-width: 340px !important;
}

.tms-popup-card {
    display: flex;
    flex-direction: column;
}

.tms-popup-img-wrap {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    background: #111827;
}

.tms-popup-img-wrap img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.tms-popup-img-wrap img:hover {
    transform: scale(1.05);
}

.tms-popup-inner {
    padding: 14px 16px 16px;
    max-height: 260px;
    overflow-y: auto;
}

.tms-popup-category {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #eff6ff;
    color: #1d4ed8;
}

.tms-popup-title {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.tms-popup-desc {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.6;
}

.tms-popup-desc p {
    margin: 0 0 10px 0;
}

.tms-popup-desc p:last-child {
    margin-bottom: 0;
}

.tms-popup-desc img {
    max-width: 100%;
    border-radius: 6px;
    margin: 8px 0;
}

/* Marker Stilleri */
.tms-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.tms-custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    transition: transform 0.15s ease;
    box-sizing: border-box;
    user-select: none;
}

.tms-custom-marker:hover {
    transform: scale(1.25);
    z-index: 9999 !important;
}

.tms-custom-marker.shape-circle {
    border-radius: 50%;
}

.tms-custom-marker.shape-square {
    border-radius: 5px;
}

.tms-custom-marker.shape-diamond {
    border-radius: 4px;
    transform: rotate(45deg);
}

.tms-custom-marker.shape-diamond:hover {
    transform: rotate(45deg) scale(1.25);
}

.tms-custom-marker.shape-diamond .tms-marker-inner {
    transform: rotate(-45deg);
}

.tms-custom-marker-dot {
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
}

.tms-marker-pin-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.35));
    transition: transform 0.15s ease;
}

.tms-marker-pin-wrap:hover {
    transform: scale(1.2);
    z-index: 9999 !important;
}

/* Tıklanabilir Görsel ve Link Butonu Stilleri */
.tms-popup-img-link {
    display: block;
    position: relative;
    text-decoration: none;
    overflow: hidden;
}

.tms-popup-img-link:hover img {
    transform: scale(1.06);
}

.tms-img-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(17, 24, 39, 0.85);
    color: #ffffff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.tms-popup-link-wrap {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

.tms-btn-external-link {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 8px 12px;
    background: #2563eb;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
}

.tms-btn-external-link:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* Marker Cluster Güçlendirilmiş Daire Stilleri (Tema Çakışmalarını Tamamen Önler) */
.marker-cluster {
    background-clip: padding-box !important;
    border-radius: 50% !important;
}

.marker-cluster div {
    width: 30px !important;
    height: 30px !important;
    margin-left: 5px !important;
    margin-top: 5px !important;
    text-align: center !important;
    border-radius: 50% !important;
    font: 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.marker-cluster span {
    line-height: 1 !important;
    font-size: 11px !important;
}

.marker-cluster-small {
    background-color: rgba(181, 226, 140, 0.6) !important;
}
.marker-cluster-small div {
    background-color: rgba(110, 204, 57, 0.85) !important;
}
.marker-cluster-small span {
    color: #064e3b !important;
}

.marker-cluster-medium {
    background-color: rgba(254, 240, 138, 0.6) !important;
}
.marker-cluster-medium div {
    background-color: rgba(250, 204, 21, 0.9) !important;
}
.marker-cluster-medium span {
    color: #713f12 !important;
}

.marker-cluster-large {
    background-color: rgba(254, 205, 211, 0.6) !important;
}
.marker-cluster-large div {
    background-color: rgba(248, 113, 113, 0.9) !important;
}
.marker-cluster-large span {
    color: #7f1d1d !important;
}

/* ========================================================
   FLEX YAPI VE YAN LEJANT (MAPHUB TARZI DİZİN PANELİ)
   ======================================================== */
.tms-map-flex-container {
    display: flex;
    flex-direction: row;
    position: relative;
    width: 100%;
    height: 650px;
    overflow: hidden;
    background: #f8fafc;
}

.tms-embed-full-page .tms-map-flex-container {
    flex: 1 1 auto;
    height: calc(100vh - 48px);
    width: 100%;
}

.tms-map-flex-container .tms-map-canvas {
    flex: 1 1 auto;
    height: 100% !important;
    min-width: 0;
    position: relative;
    z-index: 1;
}

/* Yan Lejant Paneli (Sidebar) */
.tms-sidebar-legend {
    width: 0;
    max-width: 320px;
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 1000;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -3px 0 12px rgba(0,0,0,0.06);
    overflow: hidden;
    visibility: hidden;
    flex-shrink: 0;
}

.tms-sidebar-legend.open {
    width: 310px;
    visibility: visible;
}

/* Lejant Aç/Kapa Düğmesi */
.tms-legend-toggle-btn {
    position: absolute;
    top: 60px;
    right: 12px;
    z-index: 1001;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    user-select: none;
}

.tms-legend-toggle-btn:hover {
    background: #f3f4f6;
    color: #111827;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.tms-legend-toggle-btn.active {
    background: #1f2937;
    color: #ffffff;
    border-color: #1f2937;
}

/* Lejant Üst Başlık */
.tms-legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #eaecef;
    flex-shrink: 0;
}

.tms-legend-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tms-legend-badge {
    background: #e5e7eb;
    color: #374151;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

.tms-legend-close {
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.tms-legend-close:hover {
    color: #111827;
    background: #e5e7eb;
}

/* Lejant Arama Kutusu */
.tms-legend-search-box {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    background: #ffffff;
    flex-shrink: 0;
}

.tms-legend-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
    background: #f9fafb;
    transition: border-color 0.2s;
}

.tms-legend-search-input:focus {
    border-color: #2563eb;
    background: #ffffff;
}

/* Toplu Eylemler (Tümünü Aç / Kapat) */
.tms-legend-bulk-actions {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.tms-btn-bulk {
    flex: 1;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #4b5563;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.tms-btn-bulk:hover {
    background: #f3f4f6;
    color: #111827;
    border-color: #9ca3af;
}

/* Lejant Ağaç Listesi */
.tms-legend-list {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
}

/* Katman Satırı (Seviye 1 - Layer) */
.tms-legend-layer {
    border-bottom: 1px solid #e5e7eb;
}

.tms-legend-layer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: #f8fafc;
    cursor: pointer;
    user-select: none;
    border-left: 3px solid #2563eb;
    transition: background 0.15s;
}

.tms-legend-layer-header:hover {
    background: #f1f5f9;
}

.tms-layer-head-left {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    min-width: 0;
}

.tms-layer-head-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tms-layer-head-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

.tms-legend-layer-categories {
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.tms-legend-layer-categories.collapsed {
    display: none !important;
}

/* Grup / Kategori Satırı (Seviye 2 - Category) */
.tms-legend-group {
    border-bottom: 1px solid #f3f4f6;
}

.tms-legend-group:last-child {
    border-bottom: none;
}

.tms-legend-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px 7px 20px;
    background: #ffffff;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.tms-legend-group-header:hover {
    background: #f9fafb;
}

.tms-group-left {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    min-width: 0;
}

.tms-group-caret {
    font-size: 11px;
    color: #9ca3af;
    width: 12px;
    text-align: center;
    display: inline-block;
    transition: transform 0.15s;
}

.tms-group-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.tms-group-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tms-group-count {
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
}

.tms-group-right {
    display: flex;
    align-items: center;
    margin-left: 6px;
}

.tms-group-eye,
.tms-item-eye {
    font-size: 13px;
    cursor: pointer;
    opacity: 0.85;
    padding: 2px 4px;
    border-radius: 3px;
    transition: opacity 0.15s, transform 0.1s;
    user-select: none;
}

.tms-group-eye:hover,
.tms-item-eye:hover {
    opacity: 1;
    transform: scale(1.15);
}

.tms-group-eye.muted,
.tms-item-eye.muted {
    opacity: 0.25;
    filter: grayscale(100%);
}

/* Grup Alt Elemanları (Items) */
.tms-legend-items {
    background: #fafbfc;
    border-top: 1px solid #f3f4f6;
    padding: 4px 0 6px 0;
}

.tms-legend-items.collapsed {
    display: none !important;
}

.tms-legend-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px 5px 36px;
    transition: background 0.15s;
    cursor: pointer;
}

.tms-legend-item-row:hover {
    background: #edf2f7;
}

.tms-item-left {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    min-width: 0;
}

.tms-item-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tms-item-title {
    font-size: 11.5px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.tms-item-title:hover {
    color: #1d4ed8;
    font-weight: 500;
}

/* Poligon Tooltip */
.tms-polygon-tooltip {
    background: rgba(17, 24, 39, 0.9) !important;
    border: none !important;
    border-radius: 5px !important;
    color: #ffffff !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2) !important;
}

.tms-polygon-tooltip .leaflet-tooltip-pane {
    z-index: 1000;
}

/* Mimari Yapı Meta-Veri Tablosu (Pafta, Parsel, Ada, Alan vs.) */
.tms-meta-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    font-size: 11.5px;
    border-top: 1px solid #f1f3f5;
    padding-top: 8px;
}

.tms-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 2px 0;
    border-bottom: 1px dotted #e9ecef;
}

.tms-meta-row:last-child {
    border-bottom: none;
}

.tms-meta-key {
    font-weight: 600;
    color: #495057;
    margin-right: 8px;
    white-space: nowrap;
}

.tms-meta-val {
    color: #212529;
    text-align: right;
    word-break: break-word;
}

/* Mobil Uyumluluk */
@media (max-width: 768px) {
    .tms-sidebar-legend {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        max-width: 85%;
        z-index: 2000;
    }
    .tms-sidebar-legend.open {
        width: 85%;
    }
}
