/* ===== ANNOTATION TOOLS - İğne & Metin Araç Takımı ===== */

/* Dropdown Container */
.pp-annotation-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 10020;
}

/* Dropdown Menu */
.pp-annotation-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  min-width: 180px;
  padding: 6px;
  z-index: 10030;
  animation: ppAnnotMenuIn 0.15s ease-out;
}

.pp-annotation-dropdown.open .pp-annotation-menu {
  display: block;
}

@keyframes ppAnnotMenuIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Menu Arrow */
.pp-annotation-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  border-right: none;
  transform: translateX(-50%) rotate(45deg);
}

/* Menu Items */
.pp-annotation-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 13.5px;
  font-weight: 500;
  font-family: 'Inter', 'Roboto', Arial, sans-serif;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.pp-annotation-menu-item:hover {
  background: #f0f4ff;
  color: #1e40af;
}

.pp-annotation-menu-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.pp-annotation-menu-item.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: #fff;
}

.pp-annotation-menu-item.active:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
  color: #fff;
}

/* Danger item (Temizle) */
.pp-annotation-menu-item--danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* Menu Divider */
.pp-annotation-menu-divider {
  margin: 4px 8px;
  border: none;
  border-top: 1px solid #e5e7eb;
}

/* İç açılır menüler: Çizim / Ölçüm */
.pp-annotation-menu-group {
  position: relative;
}

.pp-annotation-submenu-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 13.5px;
  font-weight: 500;
  font-family: 'Inter', 'Roboto', Arial, sans-serif;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: left;
}

.pp-annotation-submenu-trigger:hover {
  background: #f0f4ff;
  color: #1e40af;
}

.pp-annot-submenu-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pp-annot-submenu-label i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.pp-annot-submenu-chevron {
  font-size: 11px;
  opacity: 0.5;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.pp-annotation-menu-group.open .pp-annotation-submenu-trigger {
  background: #eff6ff;
  color: #1e40af;
}

.pp-annotation-menu-group.open .pp-annot-submenu-chevron {
  opacity: 0.85;
}

.pp-annotation-submenu {
  display: none;
  position: absolute;
  left: calc(100% + 4px);
  top: 0;
  min-width: 228px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 6px;
  z-index: 10036;
}

.pp-annotation-menu-group.open .pp-annotation-submenu {
  display: block;
}

.pp-annotation-submenu .pp-annotation-menu-item {
  white-space: nowrap;
}

@media (max-width: 520px) {
  .pp-annotation-submenu {
    position: static;
    left: auto;
    top: auto;
    min-width: 100%;
    margin: 4px 0 6px 0;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
  }

  .pp-annotation-menu-group.open .pp-annot-submenu-chevron {
    transform: rotate(90deg);
  }
}

/* Toolbar button active state when a tool is selected */
#annotationToolBtn.annotation-active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  border-color: #d97706 !important;
  color: #fff !important;
}

/* ===== MAP PIN MARKER ===== */
.pp-map-pin {
  width: 32px;
  height: 42px;
  cursor: grab;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: filter 0.15s ease;
  position: relative;
}

.pp-map-pin:hover {
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
}

.pp-map-pin svg {
  width: 100%;
  height: 100%;
}

.pp-map-pin .pin-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  font-size: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.pp-map-pin:hover .pin-delete {
  display: flex;
}

.pp-annotation-selected .pp-map-pin {
  filter: drop-shadow(0 0 0 rgba(0,0,0,0.1)) drop-shadow(0 0 12px rgba(59,130,246,0.45));
}

/* ===== MAP TEXT ANNOTATION ===== */
.pp-map-text-annotation {
  position: relative;
  display: inline-block;
  width: max-content;
  max-width: 300px;
  padding-bottom: 10px;
  cursor: move;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}

.pp-map-text-annotation .text-content {
  display: block;
  width: 180px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid #3b82f6;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.4;
  min-width: 120px;
  max-width: 280px;
  min-height: 34px;
  outline: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-wrap: break-word;
  overflow-wrap: break-word;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
}

.pp-map-text-annotation .text-content:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.pp-annotation-selected .pp-map-text-annotation .text-content {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.28);
}

.pp-map-text-annotation .text-content::placeholder {
  color: #94a3b8;
  font-style: italic;
}

/* Ok (pointer) — döndürülmüş kare tekniği ile kutuya yapışık */
.pp-map-text-annotation .text-pointer {
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-right: 2px solid #3b82f6;
  border-bottom: 2px solid #3b82f6;
  transform: translateX(-50%) rotate(45deg);
}

/* Text toolbar (silme butonu) */
.pp-map-text-annotation .text-toolbar {
  position: absolute;
  top: -28px;
  right: 0;
  display: none;
  gap: 2px;
  background: #1e293b;
  border-radius: 6px;
  padding: 3px 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 10;
}

.pp-map-text-annotation:hover .text-toolbar {
  display: flex;
}

.pp-map-text-annotation .text-toolbar button {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: background 0.12s;
}

.pp-map-text-annotation .text-toolbar button:hover {
  background: rgba(255,255,255,0.15);
}

.pp-map-text-annotation .text-toolbar button.text-delete-btn:hover {
  background: #ef4444;
}

/* ===== CURSOR CHANGES ===== */
.pp-annotation-cursor-pin .mapboxgl-canvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='32' viewBox='0 0 24 32'%3E%3Cpath d='M12 0C5.4 0 0 5.4 0 12c0 9 12 20 12 20s12-11 12-20C24 5.4 18.6 0 12 0z' fill='%23ef4444'/%3E%3Ccircle cx='12' cy='11' r='4' fill='white'/%3E%3C/svg%3E") 12 32, crosshair;
}

.pp-annotation-cursor-text .mapboxgl-canvas {
  cursor: text;
}

.pp-annotation-cursor-arrow .mapboxgl-canvas {
  cursor: crosshair;
}

.pp-annotation-cursor-pencil .mapboxgl-canvas {
  cursor: crosshair;
}

.pp-annotation-cursor-free .mapboxgl-canvas {
  cursor: cell;
}

/* Özellik paneli (renk / kalem ucu) */
.pp-annotation-action-toolbox {
  display: none;
  position: fixed;
  z-index: 10040;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  padding: 12px 14px;
  font-family: 'Inter', 'Roboto', Arial, sans-serif;
}

.pp-annotation-action-toolbox.visible {
  display: block;
}

.pp-annot-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pp-annot-action-title {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
}

.pp-annot-action-close {
  border: none;
  background: #f1f5f9;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  color: #475569;
}

.pp-annot-action-close:hover {
  background: #e2e8f0;
}

.pp-annot-action-hint {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 10px;
  line-height: 1.35;
}

.pp-annot-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #334155;
}

.pp-annot-action-row label {
  flex: 0 0 72px;
  font-weight: 500;
}

.pp-annot-color-input {
  width: 44px;
  height: 32px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

.pp-annot-width-input {
  flex: 1;
  min-width: 0;
}

.pp-annot-width-val {
  font-variant-numeric: tabular-nums;
  min-width: 1.5em;
}

/* Ölçüm modu: bitir düğmesi */
.pp-annot-measure-tools {
  margin-bottom: 12px;
}

.pp-annot-measure-finish-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.35);
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.pp-annot-measure-finish-btn i {
  font-size: 14px;
  opacity: 0.95;
}

.pp-annot-measure-finish-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.45);
}

.pp-annot-measure-finish-btn:active {
  transform: scale(0.98);
}

.pp-annot-measure-finish-btn:focus-visible {
  outline: 2px solid #34d399;
  outline-offset: 2px;
}

/* Harita / ekran çizim modu anahtarı */
.pp-annot-clip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.pp-annot-clip-caption {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}

.pp-annot-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.pp-annot-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pp-annot-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: background 0.2s;
}

.pp-annot-switch-slider::before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pp-annot-switch input:checked + .pp-annot-switch-slider {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.pp-annot-switch input:checked + .pp-annot-switch-slider::before {
  transform: translateX(20px);
}

/* Ekran modu 2D örtü — harita WebGL üstü, etkileşim yok */
.mapboxgl-canvas-container .pp-annotation-screen-canvas {
  pointer-events: none;
}

/* ===== ARROW HELPERS ===== */

/* İlk tıklamada görünen başlangıç noktası */
.pp-arrow-start-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3b82f6;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.4), 0 2px 6px rgba(0,0,0,0.3);
  pointer-events: none;
  animation: ppArrowDotPulse 1.2s ease-in-out infinite;
}

@keyframes ppArrowDotPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.3); }
}

/* Ok ortasındaki silme noktası — yalnızca ok seçiliyken görünür */
.pp-arrow-delete-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.7);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.12s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  border: 2px solid rgba(255,255,255,0.4);
}

/* :has() kullanılmaz — eski tarayıcılarda ok tutamakları görünür kalıyordu */
.mapboxgl-marker.pp-map-annot-arrow-grip.pp-annotation-selected .pp-arrow-delete-dot:hover {
  background: #ef4444;
  border-color: #fff;
}

/* Ok X + uç tutamakları: yalnızca .pp-annotation-selected (harita kök marker’da) */
.mapboxgl-marker.pp-map-annot-arrow-grip:not(.pp-annotation-selected) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.mapboxgl-marker.pp-map-annot-arrow-grip.pp-annotation-selected {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.mapboxgl-marker.pp-map-annot-arrow-grip.pp-annotation-selected .pp-arrow-delete-dot {
  opacity: 1;
}

.pp-measure-delete-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.82);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  border: 2px solid rgba(255,255,255,0.55);
  transition: background 0.12s ease, transform 0.12s ease;
}

.pp-measure-delete-dot:hover {
  background: #ef4444;
  border-color: #fff;
  transform: scale(1.08);
}

.pp-arrow-endpoint {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #2563eb;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: grab;
  transform: scale(0.95);
  transition: opacity 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.mapboxgl-marker.pp-map-annot-arrow-grip.pp-annotation-selected .pp-arrow-endpoint {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1.14);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.25), 0 1px 5px rgba(0,0,0,0.28);
}

.mapboxgl-marker.pp-map-annot-arrow-grip.pp-annotation-selected .pp-arrow-endpoint:hover {
  transform: scale(1.18);
}

/* ===== ANNOTATION STATUS BAR ===== */
.pp-annotation-status {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', 'Roboto', Arial, sans-serif;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  z-index: 5000;
  display: none;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  animation: ppAnnotStatusIn 0.2s ease-out;
}

.pp-annotation-status.visible {
  display: flex;
}

@keyframes ppAnnotStatusIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pp-annotation-status i {
  font-size: 15px;
}

.pp-annotation-status .status-ok {
  margin-left: 8px;
  margin-right: 4px;
  background: rgba(34, 197, 94, 0.95);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.12s;
}

.pp-annotation-status .status-ok:hover {
  background: rgba(22, 163, 74, 1);
}

.pp-annotation-status .status-close {
  margin-left: 8px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: background 0.12s;
}

.pp-annotation-status .status-close:hover {
  background: rgba(255,255,255,0.3);
}
