/* ─── Hisseli Parsel Çizme Sayfası ─── */

/* Ana layout */
.ps-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #0f172a;
  color: #f1f5f9;
}

/* Header - Ortak topbar override (ps-page icinde fixed degil, flex akisina dahil) */
.ps-page .pp-header {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  width: 100%;
  z-index: 100;
  flex-shrink: 0;
}

/* Aksiyon bar */
.ps-action-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  overflow: visible;
  z-index: 90;
  min-height: 40px;
  flex-wrap: wrap;
}

.ps-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid #475569;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.ps-action-btn:hover {
  background: #334155;
  color: #f1f5f9;
}
.ps-action-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}
.ps-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ps-action-btn.ps-btn-danger {
  color: #f87171;
  border-color: #7f1d1d;
}
.ps-action-btn.ps-btn-danger:hover {
  background: #7f1d1d;
  color: #fca5a5;
}
.ps-action-btn i {
  font-size: 0.85rem;
}

/* Harita katman dropdown */
.ps-map-dropdown {
  position: relative;
  display: inline-flex;
}
.ps-map-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 9999;
  min-width: 130px;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  padding: 4px 0;
  flex-direction: column;
}
.ps-map-dropdown.open .ps-map-dropdown-menu {
  display: flex;
}
.ps-map-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: background 0.12s;
}
.ps-map-dropdown-item:hover {
  background: #334155;
  color: #f1f5f9;
}
.ps-map-dropdown-item.active {
  color: #3b82f6;
  font-weight: 600;
}
.ps-map-dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: 0.85rem;
}
.ps-map-dropdown-divider {
  height: 1px;
  margin: 4px 10px;
  background: #475569;
}
.ps-map-dropdown-item-design {
  color: #93c5fd;
}

/* Harita salt okunur bilgi şeridi (aksiyon barın altı) */
.ps-map-readonly-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 0.8rem;
  color: #fef3c7;
  background: #78350f;
  border-bottom: 1px solid #92400e;
}
.ps-map-readonly-banner i {
  flex-shrink: 0;
  opacity: 0.9;
}

/* Cephe wrap (aksiyon bar icinde) */
.ps-cephe-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Uyarı kutusu */
.ps-warning-box {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  font-size: 0.72rem;
  line-height: 1.4;
}

.ps-action-separator {
  width: 1px;
  height: 20px;
  background: #334155;
  margin: 0 4px;
}

/* Ana içerik (canvas + ayar paneli) */
.ps-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Canvas alanı */
.ps-canvas-area {
  flex: 1;
  position: relative;
  background: #ffffff;
  overflow: hidden;
}
.ps-canvas-area svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Ayar paneli (sol panel) */
.ps-settings-panel {
  width: 260px;
  min-width: 260px;
  background: #1e293b;
  border-left: 1px solid #334155;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 80;
}

.ps-settings-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ps-settings-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ps-btn-group {
  display: flex;
  gap: 4px;
}

.ps-btn-group .ps-option-btn {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #475569;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.ps-btn-group .ps-option-btn:hover {
  background: #334155;
}
.ps-btn-group .ps-option-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}

.ps-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ps-input-group input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #475569;
  border-radius: 6px;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 0.8rem;
  outline: none;
}
.ps-input-group input:focus {
  border-color: #3b82f6;
}
.ps-input-group .ps-unit {
  font-size: 0.7rem;
  color: #64748b;
  white-space: nowrap;
}

/* Metin kutularında sürükleyerek seçim / dokunmatik kaydırma (global canvas dinleyicileriyle çakışmayı azaltır) */
.ps-settings-panel input,
.ps-settings-panel textarea,
.ps-settings-panel select,
#psCustomAreasList input {
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
}

.ps-compute-btn {
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ps-compute-btn:hover {
  background: #2563eb;
}
.ps-compute-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mod barları */
.ps-mode-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #0f172a;
  border-bottom: 1px solid #334155;
  z-index: 85;
}
.ps-mode-bar.visible {
  display: flex;
}

.ps-mode-bar-label {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
  margin-right: 4px;
}

/* İstatistik chip */
.ps-stats-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 6px 12px;
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  border-radius: 20px;
  font-size: 0.75rem;
  z-index: 50;
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.ps-stats-warn {
  color: #f87171;
  font-weight: 600;
}

/* Floating araçlar */
.ps-floating-tools {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 50;
}

.ps-float-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  backdrop-filter: blur(4px);
}
.ps-float-btn:hover {
  background: #334155;
}

/* No geometry / Loading */
.ps-no-geometry {
  padding: 3rem;
  text-align: center;
  color: #94a3b8;
}

.ps-loading {
  padding: 2rem;
  text-align: center;
}

/* Modal overrides */
#parcelSplitPurchaseModal .modal-content,
#psPieceListModal .modal-content,
#psHelpModal .modal-content {
  background: #1e293b;
  color: #f1f5f9;
}
#parcelSplitPurchaseModal .modal-header,
#psPieceListModal .modal-header,
#psHelpModal .modal-header {
  border-color: #334155;
}
#parcelSplitPurchaseModal .modal-footer,
#psPieceListModal .modal-footer,
#psHelpModal .modal-footer {
  border-color: #334155;
}

/* Piece list table dark theme */
#psPieceListBody .table {
  color: #f1f5f9;
}
#psPieceListBody .table th {
  background: #334155;
  border-color: #475569;
}
#psPieceListBody .table td {
  border-color: #475569;
}

/* Responsive */
@media (max-width: 768px) {
  .ps-settings-panel {
    width: 100%;
    min-width: unset;
    max-height: 220px;
    border-left: none;
    border-top: 1px solid #334155;
  }
  .ps-body {
    flex-direction: column;
  }
  .ps-action-bar {
    padding: 4px 8px;
  }
}
