/* =====================================================
   Satellite map page — styles
   ===================================================== */

.sat-body { overflow-x: hidden; }

.sat-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: clamp(12px, 1.6vw, 20px);
  padding: clamp(12px, 1.6vw, 20px);
  align-items: start;
  max-width: 1800px;
  margin: 0 auto;
}

/* ---------------- sidebar ---------------- */

.sat-side {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-inline-end: 4px;
  scrollbar-width: thin;
}
.sat-side::-webkit-scrollbar { width: 7px; }
.sat-side::-webkit-scrollbar-thumb { background: #cfe3ea; border-radius: 8px; }

.sat-side .card { padding: 14px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

input[type="date"],
input[type="url"] {
  font-family: inherit;
  font-size: 12.5px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--c-line);
  background: #fbfeff;
  color: var(--c-ink);
  direction: ltr;
  text-align: right;
}
input[type="date"]:focus,
input[type="url"]:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .14);
}

.btn-block { width: 100%; }

.hint {
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--c-ink-soft);
  margin-top: 8px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--c-ink);
  padding: 6px 0;
  cursor: pointer;
}
.switch-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--c-brand);
  cursor: pointer;
}

/* ---------------- scene list ---------------- */

.scene-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  max-height: 246px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.scene-list::-webkit-scrollbar { width: 6px; }
.scene-list::-webkit-scrollbar-thumb { background: #cfe3ea; border-radius: 8px; }

.scene-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
  text-align: right;
  font-family: inherit;
  font-size: 12px;
  background: #fbfeff;
  border: 1px solid var(--c-line);
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
  color: var(--c-ink);
}
.scene-item:hover { background: #f2fafc; border-color: #b9dbe6; }
.scene-item.is-active {
  border-color: var(--c-brand);
  background: #e9f8fc;
  box-shadow: inset 3px 0 0 var(--c-brand);
}
.scene-item .s-date { font-weight: 700; }
.scene-item .s-meta {
  grid-column: 1 / -1;
  font-size: 10.5px;
  color: var(--c-ink-soft);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.scene-cloud {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}
.cloud-good { background: #dcfce7; color: #116c35; }
.cloud-mid { background: #fef3c7; color: #8a5b00; }
.cloud-bad { background: #fee2e2; color: #a01d16; }

/* ---------------- layer modes ---------------- */

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-ink-soft);
  background: #fbfeff;
  border: 1px solid var(--c-line);
  border-radius: 9px;
  padding: 7px 8px;
  cursor: pointer;
  transition: all .14s ease;
}
.mode-btn:hover { background: #f2fafc; }
.mode-btn.is-active {
  border-color: var(--c-brand);
  background: #e9f8fc;
  color: var(--c-brand-dark);
  box-shadow: 0 0 0 2px rgba(14, 116, 144, .10);
}

.mode-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: 0 0 auto;
  border: 1px solid rgba(15, 44, 56, .15);
}
.sw-status { background: linear-gradient(135deg, #16a34a 45%, #dc2626 55%); }
.sw-rgb { background: linear-gradient(135deg, #4d6a3a, #b9a06b, #5b7f8c); }
.sw-ndwi { background: linear-gradient(135deg, #b08040, #f2f0d6, #0c4a82); }
.sw-mndwi { background: linear-gradient(135deg, #8a6d5a, #e6dccb, #1565a8); }
.sw-water { background: linear-gradient(135deg, #f4f7f8 45%, #08699a 55%); }
.sw-ndvi { background: linear-gradient(135deg, #ddc9a8, #2f7a34); }

/* ---------------- status summary (activity, no owner names) ---------------- */

.status-summary { display: grid; gap: 6px; }

.status-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.ss-pill {
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.ss-active { background: var(--c-active-soft); color: #116c35; }
.ss-inactive { background: var(--c-inactive-soft); color: #a01d16; }
.ss-nodata { background: #eef2f6; color: #55636e; }

.status-basin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--c-ink-soft);
  background: #fbfeff;
  border: 1px solid var(--c-line);
  border-radius: 9px;
  padding: 6px 9px;
}
.status-basin-row .sb-name { display: inline-flex; align-items: center; font-weight: 600; color: var(--c-ink); }
.status-basin-row .sb-nums {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--c-ink);
  direction: ltr;
}

/* ---------------- basin upload page ---------------- */

.basin-type { display: grid; gap: 7px; margin-bottom: 12px; }

/* شماره مرحله در عنوان کارت‌های بارگذاری (۱ حوضه آبریز · ۲ حوضچه ماهی) */
.slot-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-brand, #0e7490);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  flex: 0 0 auto;
  box-shadow: 0 2px 6px -2px rgba(14, 116, 144, .55);
}
#pondSlot .slot-num { background: #0284c7; box-shadow: 0 2px 6px -2px rgba(2, 132, 199, .55); }

.bt-opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--c-line);
  background: #fbfeff;
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.bt-opt:hover { background: #f2fafc; }
.bt-opt:has(input:checked) {
  border-color: var(--c-brand);
  background: #e9f8fc;
  box-shadow: 0 0 0 2px rgba(14, 116, 144, .10);
}
.bt-opt input { margin-top: 3px; accent-color: var(--c-brand); flex: 0 0 auto; }
.bt-opt span { display: grid; gap: 1px; }
.bt-opt b { font-size: 12.5px; font-weight: 700; color: var(--c-ink); }
.bt-opt i { font-style: normal; font-size: 10.5px; color: var(--c-ink-soft); }

.basin-list { display: grid; gap: 5px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.basin-list::-webkit-scrollbar { width: 6px; }
.basin-list::-webkit-scrollbar-thumb { background: #cfe3ea; border-radius: 8px; }

.basin-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  background: #fbfeff;
  border: 1px solid var(--c-line);
  border-radius: 9px;
  padding: 6px 9px;
}
.basin-row .br-name { flex: 1; font-weight: 600; color: var(--c-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.basin-row .br-area { font-variant-numeric: tabular-nums; color: var(--c-ink-soft); direction: ltr; font-size: 10.5px; }

.diag-body { display: grid; gap: 5px; }
.diag-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  background: #fbfeff;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 6px 9px;
}
.diag-row span { color: var(--c-ink-soft); flex: 0 0 auto; }
.diag-row b {
  font-weight: 700;
  color: var(--c-ink);
  text-align: left;
  word-break: break-word;
  direction: ltr;
}
.diag-row b:is(:lang(fa)) { direction: rtl; }

/* ---------------- pond list ---------------- */

.pond-list {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.pond-list::-webkit-scrollbar { width: 6px; }
.pond-list::-webkit-scrollbar-thumb { background: #cfe3ea; border-radius: 8px; }

.pond-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 11.5px;
  text-align: right;
  background: #fbfeff;
  border: 1px solid var(--c-line);
  border-radius: 9px;
  padding: 6px 9px;
  cursor: pointer;
  color: var(--c-ink);
  width: 100%;
}
.pond-item:hover { background: #f2fafc; }
.pond-item.is-active { border-color: var(--c-brand); background: #e9f8fc; }
.pond-item .pi-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pond-item .pi-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--c-brand-dark); }
.pond-item .pi-pct.is-empty { color: var(--c-nodata); font-weight: 500; }

/* ---------------- Earth Engine bridge ---------------- */

.code-block {
  direction: ltr;
  text-align: left;
  font-family: "Consolas", "Menlo", monospace;
  font-size: 10.5px;
  line-height: 1.6;
  background: #0b2f3c;
  color: #d7f4ff;
  border-radius: 9px;
  padding: 10px;
  overflow: auto;
  max-height: 220px;
  margin: 8px 0;
  white-space: pre;
}
.help code { display: inline; }

/* ---------------- map ---------------- */

.sat-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.map-shell {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--c-line);
  box-shadow: var(--shadow-sm);
  background: #0d2530;
}

.sat-map {
  height: clamp(430px, calc(100vh - 150px), 820px);
  width: 100%;
  background: #0d2530;
}

.leaflet-container { font-family: var(--font) !important; background: #0d2530; }
.leaflet-control-attribution { font-size: 9.5px !important; direction: ltr; }
.leaflet-bar a { color: var(--c-ink); }
.leaflet-popup-content { font-family: var(--font); direction: rtl; font-size: 12px; margin: 10px 12px; }
.leaflet-popup-content-wrapper { border-radius: 10px; }

/* compact pond labels — must not swamp the imagery */
.leaflet-tooltip.pond-label {
  background: rgba(9, 40, 52, .86);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 7px;
  color: #f2fdff;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  padding: 2px 6px;
  box-shadow: 0 4px 12px -8px #000;
  white-space: nowrap;
}
.leaflet-tooltip.pond-label b { font-weight: 800; }
.leaflet-tooltip.pond-label.is-selected {
  background: #0e7490;
  border-color: #a5f3fc;
  font-size: 11px;
  box-shadow: 0 0 0 2px rgba(165, 243, 252, .5), 0 6px 16px -10px #000;
}
.leaflet-tooltip.pond-label::before { display: none; }

.sat-overlay { image-rendering: auto; }

/* Top status strip: full width so it can never collide with the badges below */
.map-status {
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: 520;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(9, 40, 52, .90);
  color: #eafaff;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  padding: 7px 12px;
  text-align: center;
  min-height: 32px;
  box-sizing: border-box;
}
.map-status span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.map-status i { animation: spin 1.1s linear infinite; flex: 0 0 auto; }
.map-status.is-idle i { animation: none; }
.map-status.is-error { background: rgba(143, 26, 19, .95); }
.map-status[hidden] { display: none; }

.map-badges {
  position: absolute;
  inset-inline-end: 10px;
  top: 44px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: min(420px, calc(100% - 20px));
  pointer-events: none;
}

.pill {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(9, 40, 52, .86);
  color: #eafaff;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
  direction: ltr;
}
.pill-strong { background: rgba(14, 116, 144, .95); }

.map-legend {
  position: absolute;
  inset-inline-start: 12px;
  bottom: 26px;
  z-index: 500;
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--c-line);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 158px;
  box-shadow: 0 10px 24px -18px #000;
}
.legend-title { font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.legend-ramp {
  height: 9px;
  border-radius: 999px;
  background: #eee;
  border: 1px solid rgba(15, 44, 56, .12);
}
.legend-scale {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--c-ink-soft);
  margin-top: 3px;
  direction: ltr;
}

.place-hint {
  position: absolute;
  inset-inline: 12px;
  bottom: 12px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  background: rgba(255, 249, 230, .97);
  border: 1px solid #f2dfa8;
  color: #7a5300;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 12px;
  box-shadow: 0 10px 24px -18px #000;
}
.place-hint[hidden] { display: none; }

/* ---------------- pond panel ---------------- */

.pond-panel,
.pixel-card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.pond-panel[hidden],
.pixel-card[hidden] { display: none; }

.pond-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.pond-panel-head h2 { font-size: 15px; font-weight: 800; }

.pp-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 9px;
}
.pp-stat {
  border: 1px solid var(--c-line);
  border-radius: 10px;
  padding: 8px 11px;
  background: #fbfeff;
}
.pp-stat b { display: block; font-size: 16px; font-weight: 800; }
.pp-stat span { font-size: 10.5px; color: var(--c-ink-soft); }

.pp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

/* ---------------- responsive ---------------- */

@media (max-width: 1080px) {
  .sat-layout { grid-template-columns: minmax(0, 1fr); }
  .sat-side { order: 2; max-height: none; overflow: visible; }
  .sat-main { order: 1; }
  .sat-map { height: 62vh; min-height: 380px; }
}

@media (max-width: 720px) {
  .sat-side .card { padding: 12px; }
  .sat-map { height: 58vh; min-height: 320px; }
  .map-legend { min-width: 128px; bottom: 20px; padding: 6px 8px; }
  .map-badges { max-width: 60%; }
  .pill { font-size: 10px; padding: 4px 8px; }
  .place-hint { font-size: 11px; flex-wrap: wrap; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
}

@media print {
  .sat-side, .map-status, .map-badges, .place-hint { display: none !important; }
  .sat-map { height: 420px; }
}
