/* =========================================================================
   Modal de upload de ortoimagens (.tif) — camada ortoareasLayer.
   Namespace "orto-upload" e variaveis escopadas no proprio overlay para
   nao colidir com nada do restante do projeto (ex.: --bg/--text globais).
   ========================================================================= */

#orto-upload-overlay {
  --orto-brand: #2563eb;
  --orto-brand-dark: #1d4ed8;
  --orto-ok: #16a34a;
  --orto-err: #dc2626;
  --orto-bg: #ffffff;
  --orto-border: #e2e8f0;
  --orto-text: #1e293b;
  --orto-text-muted: #64748b;

  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 10020;
}
#orto-upload-overlay.open { display: block; }

#orto-upload-modal {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--orto-bg);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--orto-border);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.orto-upload-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--orto-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
}
.orto-upload-header h3 { margin: 0; font-size: 15px; color: var(--orto-text); }

.orto-upload-close {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--orto-text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}
.orto-upload-close:hover { background: #e2e8f0; }

.orto-upload-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.orto-upload-file-drop {
  border: 2px dashed var(--orto-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: var(--orto-text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.orto-upload-file-drop.dragover { border-color: var(--orto-brand); background: #eff6ff; }
.orto-upload-file-drop input[type=file] { display: none; }
.orto-upload-file-drop .orto-upload-fname { color: var(--orto-text); font-weight: 600; margin-top: 4px; word-break: break-all; }

.orto-upload-btn {
  border: none;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--orto-brand);
  color: #fff;
}
.orto-upload-btn:hover { background: var(--orto-brand-dark); }
.orto-upload-btn:disabled { background: #94a3b8; cursor: not-allowed; }
.orto-upload-btn.orto-upload-btn-secondary { background: transparent; color: var(--orto-text-muted); border: 1px solid var(--orto-border); }
.orto-upload-btn.orto-upload-btn-secondary:hover { background: #f1f5f9; }

.orto-upload-progress-wrap { display: none; flex-direction: column; gap: 6px; }
.orto-upload-progress-wrap.show { display: flex; }
.orto-upload-progress-bar-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.orto-upload-progress-bar-fg { height: 100%; width: 0%; background: var(--orto-brand); transition: width .2s; }
.orto-upload-progress-label { font-size: 12px; color: var(--orto-text-muted); display: flex; justify-content: space-between; }

.orto-upload-status-line { font-size: 13px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; background: #f8fafc; }
.orto-upload-status-line.ok { color: var(--orto-ok); background: #f0fdf4; }
.orto-upload-status-line.err { color: var(--orto-err); background: #fef2f2; }

.orto-upload-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--orto-brand);
  border-radius: 50%;
  animation: orto-upload-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes orto-upload-spin { to { transform: rotate(360deg); } }

.orto-upload-steps { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--orto-text-muted); }
.orto-upload-steps .orto-upload-step { display: flex; align-items: center; gap: 6px; }
.orto-upload-steps .orto-upload-step.done { color: var(--orto-ok); }
.orto-upload-steps .orto-upload-step.active { color: var(--orto-brand); font-weight: 600; }
.orto-upload-steps .orto-upload-step.error { color: var(--orto-err); font-weight: 600; }
.orto-upload-steps .orto-upload-dot { width: 6px; height: 6px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.orto-upload-steps .orto-upload-step.done .orto-upload-dot { background: var(--orto-ok); }
.orto-upload-steps .orto-upload-step.active .orto-upload-dot { background: var(--orto-brand); }
.orto-upload-steps .orto-upload-step.error .orto-upload-dot { background: var(--orto-err); }

.orto-upload-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--orto-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
