:root {
  --bg-dark: #0a0e17;
  --bg-card: rgba(13, 18, 28, 0.92);
  --border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --dhiraagu-orange: #ff6600;
  --dhiraagu-orange-hover: #e05500;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background: #000;
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Fullscreen Map */
#map {
  width: 100%;
  height: 100%;
  background: #05080f;
  z-index: 1;
}

/* Prevent sub-pixel seam lines between tiles in snapshots */
.leaflet-tile {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  outline: none !important;
}

.leaflet-tile-container {
  overflow: visible;
}

/* Floating Top Search Bar (Mobile First) */
.floating-top-bar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  max-width: 480px;
  margin: 0 auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.search-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 5px 8px 5px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  min-height: 52px;
}

.btn-logo-wrapper {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: transform 0.15s;
}

.btn-logo-wrapper:active {
  transform: scale(0.92);
}

.dhiraagu-icon {
  height: 26px;
  width: auto;
  max-width: 75px;
  object-fit: contain;
  display: block;
}

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-mono);
  outline: none;
  padding: 8px 28px 8px 4px;
}

.input-wrapper input::placeholder {
  color: #64748b;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.88rem;
}

.btn-clear {
  position: absolute;
  right: 2px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-icon:active {
  background: rgba(255, 102, 0, 0.25);
  color: var(--dhiraagu-orange);
}

/* Suggestions Dropdown */
.search-suggestions {
  margin-top: 8px;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.suggestion-item {
  padding: 11px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

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

.suggestion-item:active {
  background: rgba(255, 102, 0, 0.2);
}

.s-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #ffffff;
}

.s-name {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.search-feedback {
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.9);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: #f87171;
  text-align: center;
}

/* Floating Location Card */
.location-card {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  max-width: 440px;
  margin: 0 auto;
  z-index: 1000;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.cell-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-cone-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-cone-toggle.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
}

/* Co-located Cells at Site */
.co-located-section {
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px;
}

.co-header {
  margin-bottom: 8px;
}

.co-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.co-count-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
}

.co-cells-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 140px;
  overflow-y: auto;
}

.co-cell-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.76rem;
  transition: background 0.15s;
}

.co-cell-item:active, .co-cell-item.selected {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
}

.co-cell-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #ffffff;
}

.co-cell-meta {
  font-size: 0.68rem;
  color: #94a3b8;
  display: flex;
  gap: 8px;
}

.btn-highlight {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
}

/* Full Detail Page Modal */
.detail-page-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

.detail-sub-coords {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #38bdf8;
  margin-top: 2px;
}

.detail-page-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.detail-table-intro {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.detail-hint {
  font-size: 0.7rem;
  color: #64748b;
}

.detail-table-wrapper {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #090d16;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
  text-align: left;
}

.detail-table th {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 10px;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  color: #e2e8f0;
  white-space: nowrap;
}

.detail-table tr:hover, .detail-table tr.selected {
  background: rgba(56, 189, 248, 0.1);
}

.detail-page-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
}

.card-cell-id {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffffff;
}

.tech-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: #1e3a8a;
  color: #93c5fd;
  font-family: var(--font-mono);
}

.card-site-name {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-top: 2px;
}

.btn-close-card {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.card-params {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.param-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 6px 4px;
  text-align: center;
}

.param-box .lbl {
  display: block;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.param-box .val {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
}

.card-coords-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mono-coords {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #38bdf8;
}

.coord-buttons {
  display: flex;
  gap: 6px;
}

.btn-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-sans);
}

.btn-action:active {
  background: var(--dhiraagu-orange);
  border-color: var(--dhiraagu-orange);
}

/* Settings Modal */
.settings-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-mini-logo {
  height: 20px;
  width: auto;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.settings-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setting-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #38bdf8;
  font-weight: 600;
}

.setting-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Color Presets */
.color-presets {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}

.color-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-pill:active {
  transform: scale(0.9);
}

.color-pill.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--c);
}

.custom-color-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px dashed rgba(255, 255, 255, 0.4);
}

.custom-color-wrapper input[type="color"] {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 48px;
  height: 48px;
  border: none;
  cursor: pointer;
  background: none;
}

/* Sliders */
.setting-slider {
  width: 100%;
  accent-color: var(--dhiraagu-orange);
  cursor: pointer;
  height: 6px;
  border-radius: 3px;
  margin: 6px 0;
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: #090d16;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 7px 4px;
  border-radius: 7px;
  cursor: pointer;
}

.segment-btn.active {
  background: var(--dhiraagu-orange);
  color: #ffffff;
}

/* Toggle Switch */
.toggle-group {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider.round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  transition: 0.2s;
  border-radius: 24px;
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider.round {
  background-color: var(--dhiraagu-orange);
}

input:checked + .slider.round:before {
  transform: translateX(20px);
}

.settings-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-secondary-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 6px;
}

.btn-secondary-link:active {
  color: #fff;
}

.btn-primary-action {
  background: var(--dhiraagu-orange);
  border: none;
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 16px;
}

/* Snapshot Modal */
.snapshot-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.snapshot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.snapshot-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.snapshot-preview-box {
  width: 100%;
  max-height: 52vh;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.snapshot-img {
  max-width: 100%;
  max-height: 52vh;
  object-fit: contain;
  display: block;
  user-select: auto;
  -webkit-user-select: auto;
  pointer-events: auto;
}

.snapshot-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--dhiraagu-orange);
  border: none;
  color: #ffffff;
  text-align: center;
  padding: 13px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
}

.btn-download:active {
  background: var(--dhiraagu-orange-hover);
}
