/* ================ BUTTONS ================ */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--gray-extra-light);
    color: var(--dark-color);
}

.btn-secondary:hover {
    background-color: var(--gray-light);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #d33426;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-circle);
}

/* ================ FORM ELEMENTS ================ */
.input-group {
    position: relative;
    margin-bottom: var(--space-md);
}

.input-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 14px;
    color: var(--gray-dark);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* ================ CARDS ================ */
.card {
    background-color: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--gray-light);
}

.card-body {
    padding: var(--space-md);
}

.card-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--gray-light);
    background-color: var(--gray-extra-light);
}

/* ================ MODALS ================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-medium);
    transition: background-color var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--gray-extra-light);
}

.modal-body {
    padding: var(--space-md);
}

.modal-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ================ TOOLTIPS ================ */
.tooltip {
    position: absolute;
    background-color: var(--dark-color);
    color: var(--white);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    pointer-events: none;
    z-index: 4000;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.tooltip:after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 5px solid transparent;
}

.tooltip-top:after {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--dark-color);
}

.tooltip-bottom:after {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--dark-color);
}

.tooltip-left:after {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: var(--dark-color);
}

.tooltip-right:after {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: var(--dark-color);
}

/* ================ SEARCH COMPONENT ================ */
.leaflet-search-container {
  flex: 1;
  max-width: 600px;
  margin: 0 var(--space-lg);
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  width: 100%;
  background-color: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.search-box:focus-within {
  box-shadow: var(--shadow-md);
}

#leaflet-search-input {
  flex-grow: 1;
  height: 40px;
  border: none;
  background: var(--gray-extra-light);
  padding: 0 var(--space-md);
  font-size: clamp(0.8125rem, 1.5vw, 0.875rem);
  outline: none;
}

#leaflet-search-input:focus {
  background: var(--white);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.search-buttons {
  display: flex;
  margin-left: var(--space-sm);
}

.search-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-circle);
  border: none;
  background: var(--gray-extra-light);
  color: var(--gray-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.search-btn:hover {
  background: var(--gray-light);
  color: var(--primary-color);
}

/* Autocomplete */
.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--white);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1001;
  display: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  transform-origin: top;
}

.autocomplete-suggestions li {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  font-size: 14px;
}

.autocomplete-suggestions li:hover {
  background-color: var(--gray-extra-light);
}

/* Search Results */
.search-results {
  position: absolute;
  top: 50px;
  left: 0;
  width: 100%;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1001;
  display: none;
  transition: max-height var(--transition-medium) ease-out;
}

.search-result-item {
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.search-result-item:hover {
  background: var(--gray-extra-light);
}

.result-icon {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8f0fe;
  color: var(--primary-color);
  flex-shrink: 0;
}

.result-content {
  flex: 1;
}

.result-content h5 {
  margin: 0 0 4px;
  color: var(--dark-color);
  font-size: 14px;
}

.result-content p {
  margin: 0;
  color: var(--gray-dark);
  font-size: 12px;
  line-height: 1.5;
}

.result-actions {
  margin-top: 10px;
}

.btn-zoom-to {
  border: none;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.search-no-results,
.search-error {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-dark);
  font-size: 13px;
}

.search-no-results i,
.search-error i {
  color: var(--gray-medium);
}

/* Explorer Panel */
.leaflet-explorer-panel {
  position: absolute;
  top: 86px;
  left: 16px;
  width: min(390px, calc(100vw - 92px));
  max-height: calc(var(--leaflet-app-height) - 150px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 26px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(14px);
  z-index: 12;
  transform: translateX(-118%);
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
}

.leaflet-explorer-panel.is-open {
  transform: translateX(0);
  opacity: 1;
}

.leaflet-explorer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.leaflet-explorer-kicker {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  font-weight: 700;
  color: #1d4ed8;
}

.leaflet-explorer-header h2 {
  margin: 6px 0 0;
  color: #111827;
  font-size: 26px;
  line-height: 1.1;
}

.leaflet-explorer-close,
.leaflet-explorer-refresh {
  border: none;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.leaflet-explorer-toolbar,
.leaflet-explorer-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.leaflet-explorer-stats {
  flex-wrap: wrap;
  color: #475569;
  font-size: 12px;
}

.leaflet-explorer-stats strong {
  color: #0f172a;
}

.leaflet-explorer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.explorer-chip {
  border: none;
  background: #eef4ff;
  color: #0f172a;
  border-radius: 999px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.explorer-chip small {
  color: #64748b;
}

.explorer-chip.is-active {
  background: var(--chip-color);
  color: #fff;
}

.explorer-chip.is-active small {
  color: rgba(255, 255, 255, 0.85);
}

.leaflet-explorer-empty {
  padding: 14px 0;
  color: #64748b;
  font-size: 13px;
}

.leaflet-explorer-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.explorer-place-card {
  display: grid;
  grid-template-columns: 40px 1fr 32px;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.18);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.explorer-place-card:hover,
.explorer-place-card.is-active {
  transform: translateY(-1px);
  border-color: rgba(66, 133, 244, 0.28);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.explorer-place-pin {
  width: 40px;
  height: 40px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: var(--pin-color);
}

.explorer-place-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.explorer-place-meta span {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}

.explorer-place-copy h3 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
}

.explorer-place-copy p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.explorer-place-cta {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: #ffffff;
  color: #2563eb;
  cursor: pointer;
}

.leaflet-explorer-detail {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.explorer-detail-placeholder,
.explorer-detail-header + p {
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
}

.explorer-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.explorer-detail-kicker {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 700;
  color: #1d4ed8;
}

.explorer-detail-header h4 {
  margin: 6px 0 0;
  font-size: 18px;
  color: #0f172a;
}

.explorer-detail-link {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.explorer-detail-coords {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.explorer-detail-coords span {
  background: #eff6ff;
  color: #1e40af;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}

.explorer-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.explorer-action-btn {
  border: none;
  border-radius: 14px;
  background: #0f172a;
  color: #fff;
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.explorer-action-btn:last-child {
  background: #eff6ff;
  color: #1e3a8a;
}

.leaflet-explorer-marker span {
  width: 20px;
  height: 20px;
  display: block;
  border-radius: 999px 999px 999px 0;
  background: var(--marker-color);
  transform: rotate(-45deg);
  position: relative;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.18);
}

.leaflet-explorer-marker span::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: #fff;
}

.leaflet-explorer-cluster {
  width: 44px !important;
  height: 44px !important;
  margin-left: -22px !important;
  margin-top: -22px !important;
  border-radius: 999px;
  background: rgba(66, 133, 244, 0.9);
  border: 5px solid rgba(255, 255, 255, 0.9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(66, 133, 244, 0.24);
}

.leaflet-place-popup .leaflet-popup-content-wrapper {
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
}

.leaflet-place-popup-card {
  padding: 4px;
}

.leaflet-place-popup-kicker {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 700;
  color: #1d4ed8;
}

.leaflet-place-popup-card h4 {
  margin: 6px 0 8px;
  color: #0f172a;
  font-size: 16px;
}

.leaflet-place-popup-card p {
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.leaflet-place-popup-link {
  display: inline-flex;
  margin-top: 12px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.search-result-icon {
  margin-right: var(--space-md);
  color: var(--gray-medium);
}

.search-result-title {
  font-weight: 500;
  color: var(--gray-dark);
}

.search-result-address {
  font-size: 12px;
  color: var(--gray-medium);
  margin-top: var(--space-xs);
}

/* Buttons */
.btn-control {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-circle);
  border: none;
  background: var(--white);
  color: var(--gray-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--space-md);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-control-exit {
  width: auto;
  min-width: 112px;
  height: 42px;
  padding: 0 16px;
  gap: 0;
  text-decoration: none;
  border-radius: 14px;
  border: 1px solid #b91c1c;
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.24);
  justify-content: center;
  text-align: center;
}

.btn-control-exit i {
  display: none;
  font-size: 14px;
}

.btn-control-exit span {
  display: inline-block;
  color: #fff;
  line-height: 1;
  text-align: center;
}

.btn-control-exit:hover {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(185, 28, 28, 0.28);
}

.btn-control:hover {
  background: var(--gray-extra-light);
  color: var(--primary-color);
  transform: scale(1.05);
}

.btn-control-exit:hover {
  transform: translateY(-1px);
}

/* Tambahkan di file CSS Anda */
.measure-result-popup {
    pointer-events: auto;
}

.measure-result-popup .leaflet-popup-close-button {
    color: #fff;
    background-color: #e74c3c;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 14px;
    margin-right: -8px;
    margin-top: -8px;
}

.measure-result-popup .leaflet-popup-content-wrapper {
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.measure-result-popup .leaflet-popup-content {
    margin: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.measure-marker {
    color: #3498db;
    font-size: 18px;
    text-shadow: 0 0 3px rgba(255,255,255,0.8);
}


/* Heatmap Widget Container */
.heatmap-widget {
    font-family: 'Roboto', sans-serif;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 15px;
    /* margin-bottom: 20px; */
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.heatmap-widget:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Header Section */
.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.heatmap-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
}

.heatmap-header h4 i {
    margin-right: 10px;
    color: #ff6b6b;
}

/* Controls Section */
.heatmap-actions {
    display: flex;
    gap: 15px;
}

.heatmap-intensity,
.heatmap-radius {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.heatmap-intensity label,
.heatmap-radius label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.heatmap-intensity input[type="range"],
.heatmap-radius input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
}

.heatmap-intensity input[type="range"]::-webkit-slider-thumb,
.heatmap-radius input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #ff6b6b;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.heatmap-intensity input[type="range"]::-webkit-slider-thumb:hover,
.heatmap-radius input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #ff5252;
}

/* Data Source Selector */
.heatmap-data-source {
    margin: 15px 0;
}

.heatmap-data-source label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.heatmap-data-source select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    font-size: 13px;
    color: #333;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
}

.heatmap-data-source select:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

/* Legend Section */
.heatmap-legend {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.legend-gradient {
    height: 10px;
    width: 100%;
    border-radius: 5px;
    margin-bottom: 5px;
    background: linear-gradient(to right,
        #4e79a7,
        #59a14f,
        #f28e2b,
        #e15759);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .heatmap-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .heatmap-actions {
        width: 100%;
        margin-top: 10px;
        flex-wrap: wrap;
    }

    .heatmap-intensity,
    .heatmap-radius {
        width: 48%;
    }
}

/* Animation for Loading */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.heatmap-widget.loading .heatmap-header h4::after {
    content: "Loading...";
    margin-left: 10px;
    font-size: 12px;
    color: #999;
    animation: pulse 1.5s infinite;
}
